All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2]block: add plug for blkdev_issue_discard
@ 2012-12-14  3:15 Shaohua Li
  0 siblings, 0 replies; only message in thread
From: Shaohua Li @ 2012-12-14  3:15 UTC (permalink / raw)
  To: axboe; +Cc: neilb, linux-kernel

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>
---
 block/blk-lib.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux/block/blk-lib.c
===================================================================
--- linux.orig/block/blk-lib.c	2012-12-14 10:03:22.305422686 +0800
+++ linux/block/blk-lib.c	2012-12-14 10:08:50.577295672 +0800
@@ -48,6 +48,7 @@ int blkdev_issue_discard(struct block_de
 	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_de
 	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_de
 		atomic_inc(&bb.done);
 		submit_bio(type, bio);
 	}
+	blk_finish_plug(&plug);
 
 	/* Wait for bios in-flight */
 	if (!atomic_dec_and_test(&bb.done))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-12-14  3:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-14  3:15 [patch 2/2]block: add plug for blkdev_issue_discard Shaohua Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.