All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: avoid clearing blk_mq_alloc_data unnecessarily
@ 2021-12-03 15:48 Jens Axboe
  2021-12-06  6:59 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2021-12-03 15:48 UTC (permalink / raw)
  To: linux-block

We already set almost all of what we need here, just the non-plug
path needs to set nr_tags and clear cached.

Signed-off-by: Jens Axboe <axboe@kernel.dk>

---

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4dc0837f874d..eba34af1c5eb 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2664,7 +2664,7 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
 {
 	struct blk_mq_alloc_data data = {
 		.q		= q,
-		.nr_tags	= 1,
+		.shallow_depth	= 0
 	};
 	struct request *rq;
 
@@ -2683,6 +2683,9 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
 		data.nr_tags = plug->nr_ios;
 		plug->nr_ios = 1;
 		data.cached_rq = &plug->cached_rq;
+	} else {
+		data.nr_tags = 1;
+		data.cached_rq = NULL;
 	}
 
 	rq = __blk_mq_alloc_requests(&data);

-- 
Jens Axboe


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

* Re: [PATCH] block: avoid clearing blk_mq_alloc_data unnecessarily
  2021-12-03 15:48 [PATCH] block: avoid clearing blk_mq_alloc_data unnecessarily Jens Axboe
@ 2021-12-06  6:59 ` Christoph Hellwig
  2021-12-06 16:34   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2021-12-06  6:59 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block

On Fri, Dec 03, 2021 at 08:48:09AM -0700, Jens Axboe wrote:
> We already set almost all of what we need here, just the non-plug
> path needs to set nr_tags and clear cached.

How does this avoid clearing?  All partial initializers zero the rest of
the structure.

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

* Re: [PATCH] block: avoid clearing blk_mq_alloc_data unnecessarily
  2021-12-06  6:59 ` Christoph Hellwig
@ 2021-12-06 16:34   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-12-06 16:34 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-block

On 12/5/21 11:59 PM, Christoph Hellwig wrote:
> On Fri, Dec 03, 2021 at 08:48:09AM -0700, Jens Axboe wrote:
>> We already set almost all of what we need here, just the non-plug
>> path needs to set nr_tags and clear cached.
> 
> How does this avoid clearing?  All partial initializers zero the rest of
> the structure.

Yep this is garbage, I'll just drop it.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-12-06 16:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-03 15:48 [PATCH] block: avoid clearing blk_mq_alloc_data unnecessarily Jens Axboe
2021-12-06  6:59 ` Christoph Hellwig
2021-12-06 16:34   ` Jens Axboe

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.