From: Christoph Hellwig <hch@lst.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
linux-m68k@lists.linux-m68k.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 2/2] block: add a bvec_phys helper
Date: Fri, 5 Jul 2024 13:22:30 +0200 [thread overview]
Message-ID: <20240705112230.GA28636@lst.de> (raw)
In-Reply-To: <CAMuHMdWmqRq2oBtgY0w1ZPcCchqBm7pmsWBGmqQhAPK6V-Tz7g@mail.gmail.com>
On Fri, Jul 05, 2024 at 10:50:31AM +0200, Geert Uytterhoeven wrote:
> > + seg_size = get_max_segment_size(lim, bvec_phys(bv) + total_len);
> > seg_size = min(seg_size, len);
> >
> > (*nsegs)++;
> > @@ -492,8 +491,7 @@ static unsigned blk_bvec_map_sg(struct request_queue *q,
> > while (nbytes > 0) {
> > unsigned offset = bvec->bv_offset + total;
> > unsigned len = min(get_max_segment_size(&q->limits,
> > - page_to_phys(bvec->bv_page) + offset),
> > - nbytes);
> > + bvec_phys(bvec) + total), nbytes);
> > struct page *page = bvec->bv_page;
> >
> > /*
>
> If you would have introduce bvec_phys() first, you could fold the above
> two hunks into [PATCH 1/2].
Not sure what the advantage of that is, though?
> Which suggests this is arch-specific, and may not always be defined
> the same? I checked a few (but not all) that seem to differ from the
> above at first sight, but end up doing the same...
>
> I think it would be good to make sure they are identical, and if
> they are, move them to a common place first, to any subtle breakages.
It fundamentally is a wrapper around page_to_pfn that converts from
the PFN to the full physical address. There a bunch of weird
incosnsitencies and it should really move to common code, but I don't
want this series to depend on that. The only interesting part is
that for architectures with physical addresses larger than unsigned long
we need to cast to a 64-bit type, although all the architectures that
actually do that in the page_to_phys helper itself do that incorrectly
by casting to a dma_addr_t instdead of a phys_addr_t. Fortunately we've
stopped supporting a dma_addr_t smaller than phys_addr_t a long time ago,
and even back then that only affected sparc (IIRC).
next prev parent reply other threads:[~2024-07-05 11:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-05 8:14 add a bvec_phys helper Christoph Hellwig
2024-07-05 8:14 ` [PATCH 1/2] block: pass a phys_addr_t to get_max_segment_size Christoph Hellwig
2024-07-05 8:41 ` Geert Uytterhoeven
2024-07-05 8:14 ` [PATCH 2/2] block: add a bvec_phys helper Christoph Hellwig
2024-07-05 8:50 ` Geert Uytterhoeven
2024-07-05 11:22 ` Christoph Hellwig [this message]
2024-07-05 11:30 ` Geert Uytterhoeven
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=20240705112230.GA28636@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=geert@linux-m68k.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.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