1. 11 5月, 2009 4 次提交
    • T
      block: implement and enforce request peek/start/fetch · 9934c8c0
      Tejun Heo 提交于
      Till now block layer allowed two separate modes of request execution.
      A request is always acquired from the request queue via
      elv_next_request().  After that, drivers are free to either dequeue it
      or process it without dequeueing.  Dequeue allows elv_next_request()
      to return the next request so that multiple requests can be in flight.
      
      Executing requests without dequeueing has its merits mostly in
      allowing drivers for simpler devices which can't do sg to deal with
      segments only without considering request boundary.  However, the
      benefit this brings is dubious and declining while the cost of the API
      ambiguity is increasing.  Segment based drivers are usually for very
      old or limited devices and as converting to dequeueing model isn't
      difficult, it doesn't justify the API overhead it puts on block layer
      and its more modern users.
      
      Previous patches converted all block low level drivers to dequeueing
      model.  This patch completes the API transition by...
      
      * renaming elv_next_request() to blk_peek_request()
      
      * renaming blkdev_dequeue_request() to blk_start_request()
      
      * adding blk_fetch_request() which is combination of peek and start
      
      * disallowing completion of queued (not started) requests
      
      * applying new API to all LLDs
      
      Renamings are for consistency and to break out of tree code so that
      it's apparent that out of tree drivers need updating.
      
      [ Impact: block request issue API cleanup, no functional change ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Mike Miller <mike.miller@hp.com>
      Cc: unsik Kim <donari75@gmail.com>
      Cc: Paul Clements <paul.clements@steeleye.com>
      Cc: Tim Waugh <tim@cyberelk.net>
      Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Laurent Vivier <Laurent@lvivier.info>
      Cc: Jeff Garzik <jgarzik@pobox.com>
      Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Adrian McMenamin <adrian@mcmen.demon.co.uk>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
      Cc: Borislav Petkov <petkovbb@googlemail.com>
      Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
      Cc: Alex Dubov <oakad@yahoo.com>
      Cc: Pierre Ossman <drzeus@drzeus.cx>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
      Cc: Stefan Weinhuber <wein@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      9934c8c0
    • T
      block: blk_rq_[cur_]_{sectors|bytes}() usage cleanup · 1011c1b9
      Tejun Heo 提交于
      With the previous changes, the followings are now guaranteed for all
      requests in any valid state.
      
      * blk_rq_sectors() == blk_rq_bytes() >> 9
      * blk_rq_cur_sectors() == blk_rq_cur_bytes() >> 9
      
      Clean up accessor usages.  Notable changes are
      
      * nbd,i2o_block: end_all used instead of explicit byte count
      * scsi_lib: unnecessary conditional on request type removed
      
      [ Impact: cleanup ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Paul Clements <paul.clements@steeleye.com>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Cc: Alex Dubov <oakad@yahoo.com>
      Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Boaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      1011c1b9
    • T
      block: convert to pos and nr_sectors accessors · 83096ebf
      Tejun Heo 提交于
      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
      accessors.
      
      While at it, drop superflous blk_rq_pos() < 0 test in swim.c.
      
      [ Impact: use pos and nr_sectors accessors ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
      Tested-by: NGrant Likely <grant.likely@secretlab.ca>
      Acked-by: NGrant Likely <grant.likely@secretlab.ca>
      Tested-by: NAdrian McMenamin <adrian@mcmen.demon.co.uk>
      Acked-by: NAdrian McMenamin <adrian@mcmen.demon.co.uk>
      Acked-by: NMike 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: NJens Axboe <jens.axboe@oracle.com>
      83096ebf
    • T
      nbd: don't clear rq->sector and nr_sectors unnecessarily · 53d6979a
      Tejun Heo 提交于
      There's no reason to clear rq->sector and nr_sectors after calling
      blk_rq_init().  They're guaranteed to be clear.  Drop unnecessary
      clearing.
      
      [ Impact: cleanup ]
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Paul Clements <paul.clements@steeleye.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      53d6979a
  2. 03 4月, 2009 2 次提交
  3. 12 2月, 2009 1 次提交
    • P
      nbd: fix I/O hang on disconnected nbds · 4d48a542
      Paul Clements 提交于
      Fix a problem that causes I/O to a disconnected (or partially initialized)
      nbd device to hang indefinitely.  To reproduce:
      
      # ioctl NBD_SET_SIZE_BLOCKS /dev/nbd23 514048
      # dd if=/dev/nbd23 of=/dev/null bs=4096 count=1
      
      ...hangs...
      
      This can also occur when an nbd device loses its nbd-client/server
      connection.  Although we clear the queue of any outstanding I/Os after the
      client/server connection fails, any additional I/Os that get queued later
      will hang.
      
      This bug may also be the problem reported in this bug report:
      http://bugzilla.kernel.org/show_bug.cgi?id=12277
      
      Testing would need to be performed to determine if the two issues are the
      same.
      
      This problem was introduced by the new request handling thread code ("NBD:
      allow nbd to be used locally", 3/2008), which entered into mainline around
      2.6.25.
      
      The fix, which is fairly simple, is to restore the check for lo->sock
      being NULL in do_nbd_request.  This causes I/O to an uninitialized nbd to
      immediately fail with an I/O error, as it did prior to the introduction of
      this bug.
      Signed-off-by: NPaul Clements <paul.clements@steeleye.com>
      Reported-by: NJon Nelson <jnelson-kernel-bugzilla@jamponi.net>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Cc: <stable@kernel.org>		[2.6.26.x, 2.6.27.x, 2.6.28.x]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4d48a542
  4. 16 1月, 2009 1 次提交
  5. 29 12月, 2008 2 次提交
  6. 21 10月, 2008 2 次提交
    • A
      [PATCH] switch nbd · a8cdc308
      Al Viro 提交于
      NB: nbd_ioctl() appears to be racy; BKL is held, but doesn't really
      help, AFAICS.  Left as-is for now, but it'll need fixing.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      a8cdc308
    • A
      [PATCH] beginning of methods conversion · d4430d62
      Al Viro 提交于
      To keep the size of changesets sane we split the switch by drivers;
      to keep the damn thing bisectable we do the following:
      	1) rename the affected methods, add ones with correct
      prototypes, make (few) callers handle both.  That's this changeset.
      	2) for each driver convert to new methods.  *ALL* drivers
      are converted in this series.
      	3) kill the old (renamed) methods.
      
      Note that it _is_ a flagday; all in-tree drivers are converted and by the
      end of this series no trace of old methods remain.  The only reason why
      we do that this way is to keep the damn thing bisectable and allow per-driver
      debugging if anything goes wrong.
      
      New methods:
      	open(bdev, mode)
      	release(disk, mode)
      	ioctl(bdev, mode, cmd, arg)		/* Called without BKL */
      	compat_ioctl(bdev, mode, cmd, arg)
      	locked_ioctl(bdev, mode, cmd, arg)	/* Called with BKL, legacy */
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      d4430d62
  7. 20 10月, 2008 1 次提交
    • P
      x86: sysfs: kill owner field from attribute · 01e8ef11
      Parag Warudkar 提交于
      Tejun's commit 7b595756 made sysfs
      attribute->owner unnecessary.  But the field was left in the structure to
      ease the merge.  It's been over a year since that change and it is now
      time to start killing attribute->owner along with its users - one arch at
      a time!
      
      This patch is attempt #1 to get rid of attribute->owner only for
      CONFIG_X86_64 or CONFIG_X86_32 .  We will deal with other arches later on
      as and when possible - avr32 will be the next since that is something I
      can test.  Compile (make allyesconfig / make allmodconfig / custom config)
      and boot tested.
      
      akpm: the idea is that we put the declaration of sttribute.owner inside
      `#ifndef CONFIG_X86'.  But that proved to be too ambitious for now because
      new usages kept on turning up in subsystem trees.
      
      [akpm: remove the ifdef for now]
      Signed-off-by: NParag Warudkar <parag.lkml@gmail.com>
      Cc: Greg KH <greg@kroah.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Tejun Heo <htejun@gmail.com>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Roland Dreier <rolandd@cisco.com>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      01e8ef11
  8. 09 10月, 2008 1 次提交
  9. 21 8月, 2008 1 次提交
  10. 29 4月, 2008 4 次提交
    • H
      Remove duplicated unlikely() in IS_ERR() · 801678c5
      Hirofumi Nakagawa 提交于
      Some drivers have duplicated unlikely() macros.  IS_ERR() already has
      unlikely() in itself.
      
      This patch cleans up such pointless code.
      Signed-off-by: NHirofumi Nakagawa <hnakagawa@miraclelinux.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Acked-by: NJeff Garzik <jeff@garzik.org>
      Cc: Paul Clements <paul.clements@steeleye.com>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Michael Halcrow <mhalcrow@us.ibm.com>
      Cc: Anton Altaparmakov <aia21@cantab.net>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Carsten Otte <cotte@de.ibm.com>
      Cc: Patrick McHardy <kaber@trash.net>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Acked-by: NMike Frysinger <vapier@gentoo.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      801678c5
    • L
      NBD: add partition support · d71a6d73
      Laurent Vivier 提交于
      Permit the use of partitions with network block devices (NBD).
      
      A new parameter is introduced to define how many partition we want to be able
      to manage per network block device.  This parameter is "max_part".
      
      For instance, to manage 63 partitions / loop device, we will do:
      
         [on the server side]
      # nbd-server 1234 /dev/sdb
         [on the client side]
      # modprobe nbd max_part=63
      # ls -l /dev/nbd*
      brw-rw---- 1 root disk 43,   0 2008-03-25 11:14 /dev/nbd0
      brw-rw---- 1 root disk 43,  64 2008-03-25 11:11 /dev/nbd1
      brw-rw---- 1 root disk 43, 640 2008-03-25 11:11 /dev/nbd10
      brw-rw---- 1 root disk 43, 704 2008-03-25 11:11 /dev/nbd11
      brw-rw---- 1 root disk 43, 768 2008-03-25 11:11 /dev/nbd12
      brw-rw---- 1 root disk 43, 832 2008-03-25 11:11 /dev/nbd13
      brw-rw---- 1 root disk 43, 896 2008-03-25 11:11 /dev/nbd14
      brw-rw---- 1 root disk 43, 960 2008-03-25 11:11 /dev/nbd15
      brw-rw---- 1 root disk 43, 128 2008-03-25 11:11 /dev/nbd2
      brw-rw---- 1 root disk 43, 192 2008-03-25 11:11 /dev/nbd3
      brw-rw---- 1 root disk 43, 256 2008-03-25 11:11 /dev/nbd4
      brw-rw---- 1 root disk 43, 320 2008-03-25 11:11 /dev/nbd5
      brw-rw---- 1 root disk 43, 384 2008-03-25 11:11 /dev/nbd6
      brw-rw---- 1 root disk 43, 448 2008-03-25 11:11 /dev/nbd7
      brw-rw---- 1 root disk 43, 512 2008-03-25 11:11 /dev/nbd8
      brw-rw---- 1 root disk 43, 576 2008-03-25 11:11 /dev/nbd9
      # nbd-client localhost 1234 /dev/nbd0
      Negotiation: ..size = 80418240KB
      bs=1024, sz=80418240
      
      -------NOTE, RFC: partition table is not automatically read.
      The driver sets bdev->bd_invalidated to 1 to force the read of the partition
      table of the device, but this is done only on an open of the device.
      So we have to do a "touch /dev/nbdX" or something like that.
      It can't be done from the nbd-client or nbd driver because at this
      level we can't ask to read the partition table and to serve the request
      at the same time (-> deadlock)
      
      If someone has a better idea, I'm open to any suggestion.
      -------NOTE, RFC
      
      # fdisk -l /dev/nbd0
      
      Disk /dev/nbd0: 82.3 GB, 82348277760 bytes
      255 heads, 63 sectors/track, 10011 cylinders
      Units = cylinders of 16065 * 512 = 8225280 bytes
      
           Device Boot      Start         End      Blocks   Id  System
      /dev/nbd0p1   *           1        9965    80043831   83  Linux
      /dev/nbd0p2            9966       10011      369495    5  Extended
      /dev/nbd0p5            9966       10011      369463+  82  Linux swap / Solaris
      
      # ls -l /dev/nbd0*
      brw-rw---- 1 root disk 43,   0 2008-03-25 11:16 /dev/nbd0
      brw-rw---- 1 root disk 43,   1 2008-03-25 11:16 /dev/nbd0p1
      brw-rw---- 1 root disk 43,   2 2008-03-25 11:16 /dev/nbd0p2
      brw-rw---- 1 root disk 43,   5 2008-03-25 11:16 /dev/nbd0p5
      # mount /dev/nbd0p1 /mnt
      # ls /mnt
      bin    dev   initrd      lost+found  opt   sbin     sys  var
      boot   etc   initrd.img  media       proc  selinux  tmp  vmlinuz
      cdrom  home  lib         mnt         root  srv      usr
      # umount /mnt
      # nbd-client -d /dev/nbd0
      # ls -l /dev/nbd0*
      brw-rw---- 1 root disk 43, 0 2008-03-25 11:16 /dev/nbd0
      -------NOTE
      On "nbd-client -d", we can do an iocl(BLKRRPART) to update partition table:
      as the size of the device is 0, we don't have to serve the partition manager
      request (-> no deadlock).
      -------NOTE
      Signed-off-by: NPaul Clements <paul.clements@steeleye.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d71a6d73
    • L
      NBD: allow nbd to be used locally · 48cf6061
      Laurent Vivier 提交于
      This patch allows Network Block Device to be mounted locally (nbd-client to
      nbd-server over 127.0.0.1).
      
      It creates a kthread to avoid the deadlock described in NBD tools
      documentation.  So, if nbd-client hangs waiting for pages, the kblockd thread
      can continue its work and free pages.
      
      I have tested the patch to verify that it avoids the hang that always occurs
      when writing to a localhost nbd connection.  I have also tested to verify that
      no performance degradation results from the additional thread and queue.
      
      Patch originally from Laurent Vivier.
      Signed-off-by: NPaul Clements <paul.clements@steeleye.com>
      Signed-off-by: NLaurent Vivier <Laurent.Vivier@bull.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      48cf6061
    • F
      block: use blk_rq_init() to initialize the request · 4f54eec8
      FUJITA Tomonori 提交于
      Any path needs to call it to initialize the request.
      
      This is a preparation for large command support, which needs to
      initialize the request in a proper way (that is, just doing a memset()
      will not work).
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Jens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      4f54eec8
  11. 03 4月, 2008 1 次提交
  12. 24 2月, 2008 1 次提交
  13. 09 2月, 2008 1 次提交
  14. 28 1月, 2008 1 次提交
  15. 25 1月, 2008 1 次提交
    • K
      Driver core: convert block from raw kobjects to core devices · edfaa7c3
      Kay Sievers 提交于
      This moves the block devices to /sys/class/block. It will create a
      flat list of all block devices, with the disks and partitions in one
      directory. For compatibility /sys/block is created and contains symlinks
      to the disks.
      
        /sys/class/block
        |-- sda -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
        |-- sda1 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1
        |-- sda10 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10
        |-- sda5 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5
        |-- sda6 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6
        |-- sda7 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7
        |-- sda8 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8
        |-- sda9 -> ../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9
        `-- sr0 -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
      
        /sys/block/
        |-- sda -> ../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda
        `-- sr0 -> ../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      edfaa7c3
  16. 13 11月, 2007 1 次提交
  17. 20 10月, 2007 2 次提交
  18. 17 10月, 2007 4 次提交
  19. 10 10月, 2007 2 次提交
  20. 24 7月, 2007 1 次提交
  21. 17 7月, 2007 1 次提交
  22. 10 7月, 2007 1 次提交
    • B
      [PATCH] fix request->cmd == INT cases · e654bc43
      Boaz Harrosh 提交于
       - I have unearthed very old bugs in stale drivers that still
         used request->cmd as a READ|WRITE int
       - This patch is maybe a proof that these drivers have not been
         used for a long time. Should they be removed completely?
      
      Drivers that currently do not work for sure:
       drivers/acorn/block/fd1772.c |    2 +-
       drivers/acorn/block/mfmhd.c  |    8 ++++----
       drivers/cdrom/aztcd.c        |    2 +-
       drivers/cdrom/cm206.c        |    2 +-
       drivers/cdrom/gscd.c         |    2 +-
       drivers/cdrom/mcdx.c         |    2 +-
       drivers/cdrom/optcd.c        |    2 +-
       drivers/cdrom/sjcd.c         |    2 +-
      
      Drivers with cosmetic fixes only:
        b/drivers/block/amiflop.c
        b/drivers/block/nbd.c
        b/drivers/ide/legacy/hd.c
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      e654bc43
  23. 10 5月, 2007 1 次提交
  24. 09 12月, 2006 1 次提交
  25. 08 12月, 2006 1 次提交
  26. 01 10月, 2006 1 次提交
    • J
      [PATCH] Split struct request ->flags into two parts · 4aff5e23
      Jens Axboe 提交于
      Right now ->flags is a bit of a mess: some are request types, and
      others are just modifiers. Clean this up by splitting it into
      ->cmd_type and ->cmd_flags. This allows introduction of generic
      Linux block message types, useful for sending generic Linux commands
      to block devices.
      Signed-off-by: NJens Axboe <axboe@suse.de>
      4aff5e23