22 Sep, 2016

1 commit


19 Jul, 2016

3 commits


15 Jul, 2016

1 commit


14 Jul, 2016

1 commit


10 May, 2016

5 commits


05 Apr, 2016

1 commit


26 Feb, 2016

1 commit

  • The id buffer in ata_device is a DMA target, but it isn't explicitly
    cacheline aligned. Due to this, adjacent fields can be overwritten with
    stale data from memory on non coherent architectures. As a result, the
    kernel is sometimes unable to communicate with an ATA device.

    Fix this by ensuring that the id buffer is cacheline aligned.

    This issue is similar to that fixed by Commit 84bda12af31f
    ("libata: align ap->sector_buf").

    Signed-off-by: Harvey Hunt
    Cc: linux-kernel@vger.kernel.org
    Cc: # 2.6.18
    Signed-off-by: Tejun Heo

    Harvey Hunt
     

26 Jan, 2016

1 commit

  • The AHCI driver code stops and starts port DMA engines at will
    without considering the power state of the particular port. The
    AHCI specification isn't very clear on how to handle this scenario,
    leaving implementation open to interpretation.

    Broadcom's STB SATA host controller is unable to handle port DMA
    controller restarts when the port in question is in low power mode.
    When a port enters partial or slumber mode, its PHY is powered down.
    When a controller restart is requested, the controller's internal
    state machine expects the PHY to be brought back up by software which
    never happens in this case, resulting in failures.

    To avoid this situation, logic is added to manually wake up the port
    just before its DMA engine is stopped, if the port happens to be in
    a low power state. HBA initiated power management ensures that the port
    eventually returns to its configured low power state, when the link is
    idle (as per the conditions listed in the spec). A new host flag is also
    added to ensure this logic is only exercised for hosts with the above
    limitation.

    tj: Formatting changes.

    Signed-off-by: Danesh Petigara
    Reviewed-by: Markus Mayer
    Signed-off-by: Tejun Heo

    Danesh Petigara
     

12 Jan, 2016

