diff mbox series

[RESEND,v3,04/13] blk-mq: Invert check in blk_mq_update_nr_requests()

Message ID 1631545950-56586-5-git-send-email-john.garry@huawei.com
State New
Headers show
Series blk-mq: Reduce static requests memory footprint for shared sbitmap | expand

Commit Message

John Garry Sept. 13, 2021, 3:12 p.m. UTC
It's easier to read:

if (x)
	X;
else
	Y;

over:

if (!x)
	Y;
else
	X;

No functional change intended.

Signed-off-by: John Garry <john.garry@huawei.com>

Reviewed-by: Ming Lei <ming.lei@redhat.com>

---
 block/blk-mq.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.26.2

Comments

Hannes Reinecke Sept. 14, 2021, 5:38 a.m. UTC | #1
On 9/13/21 5:12 PM, John Garry wrote:
> It's easier to read:

> 

> if (x)

> 	X;

> else

> 	Y;

> 

> over:

> 

> if (!x)

> 	Y;

> else

> 	X;

> 

> No functional change intended.

> 

> Signed-off-by: John Garry <john.garry@huawei.com>

> Reviewed-by: Ming Lei <ming.lei@redhat.com>

> ---

>   block/blk-mq.c | 10 +++++-----

>   1 file changed, 5 insertions(+), 5 deletions(-)

> 

Reviewed-by: Hannes Reinecke


Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
diff mbox series

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 1a4bb2db30e5..47d6ab725bcc 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3613,18 +3613,18 @@  int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr)
 		 * If we're using an MQ scheduler, just update the scheduler
 		 * queue depth. This is similar to what the old code would do.
 		 */
-		if (!hctx->sched_tags) {
-			ret = blk_mq_tag_update_depth(hctx, &hctx->tags, nr,
-							false);
-		} else {
+		if (hctx->sched_tags) {
 			ret = blk_mq_tag_update_depth(hctx, &hctx->sched_tags,
-							nr, true);
+						      nr, true);
 			if (blk_mq_is_sbitmap_shared(set->flags)) {
 				hctx->sched_tags->bitmap_tags =
 					&q->sched_bitmap_tags;
 				hctx->sched_tags->breserved_tags =
 					&q->sched_breserved_tags;
 			}
+		} else {
+			ret = blk_mq_tag_update_depth(hctx, &hctx->tags, nr,
+						      false);
 		}
 		if (ret)
 			break;