From: Ming Lei <tom.leiming@gmail.com>
To: Caleb Sander Mateos <csander@purestorage.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ublk: optimize ublk_rq_has_data()
Date: Wed, 22 Apr 2026 07:51:27 +0800 [thread overview]
Message-ID: <aegNf5C5-0ccxBPp@fedora> (raw)
In-Reply-To: <20260421194744.1524637-1-csander@purestorage.com>
On Tue, Apr 21, 2026 at 01:47:42PM -0600, Caleb Sander Mateos wrote:
> ublk_rq_has_data() currently uses bio_has_data(), which involves 2
> indirections and several branches. Use blk_rq_bytes() instead, which
> performs a single indirection with no branches.
>
> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
> ---
> drivers/block/ublk_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
> index ef8a0705e68b..5f9b3c3876f4 100644
> --- a/drivers/block/ublk_drv.c
> +++ b/drivers/block/ublk_drv.c
> @@ -1172,11 +1172,11 @@ static inline struct ublk_queue *ublk_get_queue(struct ublk_device *dev,
> return dev->queues[qid];
> }
>
> static inline bool ublk_rq_has_data(const struct request *rq)
> {
> - return bio_has_data(rq->bio);
> + return blk_rq_bytes(rq);
> }
blk_rq_bytes() doesn't return the actual payload data bytes, such as,
discard command, but bio_has_data() does.
thanks,
Ming
next prev parent reply other threads:[~2026-04-21 23:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 19:47 [PATCH] ublk: optimize ublk_rq_has_data() Caleb Sander Mateos
2026-04-21 23:51 ` Ming Lei [this message]
2026-04-22 0:31 ` Caleb Sander Mateos
2026-04-22 16:25 ` Ming Lei
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=aegNf5C5-0ccxBPp@fedora \
--to=tom.leiming@gmail.com \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@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