1 commit

  • Pull libata updates from Tejun Heo:
    "Mostly low level driver specific changes.

    Two changes are somewhat noteworthy. First, Dan's patchset to support
    per-port msix interrupt handling for ahci, which was tried last cycle
    but had to be backed out due to a couple issues, is back and seems to
    be working fine. Second, libata exception handling now uses
    usleep_range() instead of msleep() for sleeps < 20ms which can make
    things snappier in some corner cases"

    * 'for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
    libata: skip debounce delay on link resume
    ata: ahci_brcmstb: disable DIPM support
    ata: ahci_brcmstb: enable support for ALPM
    drivers: libata-core: Use usleep_range() instead of msleep() for short sleeps ( interrupt handling
    ahci: per-port msix support

    Linus Torvalds
     

09 Jan, 2016

1 commit

  • The link resume logic uses a 200msec delay while debouncing
    the SControl register. The rationale behind that delay is
    to accommodate some PHYs that behave badly if their SStatus/
    SControl registers are pounded immediately on resume.
    The Broadcom STB SATA PHY does not seem to have this issue.
    This patch introduces a new link flag that allows platforms
    to skip the debounce delay if it isn't needed.

    Signed-off-by: Danesh Petigara
    Signed-off-by: Florian Fainelli
    Signed-off-by: Tejun Heo

    Danesh Petigara
     

07 Dec, 2015

1 commit


01 Oct, 2015

1 commit

  • If the AHCI ports' HPCP or ESP bits are set, the port
    should be considered external (e.g. eSATA) and is marked
    as removable. Userspace tools like udisks then treat it
    like an usb drive.

    With this patch applied, when I plug a drive into the esata port,
    KDE pops up a window asking what to do with the drives(s), just
    like it does for any random USB stick.

    Removability is indicated to the upper layers by way of the
    SCSI RMB bit, as I haven't found another way to signal
    userspace to treat a sata disk like any usb stick.

    Signed-off-by: Manuel Lauss
    Signed-off-by: Tejun Heo

    Manuel Lauss
     

15 Jul, 2015

2 commits

  • Since no longer limiting max_sectors to BLK_DEF_MAX_SECTORS (commit 34b48db66e08),
    data corruption may occur on ST380013AS drive configured on 82801JI (ICH10 Family)
    SATA controller. This patch will allow the driver to limit max_sectors as before

    # cat /sys/block/sdb/queue/max_sectors_kb
    512

    I was able to double the max_sectors_kb value up to 16384 on linux-4.2.0-rc2
    before seeing corruption, but seems safer to use previous limit. Without this
    patch max_sectors_kb will be 32767.

    tj: Minor comment update.

    Reported-by: Jeff Moyer
    Signed-off-by: David Milburn
    Signed-off-by: Tejun Heo
    Cc: stable@vger.kernel.org # v3.19 and later
    Fixes: 34b48db66e08 ("block: remove artifical max_hw_sectors cap")

    David Milburn
     
  • Some devices lose data on TRIM whether queued or not. This patch adds
    a horkage to disable TRIM.

    tj: Collapsed unnecessary if() nesting.

    Signed-off-by: Arne Fitzenreiter
    Signed-off-by: Tejun Heo
    Cc: stable@vger.kernel.org

    Arne Fitzenreiter
     

26 Jun, 2015

1 commit

  • Pull libata updates from Tejun Heo:

    - a number of libata core changes to better support NCQ TRIM.

    - ahci now supports MSI-X in single IRQ mode to support a new
    controller which doesn't implement MSI or INTX.

    - ahci now supports edge-triggered IRQ mode to support a new controller
    which for some odd reason did edge-triggered IRQ.

    - the usual controller support additions and changes.

    * 'for-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (27 commits)
    libata: Do not blacklist Micron M500DC
    ata: ahci_mvebu: add suspend/resume support
    ahci, msix: Fix build error for !PCI_MSI
    ahci: Add support for Cavium's ThunderX host controller
    ahci: Add generic MSI-X support for single interrupts to SATA PCI driver
    libata: finally use __initconst in ata_parse_force_one()
    drivers: ata: add support for Ceva sata host controller
    devicetree:bindings: add devicetree bindings for ceva ahci
    ahci: added support for Freescale AHCI sata
    ahci: Store irq number in struct ahci_host_priv
    ahci: Move interrupt enablement code to a separate function
    Doc: libata: Fix spelling typo found in libata.xml
    ata:sata_nv - Change 1 to true for bool type variable.
    ata: add Broadcom AHCI SATA3 driver for STB chips
    Documentation: devicetree: add Broadcom SATA binding
    libata: Fix regression when the NCQ Send and Receive log page is absent
    ata: hpt366: fix constant cast warning
    ata: ahci_xgene: potential NULL dereference in probe
    ata: ahci_xgene: Add AHCI Support for 2nd HW version of APM X-Gene SoC AHCI SATA Host controller.
    libahci: Add support to handle HOST_IRQ_STAT as edge trigger latch.
    ...

    Linus Torvalds
     

24 Jun, 2015

1 commit

  • Pull SCSI updates from James Bottomley:
    "This is the usual grab bag of driver updates (lpfc, hpsa,
    megaraid_sas, cxgbi, be2iscsi) plus an assortment of minor updates.

    There is also one new driver: the Cisco snic. The advansys driver has
    been rewritten to get rid of the warning about converting it to the
    DMA API, the tape statistics patch got in and finally, there's a
    resuffle of SCSI header files to separate more cleanly initiator from
    target mode (and better share the common definitions)"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (156 commits)
    snic: driver for Cisco SCSI HBA
    qla2xxx: Fix indentation
    qla2xxx: Comment out unreachable code
    fusion: remove dead MTRR code
    advansys: fix compilation errors and warnings when CONFIG_PCI is not set
    mptsas: fix depth param in scsi_track_queue_full
    megaraid: fix irq setup process regression
    lpfc: Update version to 10.7.0.0 for upstream patch set.
    lpfc: Fix to drop PLOGIs from fabric node till LOGO processing completes
    lpfc: Fix scsi task management error message.
    lpfc: Fix cq_id masking problem.
    lpfc: Fix scsi prep dma buf error.
    lpfc: Add support for using block multi-queue
    lpfc: Devices are not discovered during takeaway/giveback testing
    lpfc: Fix vport deletion failure.
    lpfc: Check for active portpeerbeacon.
    lpfc: Update driver version for upstream patch set 10.6.0.1.
    lpfc: Change buffer pool empty message to miscellaneous category
    lpfc: Fix incorrect log message reported for empty FCF record.
    lpfc: Fix rport leak.
    ...

    Linus Torvalds
     

