1. 10 3月, 2011 1 次提交
  2. 05 10月, 2010 1 次提交
    • A
      block: autoconvert trivial BKL users to private mutex · 2a48fc0a
      Arnd Bergmann 提交于
      The block device drivers have all gained new lock_kernel
      calls from a recent pushdown, and some of the drivers
      were already using the BKL before.
      
      This turns the BKL into a set of per-driver mutexes.
      Still need to check whether this is safe to do.
      
      file=$1
      name=$2
      if grep -q lock_kernel ${file} ; then
          if grep -q 'include.*linux.mutex.h' ${file} ; then
                  sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
          else
                  sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
          fi
          sed -i ${file} \
              -e "/^#include.*linux.mutex.h/,$ {
                      1,/^\(static\|int\|long\)/ {
                           /^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);
      
      } }"  \
          -e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
          -e '/[      ]*cycle_kernel_lock();/d'
      else
          sed -i -e '/include.*\<smp_lock.h\>/d' ${file}  \
                      -e '/cycle_kernel_lock()/d'
      fi
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      2a48fc0a
  3. 09 8月, 2010 1 次提交
  4. 08 8月, 2010 4 次提交
  5. 22 9月, 2009 1 次提交
  6. 02 9月, 2009 1 次提交
  7. 08 8月, 2009 1 次提交
  8. 27 6月, 2009 1 次提交
  9. 24 6月, 2009 2 次提交
  10. 20 6月, 2009 1 次提交
  11. 16 6月, 2009 1 次提交
  12. 23 5月, 2009 1 次提交
  13. 19 5月, 2009 1 次提交
    • T
      block: set rq->resid_len to blk_rq_bytes() on issue · 5f49f631
      Tejun Heo 提交于
      In commit c3a4d78c, while introducing
      rq->resid_len, the default value of residue count was changed from
      full count to zero.  The conversion was done under the assumption that
      when a request fails residue count wasn't defined.  However, Boaz and
      James pointed out that this wasn't true and the residue count should
      be preserved for failed requests too.
      
      This patchset restores the original behavior by setting rq->resid_len
      to blk_rq_bytes(rq) on request start and restoring explicit clearing
      in affected drivers.  While at it, take advantage of the fact that
      rq->resid_len is set to full count where applicable.
      
      * ide-cd: rq->resid_len cleared on pc success
      
      * mptsas: req->resid_len cleared on success
      
      * sas_expander: rsp/req->resid_len cleared on success
      
      * mpt2sas_transport: req->resid_len cleared on success
      
      * ide-cd, ide-tape, mptsas, sas_host_smp, mpt2sas_transport, ub: take
        advantage of initial full count to simplify code
      
      Boaz Harrosh spotted bug in resid_len initialization.  Fixed as
      suggested.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NBorislav Petkov <petkovbb@googlemail.com>
      Cc: Boaz Harrosh <bharrosh@panasas.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Cc: Eric Moore <Eric.Moore@lsi.com>
      Cc: Darrick J. Wong <djwong@us.ibm.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      5f49f631
  14. 15 5月, 2009 2 次提交
  15. 11 5月, 2009 5 次提交
    • T
      ide: dequeue in-flight request · 8f6205cd
      Tejun Heo 提交于
      ide generally has single request in flight and tracks it using
      hwif->rq and all state handlers follow the following convention.
      
      * ide_started is returned if the request is in flight.
      
      * ide_stopped is returned if the queue needs to be restarted.  The
        request might or might not have been processed fully or partially.
      
      * hwif->rq is set to NULL, when an issued request completes.
      
      So, dequeueing model can be implemented by dequeueing after fetch,
      requeueing if hwif->rq isn't NULL on ide_stopped return and doing
      about the same thing on completion / port unlock paths.  These changes
      can be made in ide-io proper.
      
      In addition to the above main changes, the following updates are
      necessary.
      
      * ide-cd shouldn't dequeue a request when issuing REQUEST SENSE for it
        as the request is already dequeued.
      
      * ide-atapi uses request queue as stack when issuing REQUEST SENSE to
        put the REQUEST SENSE in front of the failed request.  This now
        needs to be done using requeueing.
      
      [ Impact: dequeue in-flight request ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      Cc: Borislav Petkov <petkovbb@googlemail.com>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      8f6205cd
    • T
      ide: cleanup rq->data_len usages · 34b7d2c9
      Tejun Heo 提交于
      With recent unification of fields, it's now guaranteed that
      rq->data_len always equals blk_rq_bytes().  Convert all direct users
      to accessors.
      
      [ Impact: convert direct rq->data_len usages to blk_rq_bytes() ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      Cc: Borislav Petkov <petkovbb@googlemail.com>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      34b7d2c9
    • T
      ide: convert to rq pos and nr_sectors accessors · 9780e2dd
      Tejun Heo 提交于
      ide doesn't manipulate request fields anymore and thus all hard and
      their soft equivalents are always equal.  Convert all references to
      accessors.
      
      [ Impact: use pos and nr_sectors accessors ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      Cc: Borislav Petkov <petkovbb@googlemail.com>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      9780e2dd
    • T
      block: implement blk_rq_pos/[cur_]sectors() and convert obvious ones · 5b93629b
      Tejun Heo 提交于
      Implement accessors - blk_rq_pos(), blk_rq_sectors() and
      blk_rq_cur_sectors() which return rq->hard_sector, rq->hard_nr_sectors
      and rq->hard_cur_sectors respectively and convert direct references of
      the said fields to the accessors.
      
      This is in preparation of request data length handling cleanup.
      
      Geert	: suggested adding const to struct request * parameter to accessors
      Sergei	: spotted error in patch description
      
      [ Impact: cleanup ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
      Acked-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Tested-by: NGrant Likely <grant.likely@secretlab.ca>
      Acked-by: NGrant Likely <grant.likely@secretlab.ca>
      Ackec-by: NSergei Shtylyov <sshtylyov@ru.mvista.com>
      Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      Cc: Borislav Petkov <petkovbb@googlemail.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      5b93629b
    • 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
  16. 01 5月, 2009 1 次提交
  17. 28 4月, 2009 4 次提交
    • T
      ide-cd,atapi: use bio for internal commands · 02e7cf8f
      Tejun Heo 提交于
      Impact: unify request data buffer handling
      
      rq->data is used mostly to pass kernel buffer through request queue
      without using bio.  There are only a couple of places which still do
      this in kernel and converting to bio isn't difficult.
      
      This patch converts ide-cd and atapi to use bio instead of rq->data
      for request sense and internal pc commands.  With previous change to
      unify sense request handling, this is relatively easily achieved by
      adding blk_rq_map_kern() during sense_rq prep and PC issue.
      
      If blk_rq_map_kern() fails for sense, the error is deferred till sense
      issue and aborts the failed command which triggered the sense.  Note
      that this is a slim possibility as sense prep is done on each command
      issue, so for the above condition to actually trigger, all preps since
      the last sense issue till the issue of the request which would require
      a sense should fail.
      
      * do_request functions might sleep now.  This should be okay as ide
        request_fn - do_ide_request() - is invoked only from make_request
        and plug work.  Make sure this is the case by adding might_sleep()
        to do_ide_request().
      
      * Functions which access the read sense data before the sense request
        is complete now should access bio_data(sense_rq->bio) as the sense
        buffer might have been copied during blk_rq_map_kern().
      
      * ide-tape updated to map sg.
      
      * cdrom_do_block_pc() now doesn't have to deal with REQ_TYPE_ATA_PC
        special case.  Simplified.
      
      * tp_ops->output/input_data path dropped from ide_pc_intr().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      02e7cf8f
    • B
      ide-cd: convert to using generic sense request · c457ce87
      Borislav Petkov 提交于
      Preallocate a sense request in the ->do_request method and reinitialize
      it only on demand, in case it's been consumed in the IRQ handler path.
      The reason for this is that we don't want to be mapping rq to bio in
      the IRQ path and introduce all kinds of unnecessary hacks to the block
      layer.
      
      tj: * Both user and kernel PC requests expect sense data to be stored
            in separate storage other than drive->sense_data.  Copy sense
            data to rq->sense on completion if rq->sense is not NULL.  This
            fixes bogus sense data on PC requests.
      
      As a result, remove cdrom_queue_request_sense.
      
      CC: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      CC: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NBorislav Petkov <petkovbb@gmail.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      c457ce87
    • T
      ide-cd: don't abuse rq->buffer · 1f181d2b
      Tejun Heo 提交于
      Impact: rq->buffer usage cleanup
      
      ide-cd uses rq->buffer to carry pointer to the original request when
      issuing REQUEST_SENSE.  Use rq->special instead.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      1f181d2b
    • T
      ide-cd: clear sense buffer before issuing request sense · 59a4f6f3
      Tejun Heo 提交于
      Impact: code simplification
      
      ide_cd_request_sense_fixup() clears the tail of the sense buffer if
      the device didn't completely fill it.  This patch makes
      cdrom_queue_request_sense() clear the sense buffer before issuing the
      command instead of clearing it afterwards.  This simplifies code and
      eases future changes.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      59a4f6f3
  18. 23 4月, 2009 1 次提交
    • H
      ide-cd: fix kernel crash on hppa regression · a1f9a89c
      Helge Deller 提交于
      With 2.6.30-rc2 I face a kernel crash on the 32bit hppa architecture 
      due to ide-cd when udev creates the device nodes at startup:
      
      Kernel Fault: Code=26 regs=8ed34c40 (Addr=00000024)
      IASQ: 00000000 00000000 IAOQ: 1034b5ac 1034b5b0
       IIR: 4ab30048    ISR: 00000000  IOR: 00000024
       CPU:        0   CR30: 8ed34000 CR31: ffff55ff
       ORIG_R28: 00000000
       IAOQ[0]: ide_complete_rq+0x2c/0x70
       IAOQ[1]: ide_complete_rq+0x30/0x70
       RP(r2): cdrom_newpc_intr+0x178/0x46c
      Backtrace:
       [<1035c608>] cdrom_newpc_intr+0x178/0x46c
       [<1034c494>] ide_intr+0x1b0/0x214
       [<1016d284>] handle_IRQ_event+0x70/0x150
       [<1016d4b0>] __do_IRQ+0x14c/0x1cc
       [<102f7864>] superio_interrupt+0x88/0xbc
       [<1016d284>] handle_IRQ_event+0x70/0x150
       [<1016d4b0>] __do_IRQ+0x14c/0x1cc
       [<10112efc>] do_cpu_irq_mask+0x9c/0xd0
       [<10116068>] intr_return+0x0/0x4
      
      This crash seems to happen due to an uninitialized variable "rc".
      The compiler even warns about that:
        CC      drivers/ide/ide-cd.o                                                         
      /mnt/sda4/home/cvs/parisc/git-kernel/linus-linux-2.6/drivers/ide/ide-cd.c: In function `cdrom_newpc_intr':
      /mnt/sda4/home/cvs/parisc/git-kernel/linus-linux-2.6/drivers/ide/ide-cd.c:612: warning: `rc' might be used uninitialized in this function
      
      After applying the trivial patch below, which just initializes 
      the variable to zero, the kernel doesn't crash any longer:
      
      Starting the hotplug events dispatcher: udevd.
      Synthesizing the initial hotplug events...
      hda: command error: status=0x51 { DriveReady SeekComplete Error }
      hda: command error: error=0x54 <3>{ AbortedCommand LastFailedSense=0x05 }
      ide: failed opcode was: unknown
      done.
      Signed-off-by: NHelge Deller <deller@gmx.de>
      Acked-by: NBorislav Petkov <petkovbb@gmail.com>
      Cc: Linus <torvalds@linux-foundation.org>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      a1f9a89c
  19. 19 4月, 2009 4 次提交
    • T
      ide-cd,atapi: use bio for internal commands · 5c4be572
      Tejun Heo 提交于
      Impact: unify request data buffer handling
      
      rq->data is used mostly to pass kernel buffer through request queue
      without using bio.  There are only a couple of places which still do
      this in kernel and converting to bio isn't difficult.
      
      This patch converts ide-cd and atapi to use bio instead of rq->data
      for request sense and internal pc commands.  With previous change to
      unify sense request handling, this is relatively easily achieved by
      adding blk_rq_map_kern() during sense_rq prep and PC issue.
      
      If blk_rq_map_kern() fails for sense, the error is deferred till sense
      issue and aborts the failed command which triggered the sense.  Note
      that this is a slim possibility as sense prep is done on each command
      issue, so for the above condition to actually trigger, all preps since
      the last sense issue till the issue of the request which would require
      a sense should fail.
      
      * do_request functions might sleep now.  This should be okay as ide
        request_fn - do_ide_request() - is invoked only from make_request
        and plug work.  Make sure this is the case by adding might_sleep()
        to do_ide_request().
      
      * Functions which access the read sense data before the sense request
        is complete now should access bio_data(sense_rq->bio) as the sense
        buffer might have been copied during blk_rq_map_kern().
      
      * ide-tape updated to map sg.
      
      * cdrom_do_block_pc() now doesn't have to deal with REQ_TYPE_ATA_PC
        special case.  Simplified.
      
      * tp_ops->output/input_data path dropped from ide_pc_intr().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      5c4be572
    • B
      ide-cd: convert to using generic sense request · 746d5e43
      Borislav Petkov 提交于
      Preallocate a sense request in the ->do_request method and reinitialize
      it only on demand, in case it's been consumed in the IRQ handler path.
      The reason for this is that we don't want to be mapping rq to bio in
      the IRQ path and introduce all kinds of unnecessary hacks to the block
      layer.
      
      tj: * Both user and kernel PC requests expect sense data to be stored
            in separate storage other than drive->sense_data.  Copy sense
            data to rq->sense on completion if rq->sense is not NULL.  This
            fixes bogus sense data on PC requests.
      
      As a result, remove cdrom_queue_request_sense.
      
      CC: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      CC: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NBorislav Petkov <petkovbb@gmail.com>
      Signed-off-by: NTejun Heo <tj@kernel.org>
      746d5e43
    • T
      ide-cd: don't abuse rq->buffer · cbfd082a
      Tejun Heo 提交于
      Impact: rq->buffer usage cleanup
      
      ide-cd uses rq->buffer to carry pointer to the original request when
      issuing REQUEST_SENSE.  Use rq->special instead.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      cbfd082a
    • T
      ide-cd: clear sense buffer before issuing request sense · 1873b90c
      Tejun Heo 提交于
      Impact: code simplification
      
      ide_cd_request_sense_fixup() clears the tail of the sense buffer if
      the device didn't completely fill it.  This patch makes
      cdrom_queue_request_sense() clear the sense buffer before issuing the
      command instead of clearing it afterwards.  This simplifies code and
      eases future changes.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      1873b90c
  20. 08 4月, 2009 6 次提交