1. 11 5月, 2009 1 次提交
    • T
      block: add rq->resid_len · c3a4d78c
      Tejun Heo 提交于
      rq->data_len served two purposes - the length of data buffer on issue
      and the residual count on completion.  This duality creates some
      headaches.
      
      First of all, block layer and low level drivers can't really determine
      what rq->data_len contains while a request is executing.  It could be
      the total request length or it coulde be anything else one of the
      lower layers is using to keep track of residual count.  This
      complicates things because blk_rq_bytes() and thus
      [__]blk_end_request_all() relies on rq->data_len for PC commands.
      Drivers which want to report residual count should first cache the
      total request length, update rq->data_len and then complete the
      request with the cached data length.
      
      Secondly, it makes requests default to reporting full residual count,
      ie. reporting that no data transfer occurred.  The residual count is
      an exception not the norm; however, the driver should clear
      rq->data_len to zero to signify the normal cases while leaving it
      alone means no data transfer occurred at all.  This reverse default
      behavior complicates code unnecessarily and renders block PC on some
      drivers (ide-tape/floppy) unuseable.
      
      This patch adds rq->resid_len which is used only for residual count.
      
      While at it, remove now unnecessasry blk_rq_bytes() caching in
      ide_pc_intr() as rq->data_len is not changed anymore.
      
      Boaz	: spotted missing conversion in osd
      Sergei	: spotted too early conversion to blk_rq_bytes() in ide-tape
      
      [ Impact: cleanup residual count handling, report 0 resid by default ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      Cc: Borislav Petkov <petkovbb@googlemail.com>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Cc: Mike Miller <mike.miller@hp.com>
      Cc: Eric Moore <Eric.Moore@lsi.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Doug Gilbert <dgilbert@interlog.com>
      Cc: Mike Miller <mike.miller@hp.com>
      Cc: Eric Moore <Eric.Moore@lsi.com>
      Cc: Darrick J. Wong <djwong@us.ibm.com>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Cc: Boaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      c3a4d78c
  2. 16 1月, 2009 1 次提交
  3. 03 1月, 2009 2 次提交
  4. 09 10月, 2008 1 次提交
  5. 29 9月, 2008 1 次提交
    • T
      libata: make SCR access ops per-link · 82ef04fb
      Tejun Heo 提交于
      Logically, SCR access ops should take @link; however, there was no
      compelling reason to convert all SCR access ops when adding @link
      abstraction as there's one-to-one mapping between a port and a non-PMP
      link.  However, that assumption won't hold anymore with the scheduled
      addition of slave link.
      
      Make SCR access ops per-link.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      82ef04fb
  6. 27 7月, 2008 1 次提交
  7. 18 4月, 2008 6 次提交
    • T
      libata: kill ata_noop_dev_select() · c9f75b04
      Tejun Heo 提交于
      Now that SFF assumptions are separated out from non-SFF reset
      sequence, port_ops->sff_dev_select() is no longer necessary for
      non-SFF controllers.  Kill ata_noop_dev_select() and ->sff_dev_select
      initialization from base and other non-SFF port_ops.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      c9f75b04
    • T
      libata: remove check_status from non-SFF drivers · 520d06f9
      Tejun Heo 提交于
      Now that all SFF stuff is separated out of core layer, core layer
      doesn't call ops->[alt_]check_status().  In fact, no one calls them
      for non-SFF drivers anymore.  Kill them.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      520d06f9
    • T
      libata: replace tf_read with qc_fill_rtf for non-SFF drivers · 4c9bf4e7
      Tejun Heo 提交于
      Now that all SFF stuff is separated out of core layer, core layer
      doesn't call ops->tf_read directly.  It gets called only via
      ops->qc_fill_rtf() for non-SFF drivers.  This patch directly
      implements private ops->qc_fill_rtf() for non-SFF controllers and kill
      ops->tf_read().
      
      This is much cleaner for non-SFF controllers as some of them have to
      cache SFF register values in private data structure and report the
      cached values via ops->tf_read().  Also, ops->tf_read() gets nasty for
      controllers which don't have clear notion of TF registers when
      operation is not in progress.
      
      As this change makes default ops->qc_fill_rtf unnecessary, move
      ata_sff_qc_fill_rtf() form ata_base_port_ops to ata_sff_port_ops where
      it belongs.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      4c9bf4e7
    • T
      libata: add qc_fill_rtf port operation · 22183bf5
      Tejun Heo 提交于
      On command completion, ata_qc_complete() directly called ops->tf_read
      to fill qc->result_tf.  This patch adds ops->qc_fill_rtf to replace
      hardcoded ops->tf_read usage.
      
      ata_sff_qc_fill_rtf() which uses ops->tf_read to fill result_tf is
      implemented and set in ata_base_port_ops and other ops tables which
      don't inherit from ata_base_port_ops, so this patch doesn't introduce
      any behavior change.
      
      ops->qc_fill_rtf() is similar to ops->sff_tf_read() but can only be
      called when a command finishes.  As some non-SFF controllers don't
      have TF registers defined unless they're associated with in-flight
      commands, this limited operation makes life easier for those drivers
      and help lifting SFF assumptions from libata core layer.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      22183bf5
    • T
      libata: rename SFF port ops · 5682ed33
      Tejun Heo 提交于
      Add sff_ prefix to SFF specific port ops.
      
      This rename is in preparation of separating SFF support out of libata
      core layer.  This patch strictly renames ops and doesn't introduce any
      behavior difference.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      5682ed33
    • A
      17b7a8de
  8. 08 4月, 2008 1 次提交
  9. 28 3月, 2008 1 次提交
  10. 24 2月, 2008 3 次提交
  11. 23 2月, 2008 2 次提交
    • J
      [SCSI] libsas: correctly flush the LU queue on error recovery · 63e4563b
      James Bottomley 提交于
      The current sas_scsi_clear_queue_lu() is wrongly checking for commands
      which match the pointer to the one passed in.  It should be checking for
      commands which are on the same logical unit as the one passed in.  Fix
      this by checking target pointer and LUN for equality.
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      63e4563b
    • J
      [SCSI] libsas: fix error handling · a8e14fec
      James Bottomley 提交于
      The libsas error handler has two fairly fatal bugs
      
      1. scsi_sas_task_done calls scsi_eh_finish_cmd() too early.  This
         happens if the task completes after it has been aborted but before
         the error handler starts up.  Because scsi_eh_finish_cmd()
         decrements host_failed and adds the task to the done list, the
         error handler start check (host_failed == host_busy) never passes
         and the eh never starts.
      
      2. The multiple task completion paths sas_scsi_clear_queue_... all
         simply delete the task from the error queue.  This causes it to
         disappear into the ether, since a command must be placed on the
         done queue to be finished off by the error handler.  This behaviour
         causes the HBA to hang on pending commands.
      
      Fix 1. by moving the SAS_TASK_STATE_ABORTED check to an exit clause at
      the top of the routine and calling ->scsi_done() unconditionally (it
      is a nop if the timer has fired).  This keeps the task in the error
      handling queue until the eh starts.
      
      Fix 2. by making sure every task goes through task complete followed
      by scsi_eh_finish_cmd().
      
      Tested this by firing resets across a disk running a hammer test (now
      it actually survives without hanging the system)
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      a8e14fec
  12. 19 2月, 2008 1 次提交
    • J
      libata: eliminate the home grown dma padding in favour of · dde20207
      James Bottomley 提交于
      that provided by the block layer
      
      ATA requires that all DMA transfers begin and end on word boundaries.
      Because of this, a large amount of machinery grew up in ide to adjust
      scatterlists on this basis.  However, as of 2.5, the block layer has a
      dma_alignment variable which ensures both the beginning and length of a
      DMA transfer are aligned on the dma_alignment boundary.  Although the
      block layer does adjust the beginning of the transfer to ensure this
      happens, it doesn't actually adjust the length, it merely makes sure
      that space is allocated for transfers beyond the declared length.  The
      upshot of this is that scatterlists may be padded to any size between
      the actual length and the length adjusted to the dma_alignment safely
      knowing that memory is allocated in this region.
      
      Right at the moment, SCSI takes the default dma_aligment which is on a
      512 byte boundary.  Note that this aligment only applies to transfers
      coming in from user space.  However, since all kernel allocations are
      automatically aligned on a minimum of 32 byte boundaries, it is safe to
      adjust them in this manner as well.
      
      tj: * Adjusting sg after padding is done in block layer.  Make libata
            set queue alignment correctly for ATAPI devices and drop broken
            sg mangling from ata_sg_setup().
          * Use request->raw_data_len for ATAPI transfer chunk size.
          * Killed qc->raw_nbytes.
          * Separated out killing qc->n_iter.
      Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      dde20207
  13. 26 1月, 2008 1 次提交
  14. 25 1月, 2008 1 次提交
  15. 24 1月, 2008 2 次提交
  16. 23 1月, 2008 3 次提交
    • T
      libata: convert to chained sg · ff2aeb1e
      Tejun Heo 提交于
      libata used private sg iterator to handle padding sg.  Now that sg can
      be chained, padding can be handled using standard sg ops.  Convert to
      chained sg.
      
      * s/qc->__sg/qc->sg/
      
      * s/qc->pad_sgent/qc->extra_sg[]/.  Because chaining consumes one sg
        entry.  There need to be two extra sg entries.  The renaming is also
        for future addition of other extra sg entries.
      
      * Padding setup is moved into ata_sg_setup_extra() which is organized
        in a way that future addition of other extra sg entries is easy.
      
      * qc->orig_n_elem is unused and removed.
      
      * qc->n_elem now contains the number of sg entries that LLDs should
        map.  qc->mapped_n_elem is added to carry the original number of
        mapped sgs for unmapping.
      
      * The last sg of the original sg list is used to chain to extra sg
        list.  The original last sg is pointed to by qc->last_sg and the
        content is stored in qc->saved_last_sg.  It's restored during
        ata_sg_clean().
      
      * All sg walking code has been updated.  Unnecessary assertions and
        checks for conditions the core layer already guarantees are removed.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      ff2aeb1e
    • T
      libata: rename ATA_PROT_ATAPI_* to ATAPI_PROT_* · 0dc36888
      Tejun Heo 提交于
      ATA_PROT_ATAPI_* are ugly and naming schemes between ATA_PROT_* and
      ATA_PROT_ATAPI_* are inconsistent causing confusion.  Rename them to
      ATAPI_PROT_* and make them consistent with ATA counterpart.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      0dc36888
    • T
      libata: implement protocol tests · 405e66b3
      Tejun Heo 提交于
      Implement protocol tests - ata_is_atapi(), ata_is_nodata(),
      ata_is_pio(), ata_is_dma(), ata_is_ncq() and ata_is_data() and use
      them to replace is_atapi_taskfile() and hard coded protocol tests.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      405e66b3
  17. 12 1月, 2008 5 次提交
  18. 20 10月, 2007 1 次提交
  19. 13 10月, 2007 2 次提交
    • J
      [libata] Remove ->port_disable() hook · ac8869d5
      Jeff Garzik 提交于
      It was always set to ata_port_disable().  Removed the hook, and replaced
      the very few ap->ops->port_disable() callsites with direct calls to
      ata_port_disable().
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      ac8869d5
    • T
      libata-link: introduce ata_link · 9af5c9c9
      Tejun Heo 提交于
      Introduce ata_link.  It abstracts PHY and sits between ata_port and
      ata_device.  This new level of abstraction is necessary to support
      SATA Port Multiplier, which basically adds a bunch of links (PHYs) to
      a ATA host port.  Fields related to command execution, spd_limit and
      EH are per-link and thus moved to ata_link.
      
      This patch only defines the host link.  Multiple link handling will be
      added later.  Also, a lot of ap->link derefences are added but many of
      them will be removed as each part is converted to deal directly with
      ata_link instead of ata_port.
      
      This patch introduces no behavior change.
      Signed-off-by: NTejun Heo <htejun@gmail.com>
      Cc: James Bottomley <James.Bottomley@SteelEye.com>
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      9af5c9c9
  20. 31 7月, 2007 1 次提交
  21. 28 7月, 2007 1 次提交
  22. 26 7月, 2007 1 次提交
  23. 25 7月, 2007 1 次提交