linux/block
Lukas Czerner 5dba3089ed blkdev: Submit discard bio in batches in blkdev_issue_discard()
Currently we are waiting for every submitted REQ_DISCARD bio separately,
but it can have unwanted consequences of repeatedly flushing the queue,
so we rather submit bios in batches and wait for the entire batch, hence
narrowing the window of other ios going in.

Use bio_batch_end_io() and struct bio_batch for that purpose, the same
is used by blkdev_issue_zeroout(). Also change bio_batch_end_io() so we
always set !BIO_UPTODATE in the case of error and remove the check for
bb, since we are the only user of this function and we always set this.

Remove bio_get()/bio_put() from the blkdev_issue_discard() since
bio_alloc() and bio_batch_end_io() is doing the same thing, hence it is
not needed anymore.

I have done simple dd testing with surprising results. The script I have
used is:

for i in $(seq 10); do
        echo $i
        dd if=/dev/sdb1 of=/dev/sdc1 bs=4k &
        sleep 5
done
/usr/bin/time -f %e ./blkdiscard /dev/sdc1

Running time of BLKDISCARD on the whole device:
with patch              without patch
0.95                    15.58

So we can see that in this artificial test the kernel with the patch
applied is approx 16x faster in discarding the device.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
CC: Dmitry Monakhov <dmonakhov@openvz.org>
CC: Jens Axboe <jaxboe@fusionio.com>
CC: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2011-05-06 19:26:27 -06:00
..
blk-cgroup.c Fix common misspellings 2011-03-31 11:26:23 -03:00
blk-cgroup.h blk-cgroup: Add unaccounted time to timeslice_used. 2011-03-12 16:54:00 +01:00
blk-core.c block: add blk_run_queue_async 2011-04-18 11:41:33 +02:00
blk-exec.c block: Remove 'plug/unplug' comment in blk_execute_rq_nowait 2011-05-05 15:10:05 -06:00
blk-flush.c block: hold queue if flush is running for non-queueable flush drive 2011-05-06 11:36:25 -06:00
blk-integrity.c dm: improve block integrity support 2011-04-05 23:52:43 +02:00
blk-ioc.c block: Clean up exit_io_context() source code. 2010-12-21 15:07:45 +01:00
blk-iopoll.c tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
blk-lib.c blkdev: Submit discard bio in batches in blkdev_issue_discard() 2011-05-06 19:26:27 -06:00
blk-map.c block: check for proper length of iov entries earlier in blk_rq_map_user_iov() 2010-11-29 10:04:50 +01:00
blk-merge.c block: attempt to merge with existing requests on plug flush 2011-03-21 10:14:27 +01:00
blk-settings.c block: add a non-queueable flush flag 2011-05-06 11:36:25 -06:00
blk-softirq.c generic-ipi: remove CSD_FLAG_WAIT 2009-02-25 14:13:44 +01:00
blk-sysfs.c block, blk-sysfs: Use the variable directly instead of a function call 2011-04-13 22:14:54 +02:00
blk-tag.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
blk-throttle.c Merge branch 'for-linus2' of git://git.profusion.mobi/users/lucas/linux-2.6 2011-04-07 11:14:49 -07:00
blk-timeout.c block: ensure jiffies wrap is handled correctly in blk_rq_timed_out_timer 2010-04-21 17:42:08 +02:00
blk.h block: hold queue if flush is running for non-queueable flush drive 2011-05-06 11:36:25 -06:00
bsg.c [SCSI] bsg: correct fault if queue object removed while dev_t open 2010-12-09 09:41:14 -06:00
cfq-iosched.c block: add blk_run_queue_async 2011-04-18 11:41:33 +02:00
cfq.h blk-cgroup: Add unaccounted time to timeslice_used. 2011-03-12 16:54:00 +01:00
compat_ioctl.c BKL: remove extraneous #include <smp_lock.h> 2010-11-17 08:59:32 -08:00
deadline-iosched.c block: remove per-queue plugging 2011-03-10 08:52:07 +01:00
elevator.c iosched: remove redundant sprintf 2011-05-05 18:02:12 -06:00
genhd.c Fix common misspellings 2011-03-31 11:26:23 -03:00
ioctl.c block: fix refcounting in BLKBSZSET 2011-02-24 08:54:21 -08:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Kconfig.iosched blk-cgroup: config options re-arrangement 2010-04-26 19:27:56 +02:00
Makefile Merge branch 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block 2010-10-22 17:07:18 -07:00
noop-iosched.c block: remove per-queue plugging 2011-03-10 08:52:07 +01:00
scsi_ioctl.c block: take care not to overflow when calculating total iov length 2010-11-10 14:40:42 +01:00