1. 30 Jan, 2008 4 commits
    • Kiyoshi Ueda's avatar
    • Boaz Harrosh's avatar
      [SCSI] bidirectional command support · 6f9a35e2
      Boaz Harrosh authored
      
      
      At the block level bidi request uses req->next_rq pointer for a second
      bidi_read request.
      At Scsi-midlayer a second scsi_data_buffer structure is used for the
      bidi_read part. This bidi scsi_data_buffer is put on
      request->next_rq->special. Struct scsi_cmnd is not changed.
      
      - Define scsi_bidi_cmnd() to return true if it is a bidi request and a
        second sgtable was allocated.
      
      - Define scsi_in()/scsi_out() to return the in or out scsi_data_buffer
        from this command This API is to isolate users from the mechanics of
        bidi.
      
      - Define scsi_end_bidi_request() to do what scsi_end_request() does but
        for a bidi request. This is necessary because bidi commands are a bit
        tricky here. (See comments in body)
      
      - scsi_release_buffers() will also release the bidi_read scsi_data_buffer
      
      - scsi_io_completion() on bidi commands will now call
        scsi_end_bidi_request() and return.
      
      - The previous work done in scsi_init_io() is now done in a new
        scsi_init_sgtable() (which is 99% identical to old scsi_init_io())
        The new scsi_init_io() will call the above twice if needed also for
        the bidi_read command. Only at this point is a command bidi.
      
      - In scsi_error.c at scsi_eh_prep/restore_cmnd() make sure bidi-lld is not
        confused by a get-sense command that looks like bidi. This is done
        by puting NULL at request->next_rq, and restoring.
      
      [jejb: update to sg_table and resolve conflicts
      also update to blk-end-request and resolve conflicts]
      Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      6f9a35e2
    • 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
        structure.
      - 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
        change.
      - 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
          implementation.
        * 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>
      30b0c37b
    • Boaz Harrosh's avatar
      [SCSI] tgt: use scsi_init_io instead of scsi_alloc_sgtable · bb52d82f
      Boaz Harrosh authored
      
      
      If we export scsi_init_io()/scsi_release_buffers() instead of
      scsi_{alloc,free}_sgtable() from scsi_lib than tgt code is much more
      insulated from scsi_lib changes. As a bonus it will also gain bidi
      capability when it comes.
      
      [jejb: rebase on to sg_table and fix up rejections]
      Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
      Acked-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      bb52d82f
  2. 28 Jan, 2008 3 commits
  3. 23 Jan, 2008 1 commit
  4. 11 Jan, 2008 5 commits
  5. 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>
      7b3d9545
  6. 02 Jan, 2008 2 commits
  7. 03 Nov, 2007 1 commit
  8. 02 Nov, 2007 1 commit
    • Jens Axboe's avatar
      [SG] Get rid of __sg_mark_end() · c46f2334
      Jens Axboe authored
      
      
      sg_mark_end() overwrites the page_link information, but all users want
      __sg_mark_end() behaviour where we just set the end bit. That is the most
      natural way to use the sg list, since you'll fill it in and then mark the
      end point.
      
      So change sg_mark_end() to only set the termination bit. Add a sg_magic
      debug check as well, and clear a chain pointer if it is set.
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      c46f2334
  9. 22 Oct, 2007 1 commit
  10. 17 Oct, 2007 2 commits
  11. 16 Oct, 2007 6 commits
  12. 12 Oct, 2007 5 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>
      6f5391c2
    • James Bottomley's avatar
      [SCSI] Fix device not ready printk · 311b581e
      James Bottomley authored
      
      
      Because scsi_print_sense_hdr prefixes with KERN_INFO, the output from
      scsi_io_completion looks like:
      
      sd 0:0:0:0: [sdb] Device not ready: <6>: Sense Key : 0x2 [current]
      : ASC=0x4 ASCQ=0x3
      
      By using scsi_show_sense_hdr, we can get the much more appealing output:
      
      sd 0:0:0:0: [sdb] Device not ready: Sense Key : 0x2 [current]
      sd 0:0:0:0: [sdb] Device not ready: ASC=0x4 ASCQ=0x3
      Acked-by: default avatarMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
      311b581e
    • 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>
      7f9a6bc4
    • Michael Reed's avatar
      [SCSI] stale residual returned on write following BUSY retry · 52aeeca9
      Michael Reed authored
      
      
      A BUSY status returned on a write request results in a stale residual
      being returned when the write ultimately successfully completes.
      
      This can be reproduced as follows:
      
      1) issue immediate mode rewind to scsi tape drive
      2) issue write request
      
      The tape drive returns busy.  The low level driver detects underrun and
      sets the residual into the scsi command.  The low level driver responds
      with (DID_OK << 16) | scsi_status.  scsi_status is 8, hence
      status_byte(result) == 4, i.e., BUSY.
      
      scsi_softirq_done() calls scsi_decide_disposition() which returns
      ADD_TO_MLQUEUE.  scsi_softirq_done() then calls scsi_queue_insert()
      which, on the way to resubmitting the request to the driver, calls
      scsi_init_cmd_errh().
      
      The attached patch modifies scsi_init_cmd_errh() to clear the resid
      field.  This prevents a "stale" residual from being returned when the
      scsi command finally completes without a BUSY status.
      Signed-off-by: default avatarMichael Reed <mdr@sgi.com>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
      52aeeca9
    • Mike Christie's avatar
      [SCSI] fix write buffer length in scsi_req_map_sg() · bd441dea
      Mike Christie authored
      
      
      sg's may have setup a the buffer with a different length than
      the transfer length so we should be using the bufflen passed
      in as the request's data len.
      Signed-off-by: default avatarMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
      bd441dea
  13. 10 Oct, 2007 2 commits
  14. 04 Aug, 2007 1 commit
  15. 24 Jul, 2007 1 commit
  16. 19 Jul, 2007 1 commit
    • Paul Mundt's avatar
      mm: Remove slab destructors from kmem_cache_create(). · 20c2df83
      Paul Mundt authored
      Slab destructors were no longer supported after Christoph's
      c59def9f
      
       change. They've been
      BUGs for both slab and slub, and slob never supported them
      either.
      
      This rips out support for the dtor pointer from kmem_cache_create()
      completely and fixes up every single callsite in the kernel (there were
      about 224, not including the slab allocator definitions themselves,
      or the documentation references).
      Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
      20c2df83
  17. 14 Jul, 2007 1 commit
    • Cornelia Huck's avatar
      [SCSI] don't build scsi_dma_{map,unmap} for !HAS_DMA · 7689e82e
      Cornelia Huck authored
      
      
      With
      
       dma-mapping-prevent-dma-dependent-code-from-linking-on.patch
      
      scsi fails to build on !HAS_DMA architectures:
      
      drivers/built-in.o(.text+0x20af6): In function `scsi_dma_map':
      : undefined reference to `dma_map_sg'
      drivers/built-in.o(.text+0x20b5c): In function `scsi_dma_unmap':
      : undefined reference to `dma_unmap_sg'
      
      I split those functions out into a new file. Builds on s390 and i386.
      
      Move scsi_dma_{map,unmap} into scsi_lib_dma.c which is only build if
      HAS_DMA is set.
      Signed-off-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: James Bottomley <James.Bottomley@SteelEye.com>
      Cc: Jeff Garzik <jeff@garzik.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
      7689e82e
  18. 26 May, 2007 1 commit
  19. 09 May, 2007 1 commit