1. 29 4月, 2007 2 次提交
    • 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
  2. 04 4月, 2007 1 次提交
  3. 03 3月, 2007 1 次提交
  4. 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
  5. 10 2月, 2007 6 次提交
  6. 30 1月, 2007 2 次提交
  7. 24 1月, 2007 1 次提交
  8. 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
  9. 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
  10. 03 12月, 2006 3 次提交
  11. 02 12月, 2006 6 次提交
  12. 28 11月, 2006 2 次提交
  13. 22 11月, 2006 1 次提交
    • D
      WorkStruct: Pass the work_struct pointer instead of context data · 65f27f38
      David Howells 提交于
      Pass the work_struct pointer to the work function rather than context data.
      The work function can use container_of() to work out the data.
      
      For the cases where the container of the work_struct may go away the moment the
      pending bit is cleared, it is made possible to defer the release of the
      structure by deferring the clearing of the pending bit.
      
      To make this work, an extra flag is introduced into the management side of the
      work_struct.  This governs auto-release of the structure upon execution.
      
      Ordinarily, the work queue executor would release the work_struct for further
      scheduling or deallocation by clearing the pending bit prior to jumping to the
      work function.  This means that, unless the driver makes some guarantee itself
      that the work_struct won't go away, the work function may not access anything
      else in the work_struct or its container lest they be deallocated..  This is a
      problem if the auxiliary data is taken away (as done by the last patch).
      
      However, if the pending bit is *not* cleared before jumping to the work
      function, then the work function *may* access the work_struct and its container
      with no problems.  But then the work function must itself release the
      work_struct by calling work_release().
      
      In most cases, automatic release is fine, so this is the default.  Special
      initiators exist for the non-auto-release case (ending in _NAR).
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      65f27f38
  14. 14 11月, 2006 1 次提交
    • D
      libata: fix double-completion on error · 253b92ec
      Darrick J. Wong 提交于
      A curious thing happens, however, when ata_qc_new_init fails to get
      an ata_queued_cmd:
      
      First, ata_qc_new_init handles the failure like this:
          cmd->result = (DID_OK << 16) | (QUEUE_FULL << 1);
          done(cmd);
      
      Then, we return to ata_scsi_translate and do this:
          err_mem:
              cmd->result = (DID_ERROR << 16);
              done(cmd);
      
      It appears to me that first we set a status code indicating that we're
      ok but the device queue is full and finish the command,  but then
      we blow away that status code and replace it with an error flag and
      finish the command a second time!  That does not seem to be desirable
      behavior since we merely want the I/O to wait until a command slot
      frees up, not send errors up the block layer.
      
      In the err_mem case, we should simply exit out of ata_scsi_translate
      instead.
      Signed-off-by: NDarrick J. Wong <djwong@us.ibm.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      253b92ec
  15. 11 10月, 2006 1 次提交
  16. 30 9月, 2006 1 次提交
  17. 29 9月, 2006 1 次提交
  18. 24 8月, 2006 1 次提交
    • J
      libata: Grand renaming. · cca3974e
      Jeff Garzik 提交于
      The biggest change is that ata_host_set is renamed to ata_host.
      
      * ata_host_set			=> ata_host
      * ata_probe_ent->host_flags	=> ata_probe_ent->port_flags
      * ata_probe_ent->host_set_flags	=> ata_probe_ent->_host_flags
      * ata_host_stats		=> ata_port_stats
      * ata_port->host		=> ata_port->scsi_host
      * ata_port->host_set		=> ata_port->host
      * ata_port_info->host_flags	=> ata_port_info->flags
      * ata_(.*)host_set(.*)\(\)	=> ata_\1host\2()
      
      The leading underscore in ata_probe_ent->_host_flags is to avoid
      reusing ->host_flags for different purpose.  Currently, the only user
      of the field is libata-bmdma.c and probe_ent itself is scheduled to be
      removed.
      
      ata_port->host is reused for different purpose but this field is used
      inside libata core proper and of different type.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      cca3974e
  19. 10 8月, 2006 1 次提交