Linux Device Mapper development
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: dm-devel@redhat.com, Mike Snitzer <snitzer@redhat.com>,
	Jens Axboe <axboe@fb.com>
Cc: linux-block@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Bart Van Assche <bart.vanassche@sandisk.com>,
	Laurence Oberman <loberman@redhat.com>,
	Ming Lei <ming.lei@redhat.com>
Subject: [PATCH 4/5] block: export blk_update_nr_requests
Date: Sat, 16 Sep 2017 00:44:55 +0800	[thread overview]
Message-ID: <20170915164456.9803-5-ming.lei@redhat.com> (raw)
In-Reply-To: <20170915164456.9803-1-ming.lei@redhat.com>

dm-mpath need this API for improving IO scheduling.

The IO schedule is actually done on dm-rq(mpath) queue,
instead of underlying devices.

If we set q->nr_requests as q->queue_depth on underlying
devices, we can get the queue's busy feedback by simply
checking if blk_get_request() returns successfully.

This way will make block layer's I/O schedule more
effective on dm-rq device.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-core.c       | 4 +++-
 block/blk-sysfs.c      | 5 +----
 block/blk.h            | 2 --
 include/linux/blkdev.h | 1 +
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index aebe676225e6..9752aac9821c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1108,7 +1108,8 @@ int blk_update_nr_requests(struct request_queue *q, unsigned int nr)
 	struct request_list *rl;
 	int on_thresh, off_thresh;
 
-	WARN_ON_ONCE(q->mq_ops);
+	if (q->mq_ops)
+		return blk_mq_update_nr_requests(q, nr);
 
 	spin_lock_irq(q->queue_lock);
 	q->nr_requests = nr;
@@ -1145,6 +1146,7 @@ int blk_update_nr_requests(struct request_queue *q, unsigned int nr)
 	spin_unlock_irq(q->queue_lock);
 	return 0;
 }
+EXPORT_SYMBOL(blk_update_nr_requests);
 
 /**
  * __get_request - get a free request
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index b8362c0df51d..2dbef5dbd195 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -77,10 +77,7 @@ queue_requests_store(struct request_queue *q, const char *page, size_t count)
 	if (nr < BLKDEV_MIN_RQ)
 		nr = BLKDEV_MIN_RQ;
 
-	if (q->request_fn)
-		err = blk_update_nr_requests(q, nr);
-	else
-		err = blk_mq_update_nr_requests(q, nr);
+	err = blk_update_nr_requests(q, nr);
 
 	if (err)
 		return err;
diff --git a/block/blk.h b/block/blk.h
index fa4f232afc18..5bf662da2417 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -308,8 +308,6 @@ static inline int queue_congestion_off_threshold(struct request_queue *q)
 	return q->nr_congestion_off;
 }
 
-extern int blk_update_nr_requests(struct request_queue *, unsigned int);
-
 /*
  * Contribute to IO statistics IFF:
  *
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 460294bb0fa5..226b97142999 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1229,6 +1229,7 @@ struct request_queue *blk_alloc_queue(gfp_t);
 struct request_queue *blk_alloc_queue_node(gfp_t, int);
 extern void blk_put_queue(struct request_queue *);
 extern void blk_set_queue_dying(struct request_queue *);
+extern int blk_update_nr_requests(struct request_queue *, unsigned int);
 
 /*
  * block layer runtime pm functions
-- 
2.9.5

  parent reply	other threads:[~2017-09-15 16:44 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15 16:44 [PATCH 0/5] dm-mpath: improve I/O schedule Ming Lei
2017-09-15 16:44 ` [PATCH 1/5] block: don't call blk_mq_delay_run_hw_queue() in case of BLK_STS_RESOURCE Ming Lei
2017-09-15 17:57   ` Bart Van Assche
2017-09-17 12:40     ` Ming Lei
2017-09-18 15:18       ` Bart Van Assche
2017-09-19  5:43         ` Ming Lei
2017-09-19 15:36           ` Bart Van Assche
2017-09-19 15:56             ` Mike Snitzer
2017-09-19 16:04               ` Ming Lei
2017-09-19 16:49                 ` Bart Van Assche
2017-09-19 16:55                   ` Ming Lei
2017-09-19 18:42                     ` Bart Van Assche
2017-09-19 22:44                       ` Ming Lei
2017-09-19 23:25                         ` Bart Van Assche
2017-09-19 23:50                           ` Mike Snitzer
2017-09-20  1:13                             ` Ming Lei
2017-09-20  1:19                   ` Ming Lei
2017-09-19 15:48           ` Mike Snitzer
2017-09-19 15:52             ` Bart Van Assche
2017-09-19 16:03               ` Mike Snitzer
2017-09-19 16:07             ` Ming Lei
2017-09-15 16:44 ` [PATCH 2/5] dm-mpath: return DM_MAPIO_REQUEUE in case of rq allocation failure Ming Lei
2017-09-15 17:29   ` Bart Van Assche
2017-09-15 20:06     ` Mike Snitzer
2017-09-15 20:48       ` Bart Van Assche
2017-09-17 13:23       ` Ming Lei
2017-09-19 14:41         ` Mike Snitzer
2017-09-19 15:56           ` Ming Lei
2017-09-17 12:51     ` Ming Lei
2017-09-15 16:44 ` [PATCH 3/5] dm-mpath: remove annoying message of 'blk_get_request() returned -11' Ming Lei
2017-09-15 16:44 ` Ming Lei [this message]
2017-09-15 16:44 ` [PATCH 5/5] dm-mpath: improve I/O schedule Ming Lei
2017-09-15 20:10   ` Mike Snitzer
2017-09-15 20:56   ` Bart Van Assche
2017-09-15 21:06   ` Bart Van Assche
2017-09-15 21:42   ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170915164456.9803-5-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=axboe@fb.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=dm-devel@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=snitzer@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox