From: Andrew Morton <akpm@linux-foundation.org>
To: "Andreas Grünbacher" <andreas.gruenbacher@gmail.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
linux-ext4 <linux-ext4@vger.kernel.org>,
gfs2@lists.linux.dev,
Linux FS-devel Mailing List <linux-fsdevel@vger.kernel.org>,
linux-xfs <linux-xfs@vger.kernel.org>,
"Darrick J . Wong" <djwong@kernel.org>,
linux-erofs@lists.ozlabs.org, "Theodore Ts'o" <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Andreas Gruenbacher <agruenba@redhat.com>
Subject: Re: [PATCH 1/3] mm: Add folio_zero_tail() and use it in ext4
Date: Thu, 9 Nov 2023 09:27:11 -0800 [thread overview]
Message-ID: <20231109092711.cf73f30a2fa84d4400377839@linux-foundation.org> (raw)
In-Reply-To: <CAHpGcMLU9CeX=P=718Gp=oYNnfbft_Mh1Nhdx45qWXY0DAf6Mg@mail.gmail.com>
On Thu, 9 Nov 2023 01:12:15 +0100 Andreas Grünbacher <andreas.gruenbacher@gmail.com> wrote:
> Andrew,
>
> Andrew Morton <akpm@linux-foundation.org> schrieb am Do., 9. Nov. 2023, 00:06:
> > > +
> > > + if (folio_test_highmem(folio)) {
> > > + size_t max = PAGE_SIZE - offset_in_page(offset);
> > > +
> > > + while (len > max) {
> >
> > Shouldn't this be `while (len)'? AFAICT this code can fail to clear
> > the final page.
>
> not sure what you're seeing there, but this looks fine to me.
I was right! This code does fail to handle the final page.
: static inline void folio_fill_tail(struct folio *folio, size_t offset,
: const char *from, size_t len)
: {
: char *to = kmap_local_folio(folio, offset);
:
: VM_BUG_ON(offset + len > folio_size(folio));
:
: if (folio_test_highmem(folio)) {
: size_t max = PAGE_SIZE - offset_in_page(offset);
:
: while (len > max) {
: memcpy(to, from, max);
: kunmap_local(to);
: len -= max;
: from += max;
: offset += max;
: max = PAGE_SIZE;
: to = kmap_local_folio(folio, offset);
: }
: }
:
: memcpy(to, from, len);
This code down here handles it, doh.
: to = folio_zero_tail(folio, offset, to);
: kunmap_local(to);
: }
Implementation seems less straightforward than it might be? Oh well.
Has it been runtime tested?
Anyway, let's please change the function argument ordering and remember
to cc linux-mm on v2?
next prev parent reply other threads:[~2023-11-09 17:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-07 21:26 [PATCH 0/3] Add folio_zero_tail() and folio_fill_tail() Matthew Wilcox (Oracle)
2023-11-07 21:26 ` [PATCH 1/3] mm: Add folio_zero_tail() and use it in ext4 Matthew Wilcox (Oracle)
2023-11-08 23:06 ` Andrew Morton
2023-11-09 0:12 ` Andreas Grünbacher
2023-11-09 17:27 ` Andrew Morton [this message]
2023-11-09 17:37 ` Matthew Wilcox
2023-11-09 21:50 ` Andreas Gruenbacher
2023-11-07 21:26 ` [PATCH 2/3] mm: Add folio_fill_tail() and use it in iomap Matthew Wilcox (Oracle)
2023-11-09 21:50 ` Andreas Gruenbacher
2023-11-10 17:09 ` Matthew Wilcox
2023-11-10 17:50 ` Andreas Grünbacher
2023-11-11 4:02 ` Gao Xiang
2023-11-07 21:26 ` [PATCH 3/3] gfs2: Convert stuffed_readpage() to stuffed_read_folio() Matthew Wilcox (Oracle)
2023-11-09 21:52 ` Andreas Gruenbacher
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=20231109092711.cf73f30a2fa84d4400377839@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=adilger.kernel@dilger.ca \
--cc=agruenba@redhat.com \
--cc=andreas.gruenbacher@gmail.com \
--cc=djwong@kernel.org \
--cc=gfs2@lists.linux.dev \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=willy@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