1. 22 May, 2009 1 commit
  2. 11 May, 2009 1 commit
    • Tejun Heo's avatar
      block: convert to pos and nr_sectors accessors · 83096ebf
      Tejun Heo authored
      With recent cleanups, there is no place where low level driver
      directly manipulates request fields.  This means that the 'hard'
      request fields always equal the !hard fields.  Convert all
      rq->sectors, nr_sectors and current_nr_sectors references to
      While at it, drop superflous blk_rq_pos() < 0 test in swim.c.
      [ Impact: use pos and nr_sectors accessors ]
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
      Tested-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Tested-by: default avatarAdrian McMenamin <adrian@mcmen.demon.co.uk>
      Acked-by: default avatarAdrian McMenamin <adrian@mcmen.demon.co.uk>
      Acked-by: default avatarMike Miller <mike.miller@hp.com>
      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: Eric Moore <Eric.Moore@lsi.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Paul Clements <paul.clements@steeleye.com>
      Cc: Tim Waugh <tim@cyberelk.net>
      Cc: Jeff Garzik <jgarzik@pobox.com>
      Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
      Cc: Alex Dubov <oakad@yahoo.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Dario Ballabio <ballabio_dario@emc.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: unsik Kim <donari75@gmail.com>
      Cc: Laurent Vivier <Laurent@lvivier.info>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
  3. 03 Apr, 2009 1 commit
    • James Bottomley's avatar
      [SCSI] fix recovered error handling · a9bddd74
      James Bottomley authored
      We have a problem with recovered error handling in that any command
      which goes down as BLOCK_PC but which returns a sense code of RECOVERED
      ERROR gets completed with -EIO.  For actual SG_IO commands, this doesn't
      matter at all, since the error return code gets dropped in favour of
      req->errors which contain the SCSI completion code.
      However, if this command is part of the block system, then it will pay
      attention to the returned error code.  In particularly if a SYNCHRONIZE
      CACHE from a barrier command completes with RECOVERED ERROR, the
      resulting -EIO on the barrier causes block to error the request and
      return it to the filesystem.  Fix this by converting the -EIO for
      recovered error to zero, plus remove the printing of this from sd and sr
      so the message isn't double printed.
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
  4. 29 Dec, 2008 1 commit
  5. 04 Dec, 2008 1 commit
  6. 21 Oct, 2008 4 commits
  7. 09 Oct, 2008 2 commits
    • Jens Axboe's avatar
      block: unify request timeout handling · 242f9dcb
      Jens Axboe authored
      Right now SCSI and others do their own command timeout handling.
      Move those bits to the block layer.
      Instead of having a timer per command, we try to be a bit more clever
      and simply have one per-queue. This avoids the overhead of having to
      tear down and setup a timer for each command, so it will result in a lot
      less timer fiddling.
      Signed-off-by: default avatarMike Anderson <andmike@linux.vnet.ibm.com>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
    • Tejun Heo's avatar
      block: don't depend on consecutive minor space · f331c029
      Tejun Heo authored
      * Implement disk_devt() and part_devt() and use them to directly
        access devt instead of computing it from ->major and ->first_minor.
        Note that all references to ->major and ->first_minor outside of
        block layer is used to determine devt of the disk (the part0) and as
        ->major and ->first_minor will continue to represent devt for the
        disk, converting these users aren't strictly necessary.  However,
        convert them for consistency.
      * Implement disk_max_parts() to avoid directly deferencing
      * Update bdget_disk() such that it doesn't assume consecutive minor
      * Move devt computation from register_disk() to add_disk() and make it
        the only one (all other usages use the initially determined value).
      These changes clean up the code and will help disk->part dereference
      fix and extended block device numbers.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
  8. 11 Sep, 2008 1 commit
  9. 29 Aug, 2008 1 commit
    • FUJITA Tomonori's avatar
      remove blk_register_filter and blk_unregister_filter in gendisk · bb23b431
      FUJITA Tomonori authored
      This patch remove blk_register_filter and blk_unregister_filter in
      gendisk, and adds them to sd.c, sr.c. and ide-cd.c
      The commit abf54393 moved cmdfilter
      from gendisk to request_queue. It turned out that in some subsystems
      multiple gendisks share a single request_queue. So we get:
      Using physmap partition information
      Creating 3 MTD partitions on "physmap-flash":
      0x00000000-0x01c00000 : "User FS"
      0x01c00000-0x01c40000 : "booter"
      kobject (8511c410): tried to init an initialized object, something is seriously wrong.
      Call Trace:
      [<8036644c>] dump_stack+0x8/0x34
      [<8021f050>] kobject_init+0x50/0xcc
      [<8021fa18>] kobject_init_and_add+0x24/0x58
      [<8021d20c>] blk_register_filter+0x4c/0x64
      [<8021c194>] add_disk+0x78/0xe0
      [<8027d14c>] add_mtd_blktrans_dev+0x254/0x278
      [<8027c8f0>] blktrans_notify_add+0x40/0x78
      [<80279c00>] add_mtd_device+0xd0/0x150
      [<8027b090>] add_mtd_partitions+0x568/0x5d8
      [<80285458>] physmap_flash_probe+0x2ac/0x334
      [<802644f8>] driver_probe_device+0x12c/0x244
      [<8026465c>] __driver_attach+0x4c/0x84
      [<80263c64>] bus_for_each_dev+0x58/0xac
      [<802633ec>] bus_add_driver+0xc4/0x24c
      [<802648e0>] driver_register+0xcc/0x184
      [<80100460>] _stext+0x60/0x1bc
      In the long term, we need to fix such subsystems but we need a quick
      fix now. This patch add the command filter support to only sd and sr
      though it might be useful for other SG_IO users (such as cciss).
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Reported-by: default avatarManuel Lauss <mano@roarinelk.homelinux.net>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
  10. 04 Jul, 2008 1 commit
  11. 10 Jun, 2008 1 commit
  12. 19 Mar, 2008 1 commit
  13. 07 Feb, 2008 1 commit
  14. 30 Jan, 2008 1 commit
    • Boaz Harrosh's avatar
      [SCSI] implement scsi_data_buffer · 30b0c37b
      Boaz Harrosh authored
      In preparation for bidi we abstract all IO members of scsi_cmnd,
      that will need to duplicate, into a substructure.
      - Group all IO members of scsi_cmnd into a scsi_data_buffer
      - Adjust accessors to new members.
      - scsi_{alloc,free}_sgtable receive a scsi_data_buffer instead of
        scsi_cmnd. And work on it.
      - Adjust scsi_init_io() and  scsi_release_buffers() for above
      - Fix other parts of scsi_lib/scsi.c to members migration. Use
        accessors where appropriate.
      - fix Documentation about scsi_cmnd in scsi_host.h
      - scsi_error.c
        * Changed needed members of struct scsi_eh_save.
        * Careful considerations in scsi_eh_prep/restore_cmnd.
      - sd.c and sr.c
        * sd and sr would adjust IO size to align on device's block
          size so code needs to change once we move to scsi_data_buff
        * Convert code to use scsi_for_each_sg
        * Use data accessors where appropriate.
      - tgt: convert libsrp to use scsi_data_buffer
      - isd200: This driver still bangs on scsi_cmnd IO members,
        so need changing
      [jejb: rebased on top of sg_table patches fixed up conflicts
      and used the synergy to eliminate use_sg and sg_count]
      Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
  15. 11 Jan, 2008 3 commits
  16. 06 Jan, 2008 1 commit
    • Linus Torvalds's avatar
      Revert "scsi: revert "[SCSI] Get rid of scsi_cmnd->done"" · 7b3d9545
      Linus Torvalds authored
      This reverts commit ac40532e, which gets
      us back the original cleanup of 6f5391c2.
      It turns out that the bug that was triggered by that commit was
      apparently not actually triggered by that commit at all, and just the
      testing conditions had changed enough to make it appear to be due to it.
      The real problem seems to have been found by Peter Osterlund:
        "pktcdvd sets it [block device size] when opening the /dev/pktcdvd
         device, but when the drive is later opened as /dev/scd0, there is
         nothing that sets it back.  (Btw, 40944 is possible if the disk is a
         CDRW that was formatted with "cdrwtool -m 10236".)
         The problem is that pktcdvd opens the cd device in non-blocking mode
         when pktsetup is run, and doesn't close it again until pktsetup -d is
         run.  The effect is that if you meanwhile open the cd device,
         blkdev.c:do_open() doesn't call bd_set_size() because
         bdev->bd_openers is non-zero."
      In particular, to repeat the bug (regardless of whether commit
      6f5391c2 is applied or not):
        " 1. Start with an empty drive.
          2. pktsetup 0 /dev/scd0
          3. Insert a CD containing an isofs filesystem.
          4. mount /dev/pktcdvd/0 /mnt/tmp
          5. umount /mnt/tmp
          6. Press the eject button.
          7. Insert a DVD containing a non-writable filesystem.
          8. mount /dev/scd0 /mnt/tmp
          9. find /mnt/tmp -type f -print0 | xargs -0 sha1sum >/dev/null
          10. If the DVD contains data beyond the physical size of a CD, you
              get I/O errors in the terminal, and dmesg reports lots of
              "attempt to access beyond end of device" errors."
      which in turn is because the nested open after the media change won't
      cause the size to be set properly (because the original open still holds
      the block device, and we only do the bd_set_size() when we don't have
      other people holding the device open).
      The proper fix for that is probably to just do something like
      	bdev->bd_inode->i_size = (loff_t)get_capacity(disk)<<9;
      in fs/block_dev.c:do_open() even for the cases where we're not the
      original opener (but *not* call bd_set_size(), since that will also
      change the block size of the device).
      Cc: Peter Osterlund <petero2@telia.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Matthew Wilcox <matthew@wil.cx>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  17. 02 Jan, 2008 1 commit
  18. 12 Oct, 2007 2 commits
    • Matthew Wilcox's avatar
      [SCSI] Get rid of scsi_cmnd->done · 6f5391c2
      Matthew Wilcox authored
      The ULD ->done callback moves into the scsi_driver.  By moving the call
      to scsi_io_completion() from scsi_blk_pc_done() to scsi_finish_command(),
      we can eliminate the latter entirely.  By returning 'good_bytes' from
      the ->done callback (rather than invoking scsi_io_completion()), we can
      stop exporting scsi_io_completion().
      Also move the prototypes from sd.h to sd.c as they're all internal anyway.
      Rename sd_rw_intr to sd_done and rw_intr to sr_done.
      Inspired-by: default avatarChristoph Hellwig <hch@infradead.org>
      Signed-off-by: default avatarMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
    • James Bottomley's avatar
      [SCSI] move ULD attachment into the prep function · 7f9a6bc4
      James Bottomley authored
      One of the intents of the block prep function was to allow ULDs to use
      it for preprocessing.  The original SCSI model was to have a single prep
      function and add a pointer indirect filter to build the necessary
      commands.  This patch reverses that, does away with the init_command
      field of the scsi_driver structure and makes ULDs attach directly to the
      prep function instead.  The value is really that it allows us to begin
      to separate the ULDs from the SCSI mid layer (as long as they don't use
      any core functions---which is hard at the moment---a ULD doesn't even
      need SCSI to bind).
      Acked-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
  19. 24 Jul, 2007 1 commit
  20. 18 Jul, 2007 1 commit
  21. 14 Jul, 2007 1 commit
  22. 17 Apr, 2007 1 commit
    • Michael Tokarev's avatar
      [SCSI] modalias for scsi devices · d7b8bcb0
      Michael Tokarev authored
      The following patch adds support for sysfs/uevent modalias
      attribute for scsi devices (like disks, tapes, cdroms etc),
      based on whatever current sd.c, sr.c, st.c and osst.c drivers
      The modalias format is like this:
      (for TYPE_WORM, handled by sr.c now).
      Several comments.
      o This hexadecimal type value is because all TYPE_XXX constants
        in include/scsi/scsi.h are given in hex, but __stringify() will
        not convert them to decimal (so it will NOT be scsi:type-4).
        Since it does not really matter in which format it is, while
        both modalias in module and modalias attribute match each other,
        I descided to go for that 0x%02x format (and added a comment in
        include/scsi/scsi.h to keep them that way), instead of changing
        them all to decimal.
      o There was no .uevent routine for SCSI bus.  It might be a good
        idea to add some more ueven environment variables in there.
      o osst.c driver handles tapes too, like st.c, but only SOME tapes.
        With this setup, hotplug scripts (or whatever is used by the
        user) will try to load both st and osst modules for all SCSI
        tapes found, because both modules have scsi:type-0x01 alias).
        It is not harmful, but one extra module is no good either.
        It is possible to solve this, by exporting more info in
        modalias attribute, including vendor and device identification
        strings, so that modalias becomes something like
          scsi:type-0x12:vendor-Adaptec LTD:device-OnStream Tape Drive
        and having that, match for all 3 attributes, not only device
        type.  But oh well, vendor and device strings may be large,
        and they do contain spaces and whatnot.
        So I left them for now, awaiting for comments first.
      Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
  23. 14 Feb, 2007 1 commit
    • Tim Schmielau's avatar
      [PATCH] remove many unneeded #includes of sched.h · cd354f1a
      Tim Schmielau authored
      After Al Viro (finally) succeeded in removing the sched.h #include in module.h
      recently, it makes sense again to remove other superfluous sched.h includes.
      There are quite a lot of files which include it but don't actually need
      anything defined in there.  Presumably these includes were once needed for
      macros that used to live in sched.h, but moved to other header files in the
      course of cleaning it up.
      To ease the pain, this time I did not fiddle with any header files and only
      removed #includes from .c-files, which tend to cause less trouble.
      Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
      arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
      allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
      configs in arch/arm/configs on arm.  I also checked that no new warnings were
      introduced by the patch (actually, some warnings are removed that were emitted
      by unnecessarily included header files).
      Signed-off-by: default avatarTim Schmielau <tim@physik3.uni-rostock.de>
      Acked-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  24. 06 Jan, 2007 1 commit
  25. 09 Jul, 2006 1 commit
    • Christoph Hellwig's avatar
      [SCSI] hide EH backup data outside the scsi_cmnd · 631c228c
      Christoph Hellwig authored
      Currently struct scsi_cmnd has various fields that are used to backup
      original data after the corresponding fields have been overridden for
      EH commands.  This means drivers can easily get at it and misuse it.
      Due to the old_ naming this doesn't happen for most of them, but two
      that have different names have been used wrong a lot (see previous
      patch).  Another downside is that they unessecarily bloat the scsi_cmnd
      This patch moves them onstack in scsi_send_eh_cmnd to fix those two
      issues aswell as allowing future EH fixes like moving the EH command
      submissions to use SG lists like everything else.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
  26. 26 Jun, 2006 1 commit
    • Luben Tuikov's avatar
      [SCSI] sd/scsi_lib simplify sd_rw_intr and scsi_io_completion · 03aba2f7
      Luben Tuikov authored
      This patch simplifies "good_bytes" computation in sd_rw_intr().
      sd: "good_bytes" computation is always done in terms of the resolution
      of the device's medium, since after that it is the number of good bytes
      we pass around and other layers/contexts (as opposed ot sd) can translate
      that to their own resolution (block layer:512).  It also makes
      scsi_io_completion() processing more straightforward, eliminating the
      3rd argument to the function.
      It also fixes a couple of bugs like not checking return value,
      using "break" instead of "return;", etc.
      I've been running with this patch for some time now on a
      test (do-it-all) system.
      Signed-off-by: default avatarLuben Tuikov <ltuikov@yahoo.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
  27. 06 Jun, 2006 1 commit
  28. 23 Mar, 2006 1 commit
  29. 12 Mar, 2006 1 commit
  30. 27 Feb, 2006 2 commits
  31. 14 Jan, 2006 2 commits