archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvmet: add plugging for read/write when ns is bdev
@ 2019-10-28 18:23 Chaitanya Kulkarni
  2019-10-28 20:26 ` Sagi Grimberg
  0 siblings, 1 reply; 3+ messages in thread
From: Chaitanya Kulkarni @ 2019-10-28 18:23 UTC (permalink / raw)
  To: linux-nvme; +Cc: kbusch, hch, Chaitanya Kulkarni

From: Christoph Hellwig <>

With reference to the following issue reported on the mailing list :-
this patch adds plugging for the bdev-ns under nvmet_bdev_execute_rw().

We can see the following performance improvement in random write
workload I/Os with the setup described in the link when device_path
configured as /dev/md0.

Without this patch :-

  write: IOPS=40.8k, BW=159MiB/s (167MB/s)(4777MiB/30002msec)
  write: IOPS=41.2k, BW=161MiB/s (169MB/s)(4831MiB/30011msec)
    slat (usec): min=8,  max=10823, avg=15.64,  stdev=16.85
    slat (usec): min=8,  max=401,   avg=15.40,  stdev= 9.56
    clat (usec): min=54, max=2492,  avg=759.07, stdev=172.62
    clat (usec): min=56, max=1997,  avg=768.06, stdev=178.72

With this patch :-

  write: IOPS=123k, BW=480MiB/s (504MB/s)(14.1GiB/30011msec)
  write: IOPS=123k, BW=481MiB/s (504MB/s)(14.1GiB/30002msec)
    slat (usec): min=8,  max=9941,  avg=13.31,  stdev= 8.04
    slat (usec): min=8,  max=289,   avg=13.31,  stdev= 3.37
    clat (usec): min=43, max=17635, avg=245.46, stdev=171.23
    clat (usec): min=44, max=17751, avg=245.25, stdev=183.14

Signed-off-by: Christoph Hellwig <>
Signed-off-by: Chaitanya Kulkarni <>
 drivers/nvme/target/io-cmd-bdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c
index 04a9cd2..07e4f8c 100644
--- a/drivers/nvme/target/io-cmd-bdev.c
+++ b/drivers/nvme/target/io-cmd-bdev.c
@@ -147,6 +147,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
 	int sg_cnt = req->sg_cnt;
 	struct bio *bio;
 	struct scatterlist *sg;
+	struct blk_plug plug;
 	sector_t sector;
 	int op, op_flags = 0, i;
@@ -185,6 +186,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
 	bio->bi_end_io = nvmet_bio_done;
 	bio_set_op_attrs(bio, op, op_flags);
+	blk_start_plug(&plug);
 	for_each_sg(req->sg, sg, req->sg_cnt, i) {
 		while (bio_add_page(bio, sg_page(sg), sg->length, sg->offset)
 				!= sg->length) {
@@ -204,6 +206,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req)
+	blk_finish_plug(&plug);
 static void nvmet_bdev_execute_flush(struct nvmet_req *req)

Linux-nvme mailing list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-28 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 18:23 [PATCH] nvmet: add plugging for read/write when ns is bdev Chaitanya Kulkarni
2019-10-28 20:26 ` Sagi Grimberg
2019-10-28 23:51   ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).