Linux block layer
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Bart Van Assche <bvanassche@acm.org>, Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v2 2/3] blk-mq: Move more error handling into blk_mq_submit_bio()
Date: Tue, 17 Dec 2024 15:37:37 -0800	[thread overview]
Message-ID: <9c0b2f84-2562-48fb-98e8-343d68eb792d@kernel.org> (raw)
In-Reply-To: <20241217223809.683035-3-bvanassche@acm.org>

On 2024/12/17 14:38, Bart Van Assche wrote:
> The error handling code in blk_mq_get_new_requests() cannot be understood
> without knowing that this function is only called by blk_mq_submit_bio().
> Hence move the code for handling blk_mq_get_new_requests() failures into
> blk_mq_submit_bio().
> 
> Cc: Damien Le Moal <dlemoal@kernel.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  block/blk-mq.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 8d2aab4d9ba9..f4300e608ed8 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -2968,12 +2968,9 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
>  	}
>  
>  	rq = __blk_mq_alloc_requests(&data);
> -	if (rq)
> -		return rq;
> -	rq_qos_cleanup(q, bio);
> -	if (bio->bi_opf & REQ_NOWAIT)
> -		bio_wouldblock_error(bio);
> -	return NULL;
> +	if (!rq)

No unlikely() here ?

> +		rq_qos_cleanup(q, bio);
> +	return rq;
>  }
>  
>  /*
> @@ -3106,8 +3103,11 @@ void blk_mq_submit_bio(struct bio *bio)
>  		blk_mq_use_cached_rq(rq, plug, bio);
>  	} else {
>  		rq = blk_mq_get_new_requests(q, plug, bio, nr_segs);
> -		if (unlikely(!rq))
> +		if (unlikely(!rq)) {
> +			if (bio->bi_opf & REQ_NOWAIT)
> +				bio_wouldblock_error(bio);
>  			goto queue_exit;
> +		}
>  	}
>  
>  	trace_block_getrq(bio);


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2024-12-17 23:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17 22:38 [PATCH v2 0/3] Three blk_mq_submit_bio() patches Bart Van Assche
2024-12-17 22:38 ` [PATCH v2 1/3] block: Optimize blk_mq_submit_bio() for the cache hit scenario Bart Van Assche
2024-12-17 23:36   ` Damien Le Moal
2024-12-17 22:38 ` [PATCH v2 2/3] blk-mq: Move more error handling into blk_mq_submit_bio() Bart Van Assche
2024-12-17 23:37   ` Damien Le Moal [this message]
2024-12-18 17:35     ` Bart Van Assche
2024-12-17 22:38 ` [PATCH v2 3/3] blk-zoned: " Bart Van Assche
2024-12-17 23:47   ` Damien Le Moal
2024-12-18 18:21     ` 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=9c0b2f84-2562-48fb-98e8-343d68eb792d@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /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