[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sat, 11 Nov 2023 12:02:47 +0800
From: Gao Xiang <hsiangkao@...ux.alibaba.com>
To: Matthew Wilcox <willy@...radead.org>,
Andreas Gruenbacher <agruenba@...hat.com>
Cc: linux-xfs@...r.kernel.org, Theodore Ts'o <tytso@....edu>,
"Darrick J . Wong" <djwong@...nel.org>, gfs2@...ts.linux.dev,
Andreas Dilger <adilger.kernel@...ger.ca>, linux-fsdevel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>, linux-ext4@...r.kernel.org,
linux-erofs@...ts.ozlabs.org
Subject: Re: [PATCH 2/3] mm: Add folio_fill_tail() and use it in iomap
On 2023/11/11 01:09, Matthew Wilcox wrote:
> On Thu, Nov 09, 2023 at 10:50:45PM +0100, Andreas Gruenbacher wrote:
>> On Tue, Nov 7, 2023 at 10:27 PM Matthew Wilcox (Oracle)
>> <willy@...radead.org> wrote:
>>> +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);
>>> + to = folio_zero_tail(folio, offset, to);
>>
>> This needs to be:
>>
>> to = folio_zero_tail(folio, offset + len, to + len);
>
> Oh, wow, that was stupid of me. I only ran an xfstests against ext4,
> which doesn't exercise this code, not gfs2 or erofs. Thanks for
> fixing this up.
Assuming that is for the next cycle (no rush), I will also test
this patch and feedback later since I'm now working on other
stuffs.
Thanks,
Gao Xiang
Powered by blists - more mailing lists