1. 28 Jan, 2008 3 commits
    • Kiyoshi Ueda's avatar
      blk_end_request: changing block layer core (take 4) · 9e6e39f2
      Kiyoshi Ueda authored
      This patch converts core parts of block layer to use blk_end_request
      interfaces.  Related 'uptodate' arguments are converted to 'error'.
      
      'dequeue' argument was originally introduced for end_dequeued_request(),
      where no attempt should be made to dequeue the request as it's already
      dequeued.
      However, it's not necessary as it can be checked with
      list_empty(&rq->queuelist).
      (Dequeued request has empty list and queued request doesn't.)
      And it has been done in blk_end_request interfaces.
      
      As a result of this patch, end_queued_request() and
      end_dequeued_request() become identical.  A future patch will merge
      and rename them and change users of those functions.
      Signed-off-by: default avatarKiyoshi Ueda <k-ueda@ct.jp.nec.com>
      Signed-off-by: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      9e6e39f2
    • Kiyoshi Ueda's avatar
      blk_end_request: add/export functions to get request size (take 4) · 3b11313a
      Kiyoshi Ueda authored
      This patch adds/exports functions to get the size of request in bytes.
      They are useful because blk_end_request interfaces take bytes
      as a completed I/O size instead of sectors.
      Signed-off-by: default avatarKiyoshi Ueda <k-ueda@ct.jp.nec.com>
      Signed-off-by: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      3b11313a
    • Kiyoshi Ueda's avatar
      blk_end_request: add new request completion interface (take 4) · 336cdb40
      Kiyoshi Ueda authored
      This patch adds 2 new interfaces for request completion:
        o blk_end_request()   : called without queue lock
        o __blk_end_request() : called with queue lock held
      
      blk_end_request takes 'error' as an argument instead of 'uptodate',
      which current end_that_request_* take.
      The meanings of values are below and the value is used when bio is
      completed.
          0 : success
        < 0 : error
      
      Some device drivers call some generic functions below between
      end_that_request_{first/chunk} and end_that_request_last().
        o add_disk_randomness()
        o blk_queue_end_tag()
        o blkdev_dequeue_request()
      These are called in the blk_end_request interfaces as a part of
      generic request completion.
      So all device drivers become to call above functions.
      To decide whether to call blkdev_dequeue_request(), blk_end_request
      uses list_empty(&rq->queuelist) (blk_queued_rq() macro is added for it).
      So drivers must re-initialize it using list_init() or so before calling
      blk_end_request if drivers use it for its specific purpose.
      (Currently, there is no driver which completes request without
       re-initializing the queuelist after used it.  So rq->queuelist
       can be used for the purpose above.)
      
      "Normal" drivers can be converted to use blk_end_request()
      in a standard way shown below.
      
       a) end_that_request_{chunk/first}
          spin_lock_irqsave()
          (add_disk_randomness(), blk_queue_end_tag(), blkdev_dequeue_request())
          end_that_request_last()
          spin_unlock_irqrestore()
          => blk_end_request()
      
       b) spin_lock_irqsave()
          end_that_request_{chunk/first}
          (add_disk_randomness(), blk_queue_end_tag(), blkdev_dequeue_request())
          end_that_request_last()
          spin_unlock_irqrestore()
          => spin_lock_irqsave()
             __blk_end_request()
             spin_unlock_irqsave()
      
       c) spin_lock_irqsave()
          (add_disk_randomness(), blk_queue_end_tag(), blkdev_dequeue_request())
          end_that_request_last()
          spin_unlock_irqrestore()
          => blk_end_request()   or   spin_lock_irqsave()
                                      __blk_end_request()
                                      spin_unlock_irqrestore()
      Signed-off-by: default avatarKiyoshi Ueda <k-ueda@ct.jp.nec.com>
      Signed-off-by: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      336cdb40
  2. 27 Jan, 2008 37 commits