From: Christoph Hellwig <hch@lst.de>
To: Keith Busch <kbusch@meta.com>
Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
hch@lst.de, axboe@kernel.dk, Keith Busch <kbusch@kernel.org>
Subject: Re: [PATCHv2 1/2] block: accumulate segment page gaps per bio
Date: Sun, 10 Aug 2025 16:55:09 +0200 [thread overview]
Message-ID: <20250810145509.GA5444@lst.de> (raw)
In-Reply-To: <20250806145136.3573196-2-kbusch@meta.com>
On Wed, Aug 06, 2025 at 07:51:35AM -0700, Keith Busch wrote:
> +static inline unsigned int bvec_seg_gap(struct bio_vec bv, struct bio_vec bp)
> +{
> + return bv.bv_offset | ((bp.bv_offset + bp.bv_len) & (PAGE_SIZE - 1));
> +}
Can you just pass a pointer to the bio_vec even if the compiler
is probably optimizing away the function either way?
Also bp is a bit of an odd name for a bio_vec. Note that bvprv flows
well, but it is what the caller uses, so mahybe stick to it?
> /* the following two fields are internal, NEVER access directly */
> unsigned int __data_len; /* total data len */
> + unsigned int __page_gaps; /* a mask of all the segment gaps */
> sector_t __sector; /* sector cursor */
>
> struct bio *bio;
> @@ -1080,6 +1081,11 @@ static inline sector_t blk_rq_pos(const struct request *rq)
> return rq->__sector;
> }
>
> +static inline unsigned int blk_rq_page_gaps(const struct request *rq)
> +{
> + return rq->__page_gaps;
> +}
I don't think we really need the __ and the access helper here. This was
mostly done for fields where historically drivers accessed the field
directly, but it subtly changed semantics making these direct accesses
unsafe.
next prev parent reply other threads:[~2025-08-10 14:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 14:51 [PATCHv2 0/2] block: replace reliance on virt boundary Keith Busch
2025-08-06 14:51 ` [PATCHv2 1/2] block: accumulate segment page gaps per bio Keith Busch
2025-08-10 14:55 ` Christoph Hellwig [this message]
2025-08-06 14:51 ` [PATCHv2 2/2] nvme: remove virtual boundary for sgl capable devices Keith Busch
2025-08-10 14:59 ` Christoph Hellwig
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=20250810145509.GA5444@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=kbusch@kernel.org \
--cc=kbusch@meta.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).