[1/2] block: avoid setting nr_requests to current value
diff mbox series

Message ID 20190222130735.10669-2-kai.heng.feng@canonical.com
State New
Headers show
Series
  • [1/2] block: avoid setting nr_requests to current value
Related show

Commit Message

Kai-Heng Feng Feb. 22, 2019, 1:07 p.m. UTC
From: Aleksei Zakharov <zakharov.a.g@yandex.ru>

BugLink: https://bugs.launchpad.net/bugs/1815733

There's no reason to freeze queue and set nr_requests value
if current value is the same.

Signed-off-by: Aleksei Zakharov <zakharov.a.g@yandex.ru>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
(cherry picked from commit e5fa81408fb43ebabde65938ef8b20ae879017e7 linux-next)
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 block/blk-mq.c | 3 +++
 1 file changed, 3 insertions(+)

Patch
diff mbox series

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 9437a5eb07cf..b9c420277b63 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3090,6 +3090,9 @@  int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
 	if (!set)
 		return -EINVAL;
 
+	if (q->nr_requests == nr)
+		return 0;
+
 	blk_mq_freeze_queue(q);
 	blk_mq_quiesce_queue(q);