01 Jun, 2015

1 commit


05 May, 2015

1 commit

  • Some devices advertise support for the READ/WRITE LOG DMA EXT commands
    but fail when we try to issue them. This can lead to queued TRIM being
    unintentionally disabled since the relevant feature flag is located in a
    general purpose log page.

    Fall back to unqueued READ LOG EXT if the DMA variant fails while
    reading a log page.

    Signed-off-by: Martin K. Petersen
    Reviewed-by: Hannes Reinecke
    Signed-off-by: Tejun Heo

    Martin K. Petersen
     

26 Apr, 2015

2 commits


14 Apr, 2015

1 commit

  • Pull libata updates from Tejun Heo:

    - Hannes's patchset implements support for better error reporting
    introduced by the new ATA command spec.

    - the deperecated pci_ dma API usages have been replaced by dma_ ones.

    - a bunch of hardware specific updates and some cleanups.

    * 'for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
    ata: remove deprecated use of pci api
    ahci: st: st_configure_oob must be called after IP is clocked.
    ahci: st: Update the ahci_st DT documentation
    ahci: st: Update the DT example for how to obtain the PHY.
    sata_dwc_460ex: indent an if statement
    libata: Add tracepoints
    libata-eh: Set 'information' field for autosense
    libata: Implement support for sense data reporting
    libata: Implement NCQ autosense
    libata: use status bit definitions in ata_dump_status()
    ide,ata: Rename ATA_IDX to ATA_SENSE
    libata: whitespace fixes in ata_to_sense_error()
    libata: whitespace cleanup in ata_get_cmd_descript()
    libata: use READ_LOG_DMA_EXT
    libata: remove ATA_FLAG_LOWTAG
    sata_dwc_460ex: re-use hsdev->dev instead of dwc_dev
    sata_dwc_460ex: move to generic DMA driver
    sata_dwc_460ex: join messages back
    sata: xgene: add ACPI support for APM X-Gene SATA ports
    ata: sata_mv: add proper definitions for LP_PHY_CTL register values

    Linus Torvalds
     

25 Mar, 2015

