[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ac5dda5-9681-6b6f-7a84-55215578f0c3@fujitsu.com>
Date: Fri, 27 Aug 2021 11:23:47 +0800
From: Shiyang Ruan <ruansy.fnst@...itsu.com>
To: Dan Williams <dan.j.williams@...el.com>
CC: "Darrick J. Wong" <djwong@...nel.org>,
Christoph Hellwig <hch@....de>,
linux-xfs <linux-xfs@...r.kernel.org>,
david <david@...morbit.com>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux NVDIMM <nvdimm@...ts.linux.dev>,
Goldwyn Rodrigues <rgoldwyn@...e.de>,
Al Viro <viro@...iv.linux.org.uk>,
Matthew Wilcox <willy@...radead.org>,
Ritesh Harjani <riteshh@...ux.ibm.com>
Subject: Re: [PATCH v7 4/8] fsdax: Add dax_iomap_cow_copy() for dax_iomap_zero
On 2021/8/20 10:39, Dan Williams wrote:
> On Sun, Aug 15, 2021 at 11:04 PM Shiyang Ruan <ruansy.fnst@...itsu.com> wrote:
>>
>> Punch hole on a reflinked file needs dax_iomap_cow_copy() too.
>> Otherwise, data in not aligned area will be not correct. So, add the
>> srcmap to dax_iomap_zero() and replace memset() as dax_iomap_cow_copy().
>>
>> Signed-off-by: Shiyang Ruan <ruansy.fnst@...itsu.com>
>> Reviewed-by: Ritesh Harjani <riteshh@...ux.ibm.com>
>> Reviewed-by: Darrick J. Wong <djwong@...nel.org>
>> ---
>> fs/dax.c | 25 +++++++++++++++----------
>> fs/iomap/buffered-io.c | 4 ++--
>> include/linux/dax.h | 3 ++-
>> 3 files changed, 19 insertions(+), 13 deletions(-)
>>
>> diff --git a/fs/dax.c b/fs/dax.c
>> index e49ba68cc7e4..91ceb518f66a 100644
>> --- a/fs/dax.c
>> +++ b/fs/dax.c
>> @@ -1198,7 +1198,8 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf,
>> }
>> #endif /* CONFIG_FS_DAX_PMD */
>>
>> -s64 dax_iomap_zero(loff_t pos, u64 length, struct iomap *iomap)
>> +s64 dax_iomap_zero(loff_t pos, u64 length, const struct iomap *iomap,
>> + const struct iomap *srcmap)
>> {
>> sector_t sector = iomap_sector(iomap, pos & PAGE_MASK);
>> pgoff_t pgoff;
>> @@ -1220,19 +1221,23 @@ s64 dax_iomap_zero(loff_t pos, u64 length, struct iomap *iomap)
>>
>> if (page_aligned)
>> rc = dax_zero_page_range(iomap->dax_dev, pgoff, 1);
>> - else
>> + else {
>> rc = dax_direct_access(iomap->dax_dev, pgoff, 1, &kaddr, NULL);
>> - if (rc < 0) {
>> - dax_read_unlock(id);
>> - return rc;
>> - }
>> -
>> - if (!page_aligned) {
>> - memset(kaddr + offset, 0, size);
>> + if (rc < 0)
>> + goto out;
>> + if (iomap->addr != srcmap->addr) {
>> + rc = dax_iomap_cow_copy(pos, size, PAGE_SIZE, srcmap,
>> + kaddr);
>
> Apologies, I'm confused, why is it ok to skip zeroing here?
>
That was a mistake. Will be fixed in next version.
--
Thanks,
Ruan.
Powered by blists - more mailing lists