1. 10 6月, 2007 2 次提交
  2. 25 5月, 2007 1 次提交
  3. 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
  4. 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
  5. 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
  6. 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
  7. 04 4月, 2007 1 次提交
  8. 03 3月, 2007 1 次提交
  9. 21 2月, 2007 5 次提交
    • 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
    • T
      libata: fix ata_scsi_change_queue_depth() · c3c70c44
      Tejun Heo 提交于
      Fix ata_scsi_change_queue_depth() such that...
      
      * NCQ on/off is exactly determined using the same logic as the issue path.
      
      * queue depth is adjusted to 1 if NCQ is not enabled.
      
      * -EINVAL is returned if requested action is ignored due to limitations.
      
      This fixes the bug which allows queue depth to be increased on
      blacklisted NCQ hosts/devices.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      c3c70c44
    • T
      libata: fix ata_scmd_need_defer() · fcf1bf15
      Tejun Heo 提交于
      Fix ata_scmd_need_defer() such that...
      
      * whether NCQ is used or not is exactly determined using the same
        criteria as the issue path.
      
      * defer-check is performed in all cases.
      
      This fixes race condition where turning off NCQ on the fly causes
      non-NCQ commands sneak into NCQ phase.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      fcf1bf15
    • T
      libata: fix probe_ent alloc/free bugs · 4d05447e
      Tejun Heo 提交于
      ata_probe_ent_alloc() had a temporary hack such that devm_kzalloc()
      was used for allocation if devres had been previously initialized on
      the device; otherwise, plain kzalloc() was used.  This was to make the
      code useable from both the old and devres-aware libata drivers during
      transition.  This hack made ata_sas_port_alloc() unable to determine
      how the probe_ent is allocated, causing double free in some cases.
      
      Remove the now-unneeded hack and make ata_sas_port_alloc() use
      devm_kfree().
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: James Bottomley <James.Bottomley@SteelEye.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      4d05447e
    • M
      libata bugfix: HDIO_DRIVE_TASK · 2b067191
      Mark Lord 提交于
      I was trying to use HDIO_DRIVE_TASK for something today,
      and discovered that the libata implementation does not copy
      over the upper four LBA bits from args[6].
      
      This is serious, as any tools using this ioctl would have their
      commands applied to the wrong sectors on the drive, possibly resulting
      in disk corruption.
      
      Ideally, newer apps should use SG_IO/ATA_16 directly,
      avoiding this bug.  But with libata poised to displace drivers/ide,
      better compatibility here is a must.
      
      This patch fixes libata to use the upper four LBA bits passed
      in from the ioctl.
      
      The original drivers/ide implementation copies over all bits
      except for the master/slave select bit.  With this patch,
      libata will copy only the four high-order LBA bits,
      just in case there are assumptions elsewhere in libata (?).
      Signed-Off-By: NMark Lord <mlord@pobox.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      2b067191
  10. 10 2月, 2007 6 次提交
  11. 30 1月, 2007 2 次提交
  12. 24 1月, 2007 1 次提交
  13. 21 12月, 2006 3 次提交
    • T
      [PATCH] libata: take scmd->cmd_len into account when translating SCSI commands · 2e5704f6
      Tejun Heo 提交于
      libata depended on SCSI command to have the correct length when
      tranlating it into an ATA command.  This generally worked for commands
      issued by SCSI HLD but user could issue arbitrary broken command using
      sg interface.
      
      Also, when building ATAPI command, full command size was always
      copied.  Because some ATAPI devices needs bytes after CDB cleared, if
      upper layer doesn't clear bytes after CDB, such devices will
      malfunction.  This necessiated recent clear-garbage-after-CDB fix in
      sg interfaces.  However, scsi_execute() isn't fixed yet and HL-DT-ST
      DVD-RAM GSA-H30N malfunctions on initialization commands issued from
      SCSI.
      
      This patch makes xlat functions always consider SCSI cmd_len.  Each
      translation function checks for proper cmd_len and ATAPI translaation
      clears bytes after CDB.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: Douglas Gilbert <dougg@torque.net>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      2e5704f6
    • T
      [PATCH] libata: kill @cdb argument from xlat methods · ad706991
      Tejun Heo 提交于
      xlat function will be updated to consider qc->scsicmd->cmd_len and
      many xlat functions deference qc->scsicmd already.  It doesn't make
      sense to pass qc->scsicmd->cmnd as @cdb separately.  Kill the
      argument.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      ad706991
    • T
      [PATCH] libata: clean up variable name usage in xlat related functions · 542b1444
      Tejun Heo 提交于
      Variable names in xlat functions are quite confusing now.  'scsicmd'
      is used for CDB while qc->scsicmd points to struct scsi_cmnd while
      'cmd' is used for struct scsi_cmnd.
      
      This patch cleans up variable names in xlat functions such that 'scmd'
      is used for struct scsi_cmnd and 'cdb' for CDB.  Also, 'scmd' local
      variable is added if qc->scsicmd is used multiple times.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      542b1444
  14. 16 12月, 2006 1 次提交
    • J
      [libata] use kmap_atomic(KM_IRQ0) in SCSI simulator · da02d2a1
      Jeff Garzik 提交于
      We are inside spin_lock_irqsave().  quoth akpm's debug facility:
      
       [  231.948000] SCSI device sda: 195371568 512-byte hdwr sectors (100030 MB)
       [  232.232000] ata1.00: configured for UDMA/33
       [  232.404000] WARNING (1) at arch/i386/mm/highmem.c:47 kmap_atomic()
       [  232.404000]  [<c01162e6>] kmap_atomic+0xa9/0x1ab
       [  232.404000]  [<c0242c81>] ata_scsi_rbuf_get+0x1c/0x30
       [  232.404000]  [<c0242caf>] ata_scsi_rbuf_fill+0x1a/0x87
       [  232.404000]  [<c0243ab2>] ata_scsiop_mode_sense+0x0/0x309
       [  232.404000]  [<c01729d5>] end_bio_bh_io_sync+0x0/0x37
       [  232.404000]  [<c02311c6>] scsi_done+0x0/0x16
       [  232.404000]  [<c02311c6>] scsi_done+0x0/0x16
       [  232.404000]  [<c0242dcc>] ata_scsi_simulate+0xb0/0x13f
      [...]
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      da02d2a1
  15. 03 12月, 2006 3 次提交
  16. 02 12月, 2006 6 次提交