1 commit

  • sata_sil24 for some reason pukes when tags are allocated round-robin
    which helps tag ordered controllers. To work around the issue,
    72dd299d5039 ("libata: allow sata_sil24 to opt-out of tag ordered
    submission") introduced ATA_FLAG_LOWTAG which tells libata tag
    allocation to do lowest-first.

    However, with the recent switch to blk-mq tag allocation, the liata
    tag allocation code path is no longer used and the workaround is now
    implemented in the block layer and selected by setting
    scsi_host_template->tag_alloc_policy to BLK_TAG_ALLOC_FIFO. See
    9269e23496dd ("libata: make sata_sil24 use fifo tag allocator").

    This leaves ATA_FLAG_LOWTAG withoout any actual user. Remove it.

    Signed-off-by: Tejun Heo
    Cc: Shaohua Li
    Cc: Dan Williams

    Tejun Heo
     

20 Mar, 2015

1 commit

  • SAS controller has its own tag allocation, which doesn't directly match to ATA
    tag, so SAS and SATA have different code path for ata tags. Originally we use
    port->scsi_host (98bd4be1) to destinguish SAS controller, but libsas set
    ->scsi_host too, so we can't use it for the destinguish, we add a new flag for
    this purpose.

    Without this patch, the following oops can happen because scsi-mq uses
    a host-wide tag map shared among all devices with some integer tag
    values >= ATA_MAX_QUEUE. These unexpectedly high tag values cause
    __ata_qc_from_tag() to return NULL, which is then dereferenced in
    ata_qc_new_init().

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000058
    IP: [] ata_qc_new_init+0x3e/0x120
    PGD 32adf0067 PUD 32adf1067 PMD 0
    Oops: 0002 [#1] SMP DEBUG_PAGEALLOC
    Modules linked in: iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi igb
    i2c_algo_bit ptp pps_core pm80xx libsas scsi_transport_sas sg coretemp
    eeprom w83795 i2c_i801
    CPU: 4 PID: 1450 Comm: cydiskbench Not tainted 4.0.0-rc3 #1
    Hardware name: Supermicro X8DTH-i/6/iF/6F/X8DTH, BIOS 2.1b 05/04/12
    task: ffff8800ba86d500 ti: ffff88032a064000 task.ti: ffff88032a064000
    RIP: 0010:[] [] ata_qc_new_init+0x3e/0x120
    RSP: 0018:ffff88032a067858 EFLAGS: 00010046
    RAX: 0000000000000000 RBX: ffff8800ba0d2230 RCX: 000000000000002a
    RDX: ffffffff80505ae0 RSI: 0000000000000020 RDI: ffff8800ba0d2230
    RBP: ffff88032a067868 R08: 0000000000000201 R09: 0000000000000001
    R10: 0000000000000000 R11: 0000000000000000 R12: ffff8800ba0d0000
    R13: ffff8800ba0d2230 R14: ffffffff80505ae0 R15: ffff8800ba0d0000
    FS: 0000000041223950(0063) GS:ffff88033e480000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
    CR2: 0000000000000058 CR3: 000000032a0a3000 CR4: 00000000000006e0
    Stack:
    ffff880329eee758 ffff880329eee758 ffff88032a0678a8 ffffffff80502dad
    ffff8800ba167978 ffff880329eee758 ffff88032bf9c520 ffff8800ba167978
    ffff88032bf9c520 ffff88032bf9a290 ffff88032a0678b8 ffffffff80506909
    Call Trace:
    [] ata_scsi_translate+0x3d/0x1b0
    [] ata_sas_queuecmd+0x149/0x2a0
    [] sas_queuecommand+0xa0/0x1f0 [libsas]
    [] scsi_dispatch_cmd+0xd4/0x1a0
    [] scsi_queue_rq+0x66f/0x7f0
    [] __blk_mq_run_hw_queue+0x208/0x3f0
    [] blk_mq_run_hw_queue+0x88/0xc0
    [] blk_mq_insert_request+0xc4/0x130
    [] blk_execute_rq_nowait+0x73/0x160
    [] sg_common_write+0x3da/0x720 [sg]
    [] sg_new_write+0x250/0x360 [sg]
    [] sg_write+0x13b/0x450 [sg]
    [] vfs_write+0xd1/0x1b0
    [] SyS_write+0x54/0xc0
    [] system_call_fastpath+0x12/0x17

    tj: updated description.

    Fixes: 12cb5ce101ab ("libata: use blk taging")
    Reported-and-tested-by: Tony Battersby
    Signed-off-by: Shaohua Li
    Signed-off-by: Tejun Heo

    Shaohua Li
     

13 Feb, 2015

1 commit

  • Pull block driver changes from Jens Axboe:
    "This contains:

    - The 4k/partition fixes for brd from Boaz/Matthew.

    - A few xen front/back block fixes from David Vrabel and Roger Pau
    Monne.

    - Floppy changes from Takashi, cleaning the device file creation.

    - Switching libata to use the new blk-mq tagging policy, removing
    code (and a suboptimal implementation) from libata. This will
    throw you a merge conflict, since a bug in the original libata
    tagging code was fixed since this code was branched. Trivial.
    From Shaohua.

    - Conversion of loop to blk-mq, from Ming Lei.

    - Cleanup of the io_schedule() handling in bsg from Peter Zijlstra.
    He claims it improves on unreadable code, which will cost him a
    beer.

    - Maintainer update or NDB, now handled by Markus Pargmann.

    - NVMe:
    - Optimization from me that avoids a kmalloc/kfree per IO for
    smaller (t handle REQ_FUA explicitly
    block: loop: introduce lo_discard() and lo_req_flush()
    block: loop: say goodby to bio
    block: loop: improve performance via blk-mq

    Linus Torvalds
     

09 Feb, 2015

1 commit


29 Jan, 2015

1 commit

  • The owner module reference of the ahci platform's scsi_host is
    initialized to libahci_platform's one, because these drivers use a
    scsi_host_template defined in libahci_platform. So these drivers can
    be unloaded even if the scsi device is being accessed.

    This fixes it by pushing the scsi_host_template from libahci_platform
    to all leaf drivers. The scsi_host_template is passed through a new
    argument of ahci_platform_init_host().

    Signed-off-by: Akinobu Mita
    Signed-off-by: Tejun Heo
    Cc: Hans de Goede
    Cc: Christoph Hellwig
    Cc: "James E.J. Bottomley"
    Cc: linux-ide@vger.kernel.org
    Cc: linux-scsi@vger.kernel.org

    Akinobu Mita
     

24 Jan, 2015

1 commit

  • libata uses its own tag management which is duplication and the
    implementation is poor. And if we switch to blk-mq, tag is build-in.
    It's time to switch to generic taging.

    The SAS driver has its own tag management, and looks we can't directly
    map the host controler tag to SATA tag. So I just bypassed the SAS case.

    I changed the code/variable name for the tag management of libata to
    make it self contained. Only sas will use it. Later if libsas implements
    its tag management, the tag management code in libata can be deleted
    easily.

    Cc: Jens Axboe
    Cc: Christoph Hellwig
    Signed-off-by: Shaohua Li
    Acked-by: Tejun Heo
    Signed-off-by: Jens Axboe

    Shaohua Li
     

19 Jan, 2015

1 commit

  • Ronny reports: https://bugzilla.kernel.org/show_bug.cgi?id=87101
    "Since commit 8a4aeec8d "libata/ahci: accommodate tag ordered
    controllers" the access to the harddisk on the first SATA-port is
    failing on its first access. The access to the harddisk on the
    second port is working normal.

    When reverting the above commit, access to both harddisks is working
    fine again."

    Maintain tag ordered submission as the default, but allow sata_sil24 to
    continue with the old behavior.

    Cc:
    Cc: Tejun Heo
    Reported-by: Ronny Hegewald
    Signed-off-by: Dan Williams
    Signed-off-by: Tejun Heo

    Dan Williams
     

08 Jan, 2015

1 commit

  • As defined, the DRAT (Deterministic Read After Trim) and RZAT (Return
    Zero After Trim) flags in the ATA Command Set are unreliable in the
    sense that they only define what happens if the device successfully
    executed the DSM TRIM command. TRIM is only advisory, however, and the
    device is free to silently ignore all or parts of the request.

    In practice this renders the DRAT and RZAT flags completely useless and
    because the results are unpredictable we decided to disable discard in
    MD for 3.18 to avoid the risk of data corruption.

    Hardware vendors in the real world obviously need better guarantees than
    what the standards bodies provide. Unfortuntely those guarantees are
    encoded in product requirements documents rather than somewhere we can
    key off of them programatically. So we are compelled to disabling
    discard_zeroes_data for all devices unless we explicitly have data to
    support whitelisting them.

    This patch whitelists SSDs from a few of the main vendors. None of the
    whitelists are based on written guarantees. They are purely based on
    empirical evidence collected from internal and external users that have
    tested or qualified these drives in RAID deployments.

    The whitelist is only meant as a starting point and is by no means
    comprehensive:

    - All intel SSD models except for 510
    - Micron M5?0/M600
    - Samsung SSDs
    - Seagate SSDs

    Signed-off-by: Martin K. Petersen
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Tejun Heo

    Martin K. Petersen
     

12 Dec, 2014

1 commit

  • Pull libata changes from Tejun Heo:
    "The only interesting piece is the support for shingled drives. The
    changes in libata layer are minimal. All it does is identifying the
    new class of device and report upwards accordingly"

    * 'for-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
    libata: Remove FIXME comment in atapi_request_sense()
    sata_rcar: Document deprecated "renesas,rcar-sata"
    sata_rcar: Add clocks to sata_rcar bindings
    ahci_sunxi: Make AHCI_HFLAG_NO_PMP flag configurable with a module option
    libata-scsi: Update SATL for ZAC drives
    libata: Implement ATA_DEV_ZAC
    libsas: use ata_dev_classify()

    Linus Torvalds
     

24 Nov, 2014

1 commit

  • Drop the now unused reason argument from the ->change_queue_depth method.
    Also add a return value to scsi_adjust_queue_depth, and rename it to
    scsi_change_queue_depth now that it can be used as the default
    ->change_queue_depth implementation.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Mike Christie
    Reviewed-by: Hannes Reinecke

    Christoph Hellwig
     

06 Nov, 2014

1 commit


23 Sep, 2014

1 commit


23 Jul, 2014

1 commit

  • 1871ee134b73 ("libata: support the ata host which implements a queue
    depth less than 32") directly used ata_port->scsi_host->can_queue from
    ata_qc_new() to determine the number of tags supported by the host;
    unfortunately, SAS controllers doing SATA don't initialize ->scsi_host
    leading to the following oops.

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000058
    IP: [] ata_qc_new_init+0x188/0x1b0
    PGD 0
    Oops: 0002 [#1] SMP
    Modules linked in: isci libsas scsi_transport_sas mgag200 drm_kms_helper ttm
    CPU: 1 PID: 518 Comm: udevd Not tainted 3.16.0-rc6+ #62
    Hardware name: Intel Corporation S2600CO/S2600CO, BIOS SE5C600.86B.02.02.0002.122320131210 12/23/2013
    task: ffff880c1a00b280 ti: ffff88061a000000 task.ti: ffff88061a000000
    RIP: 0010:[] [] ata_qc_new_init+0x188/0x1b0
    RSP: 0018:ffff88061a003ae8 EFLAGS: 00010012
    RAX: 0000000000000001 RBX: ffff88000241ca80 RCX: 00000000000000fa
    RDX: 0000000000000020 RSI: 0000000000000020 RDI: ffff8806194aa298
    RBP: ffff88061a003ae8 R08: ffff8806194a8000 R09: 0000000000000000
    R10: 0000000000000000 R11: ffff88000241ca80 R12: ffff88061ad58200
    R13: ffff8806194aa298 R14: ffffffff814e67a0 R15: ffff8806194a8000
    FS: 00007f3ad7fe3840(0000) GS:ffff880627620000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000058 CR3: 000000061a118000 CR4: 00000000001407e0
    Stack:
    ffff88061a003b20 ffffffff814e96e1 ffff88000241ca80 ffff88061ad58200
    ffff8800b6bf6000 ffff880c1c988000 ffff880619903850 ffff88061a003b68
    ffffffffa0056ce1 ffff88061a003b48 0000000013d6e6f8 ffff88000241ca80
    Call Trace:
    [] ata_sas_queuecmd+0xa1/0x430
    [] sas_queuecommand+0x191/0x220 [libsas]
    [] scsi_dispatch_cmd+0x10e/0x300
    [] scsi_request_fn+0x2f5/0x550
    [] __blk_run_queue+0x33/0x40
    [] queue_unplugged+0x2a/0x90
    [] blk_flush_plug_list+0x1b4/0x210
    [] blk_finish_plug+0x14/0x50
    [] __do_page_cache_readahead+0x198/0x1f0
    [] force_page_cache_readahead+0x31/0x50
    [] page_cache_sync_readahead+0x3e/0x50
    [] generic_file_read_iter+0x496/0x5a0
    [] blkdev_read_iter+0x37/0x40
    [] new_sync_read+0x7e/0xb0
    [] vfs_read+0x94/0x170
    [] SyS_read+0x46/0xb0
    [] ? SyS_lseek+0x91/0xb0
    [] system_call_fastpath+0x16/0x1b
    Code: 00 00 00 88 50 29 83 7f 08 01 19 d2 83 e2 f0 83 ea 50 88 50 34 c6 81 1d 02 00 00 40 c6 81 17 02 00 00 00 5d c3 66 0f 1f 44 00 00 14 25 58 00 00 00

    Fix it by introducing ata_host->n_tags which is initialized to
    ATA_MAX_QUEUE - 1 in ata_host_init() for SAS controllers and set to
    scsi_host_template->can_queue in ata_host_register() for !SAS ones.
    As SAS hosts are never registered, this will give them the same
    ATA_MAX_QUEUE - 1 as before. Note that we can't use
    scsi_host->can_queue directly for SAS hosts anyway as they can go
    higher than the libata maximum.

    Signed-off-by: Tejun Heo
    Reported-by: Mike Qiu
    Reported-by: Jesse Brandeburg
    Reported-by: Peter Hurley
    Reported-by: Peter Zijlstra
    Tested-by: Alexey Kardashevskiy
    Fixes: 1871ee134b73 ("libata: support the ata host which implements a queue depth less than 32")
    Cc: Kevin Hao
    Cc: Dan Williams
    Cc: stable@vger.kernel.org

    Tejun Heo