1. 16 10月, 2007 2 次提交
    • F
      remove blk_queue_max_phys_segments in libata · 8889e3c1
      FUJITA Tomonori 提交于
      LIBATA_MAX_PRD is the maximum number of DMA scatter/gather elements
      permitted by the HBA's DMA engine. It's properly set to
      q->max_hw_segments via the sg_tablesize parameter.
      
      libata shouldn't call blk_queue_max_phys_segments. Now LIBATA_MAX_PRD
      is equal to SCSI_MAX_PHYS_SEGMENTS by default (both is 128), so
      everything is fine. But if they are changed, some code (like the scsi
      mid layer, sg chaining, etc) might not work properly.
      
      (Addition from Jens) The basic issue is that the physical segment
      setting is purely a driver issue. And since SCSI is managing the sglist,
      libata has no business changing the setting. All libata should care
      about is the hw segment setting.
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      8889e3c1
    • T
      libata: fix revalidation issuing after configuration commands · f58db802
      Tejun Heo 提交于
      After commands which can change device configuration, EH is scheduled
      to revalidate and reconfigure the device.  Host link was incorrectly
      used unconditionally when scheduling EH action.  This resulted in
      bogus revalidation request and mismatched configuration between device
      and driver.  Fix it.
      
      This bug was reported by Igor Durdanovic.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Igor Durdanovic <idurdanovic@comcast.net>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f58db802
  2. 13 10月, 2007 17 次提交
  3. 24 7月, 2007 1 次提交
  4. 20 7月, 2007 1 次提交
    • T
      libata: improve SCSI scan failure handling · 1ae46317
      Tejun Heo 提交于
      SCSI scan may fail due to memory allocation failure even if EH is not
      in progress.  Due to use of GFP_ATOMIC in SCSI scan path, allocation
      failure isn't too rare especially while probing multiple devices at
      once which is the case when a bunch of devices are connected to PMP.
      
      This patch moves SCSI scan failure detetion logic from
      ata_scsi_hotplug() to ata_scsi_scan_host() and implement synchronous
      scan behavior.  The synchronous path sleeps briefly and repeats SCSI
      scan if some devices aren't attached properly.  It contains robust
      retry loop to minimize the chance of device misdetection during boot
      and falls back to async retry if everything fails.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      1ae46317
  5. 10 7月, 2007 1 次提交
  6. 27 6月, 2007 1 次提交
  7. 10 6月, 2007 5 次提交
  8. 25 5月, 2007 1 次提交
  9. 18 5月, 2007 1 次提交
    • T
      libata: remove libata.spindown_compat · d9aca22c
      Tejun Heo 提交于
      With STANDBYDOWN tracking added, libata.spindown_compat isn't
      necessary anymore.  If userspace shutdown(8) issues STANDBYNOW, libata
      warns.  If userspace shutdown(8) doesn't issue STANDBYNOW, libata does
      the right thing.  Userspace can tell whether kernel supports spindown
      by testing whether sysfs node manage_start_stop exists as before.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      d9aca22c
  10. 16 5月, 2007 2 次提交
    • T
      libata: track spindown status and skip spindown_compat if possible · 13b8d09f
      Tejun Heo 提交于
      Our assumption that most distros issue STANDBYNOW seems wrong.  The
      upstream sysvinit and thus many distros including gentoo and opensuse
      don't take any action for libata disks on spindown.  We can skip
      compat handling for these distros so that they don't need to update
      anything to take advantage of kernel-side shutdown.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      13b8d09f
    • T
      libata: fix shutdown warning message printing · da071b42
      Tejun Heo 提交于
      Unlocking ap->lock and ssleeping don't work because SCSI commands can
      be issued from completion path without context.  Reimplement delayed
      completion by allowing translation functions to override
      qc->scsidone(), storing the original completion function to
      scmd->scsi_done() and overriding qc->scsidone() with a function which
      schedules delayed invocation of scmd->scsi_done().
      
      This isn't pretty at all but all the ugly parts are thankfully
      contained in the stop translation path where the compat feature is
      implemented.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      da071b42
  11. 12 5月, 2007 2 次提交
    • T
      libata: implement libata.spindown_compat · 920a4b10
      Tejun Heo 提交于
      Now that libata uses sd->manage_start_stop, libata spins down disk on
      shutdown.  In an attempt to compensate libata's previous shortcoming,
      some distros sync and spin down disks attached via libata in their
      shutdown(8).  Some disks spin back up just to spin down again on
      STANDBYNOW1 if the command is issued when the disk is spun down, so
      this double spinning down causes problem.
      
      This patch implements module parameter libata.spindown_compat which,
      when set to one (default value), prevents libata from spinning down
      disks on shutdown thus avoiding double spinning down.  Note that
      libata spins down disks for suspend to mem and disk, so with
      libata.spindown_compat set to one, disks should be properly spun down
      in all cases without modifying shutdown(8).
      
      shutdown(8) should be fixed eventually.  Some drive do spin up on
      SYNCHRONZE_CACHE even when their cache is clean.  Those disks
      currently spin up briefly when sd tries to shutdown the device and
      then the machine powers off immediately, which can't be good for the
      head.  We can't skip SYNCHRONIZE_CACHE during shudown as it can be
      dangerous data integrity-wise.
      
      So, this spindown_compat parameter is already scheduled for removal by
      the end of the next year and here's what shutdown(8) should do.
      
        * Check whether /sys/modules/libata/parameters/spindown_compat
          exists.  If it does, write 0 to it.
      
        * For each libata harddisk {
      	* Check whether /sys/class/scsi_disk/h:c:i:l/manage_start_stop
      	  exists.  Iff it doesn't, synchronize cache and spin the disk
      	  down as before.
        }
      
      The above procedure will make shutdown(8) work properly with kernels
      before this change, ones with this workaround and later ones without
      it.
      
      To accelerate shutdown(8) updates, if the compat mode is in use, this
      patch prints BIG FAT warning for five seconds during shutdown (the
      optimal interval to annoy the user just the right amount discovered by
      hours of tireless usability testing).
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      920a4b10
    • T
      libata: reimplement suspend/resume support using sdev->manage_start_stop · 9666f400
      Tejun Heo 提交于
      Reimplement suspend/resume support using sdev->manage_start_stop.
      
      * Device suspend/resume is now SCSI layer's responsibility and the
        code is simplified a lot.
      
      * DPM is dropped.  This also simplifies code a lot.  Suspend/resume
        status is port-wide now.
      
      * ata_scsi_device_suspend/resume() and ata_dev_ready() removed.
      
      * Resume now has to wait for disk to spin up before proceeding.  I
        couldn't find easy way out as libata is in EH waiting for the
        disk to be ready and sd is waiting for EH to complete to issue
        START_STOP.
      
      * sdev->manage_start_stop is set to 1 in ata_scsi_slave_config().
        This fixes spindown on shutdown and suspend-to-disk.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9666f400
  12. 29 4月, 2007 3 次提交
    • T
      libata: separate out ata_host_alloc() and ata_host_register() · f3187195
      Tejun Heo 提交于
      Reorganize ata_host_alloc() and its subroutines into the following
      three functions.
      
      * ata_host_alloc() : allocates host and its ports.  shost is not
        registered automatically.
      
      * ata_scsi_add_hosts() : allocates and adds shosts associated with an
        ATA host.  Used by ata_host_register().
      
      * ata_host_register() : takes a fully initialized ata_host structure
        and registers it to libata layer and probes it.
      
      Only ata_host_alloc() and ata_host_register() are exported.
      ata_device_add() is rewritten using the above functions.  This patch
      does not introduce any observable behavior change.  Things worth
      mentioning.
      
      * print_id is assigned at registration time and LLDs are allowed to
        overallocate ports and reduce host->n_ports during initialization.
        ata_host_register() will throw away unused ports automatically.
      
      * All SCSI host initialization stuff now resides in
        ata_scsi_add_hosts() in libata-scsi.c, where it should be.
      
      * ipr is now the only user of ata_host_init().  Either kill it by
        converting ipr to use ata_host_alloc() and friends or rename and
        move it to libata-scsi.c
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f3187195
    • M
      libata: add support for READ/WRITE LONG · 5a5dbd18
      Mark Lord 提交于
      The READ/WRITE LONG commands are theoretically obsolete,
      but the majority of drives in existance still implement them.
      
      The WRITE_LONG and WRITE_LONG_ONCE commands are of particular
      interest for fault injection testing -- eg. creating "media errors"
      at specific locations on a disk.
      
      The fussy bit is that these commands require a non-standard
      sector size, usually 520 bytes instead of 512.
      
      This patch adds support to libata for READ/WRITE LONG commands
      issued via SG_IO/ATA_16.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      5a5dbd18
    • M
      RESEND: libata: check cdb len per dev instead of per host · f0ef88ed
      Mark Lord 提交于
      Resending, with s/printk/DPRINTK/ as pointed out by Alan.
      
      Fix libata to perform CDB len validation per device
      rather than per host.  This way, validation still works
      when we have a mix of 12-byte and 16-byte devices on
      a common host interface.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      f0ef88ed
  13. 04 4月, 2007 1 次提交
  14. 03 3月, 2007 1 次提交
  15. 21 2月, 2007 1 次提交
    • T
      libata: s/ap->id/ap->print_id/g · 44877b4e
      Tejun Heo 提交于
      ata_port has two different id fields - id and port_no.  id is
      system-wide 1-based unique id for the port while port_no is 0-based
      host-wide port number.  The former is primarily used to identify the
      ATA port to the user in printk messages while the latter is used in
      various places in libata core and LLDs to index the port inside the
      host.
      
      The two fields feel quite similar and sometimes ap->id is used in
      place of ap->port_no, which is very difficult to spot.  This patch
      renames ap->id to ap->print_id to reduce the possibility of such bugs.
      
      Some printk messages are adjusted such that id string (ata%u[.%u])
      isn't printed twice and/or to use ata_*_printk() instead of hardcoded
      id format.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      44877b4e