[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4dad0661-fad4-cac3-ffcc-0485ae62b823@huaweicloud.com>
Date: Mon, 3 Jun 2024 21:23:52 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: linux-xfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, djwong@...nel.org, brauner@...nel.org,
david@...morbit.com, chandanbabu@...nel.org, jack@...e.cz,
willy@...radead.org, yi.zhang@...wei.com, chengzhihao1@...wei.com,
yukuai3@...wei.com
Subject: Re: [RFC PATCH v4 3/8] iomap: pass blocksize to iomap_truncate_page()
On 2024/5/31 20:39, Christoph Hellwig wrote:
>> - const struct iomap_ops *ops)
>> +iomap_truncate_page(struct inode *inode, loff_t pos, unsigned int blocksize,
>> + bool *did_zero, const struct iomap_ops *ops)
>> {
>> - unsigned int blocksize = i_blocksize(inode);
>> - unsigned int off = pos & (blocksize - 1);
>> + unsigned int off = rem_u64(pos, blocksize);
>>
>> /* Block boundary? Nothing to do */
>> if (!off)
>
> Instad of passing yet another argument here, can we just kill
> iomap_truncate_page?
>
> I.e. just open code the rem_u64 and 0 offset check in the only caller
> and call iomap_zero_range. Same for the DAX variant and it's two
> callers.
>
Yeah, we could drop iomap_truncate_page() and dax_truncate_page(), but
that means we have to open code the zeroing length calculation or add a
fs private helper to do that in every filesystems. Now we only have xfs
and ext2 two caller, so it looks fine, but if the caller becomes more in
the future, this could becomes repetitive, if we keep them, all
filesystems could don't pay attention to these details.
Thanks,
Yi.
Powered by blists - more mailing lists