aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShaohua Li2012-12-13 21:15:51 -0600
committerJens Axboe2012-12-14 13:46:04 -0600
commit0cfbcafcae8b7364b5fa96c2b26ccde7a3a296a9 (patch)
treedc6601c000fc21c80db3f6861ac117359649429a /block/blk-lib.c
parent8dd2cb7e880d2f77fba53b523c99133ad5054cfd (diff)
downloadkernel-common-0cfbcafcae8b7364b5fa96c2b26ccde7a3a296a9.tar.gz
kernel-common-0cfbcafcae8b7364b5fa96c2b26ccde7a3a296a9.tar.xz
kernel-common-0cfbcafcae8b7364b5fa96c2b26ccde7a3a296a9.zip
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>
Diffstat (limited to 'block/blk-lib.c')
-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 5677fd33d7d..b3a1f2b70b3 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,
48 struct bio_batch bb; 48 struct bio_batch bb;
49 struct bio *bio; 49 struct bio *bio;
50 int ret = 0; 50 int ret = 0;
51 struct blk_plug plug;
51 52
52 if (!q) 53 if (!q)
53 return -ENXIO; 54 return -ENXIO;
@@ -82,6 +83,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
82 bb.flags = 1 << BIO_UPTODATE; 83 bb.flags = 1 << BIO_UPTODATE;
83 bb.wait = &wait; 84 bb.wait = &wait;
84 85
86 blk_start_plug(&plug);
85 while (nr_sects) { 87 while (nr_sects) {
86 unsigned int req_sects; 88 unsigned int req_sects;
87 sector_t end_sect, tmp; 89 sector_t end_sect, tmp;
@@ -120,6 +122,7 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
120 atomic_inc(&bb.done); 122 atomic_inc(&bb.done);
121 submit_bio(type, bio); 123 submit_bio(type, bio);
122 } 124 }
125 blk_finish_plug(&plug);
123 126
124 /* Wait for bios in-flight */ 127 /* Wait for bios in-flight */
125 if (!atomic_dec_and_test(&bb.done)) 128 if (!atomic_dec_and_test(&bb.done))