summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaohua Li <shli@kernel.org>2012-12-14 03:15:51 (GMT)
committerJens Axboe <axboe@kernel.dk>2012-12-14 19:46:04 (GMT)
commit0cfbcafcae8b7364b5fa96c2b26ccde7a3a296a9 (patch)
treedc6601c000fc21c80db3f6861ac117359649429a
parent8dd2cb7e880d2f77fba53b523c99133ad5054cfd (diff)
downloadlinux-0cfbcafcae8b7364b5fa96c2b26ccde7a3a296a9.tar.xz
block: add plug for blkdev_issue_discard
Last post of this patch appears lost, so I resend this. Now discard merge works, add plug for blkdev_issue_discard. This will help discard request merge especially for raid0 case. In raid0, a big discard request is split to small requests, and if correct plug is added, such small requests can be merged in low layer. Signed-off-by: Shaohua Li <shli@fusionio.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-lib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/blk-lib.c b/block/blk-lib.c
index 5677fd3..b3a1f2b7 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -48,6 +48,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
struct bio_batch bb;
struct bio *bio;
int ret = 0;
+ struct blk_plug plug;
if (!q)
return -ENXIO;
@@ -82,6 +83,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
bb.flags = 1 << BIO_UPTODATE;
bb.wait = &wait;
+ blk_start_plug(&plug);
while (nr_sects) {
unsigned int req_sects;
sector_t end_sect, tmp;
@@ -120,6 +122,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
atomic_inc(&bb.done);
submit_bio(type, bio);
}
+ blk_finish_plug(&plug);
/* Wait for bios in-flight */
if (!atomic_dec_and_test(&bb.done))