Re: [RFC PATCH 1/2] fs: introduce FALLOC_FL_FORCE_ZERO to fallocate

From: Zhang Yi
Date: Tue Jan 07 2025 - 20:21:54 EST


On 2025/1/8 0:42, Christoph Hellwig wrote:
> On Tue, Jan 07, 2025 at 10:05:47PM +0800, Zhang Yi wrote:
>> Sorry. the "pure overwrites" and "always-cow files" makes me confused,
>> this is mainly used to create a new written file range, but also could
>> be used to zero out an existing range, why you mentioned it exists to
>> facilitate pure overwrites?
>
> If you're fine with writes to your file causing block allocations you
> can already use the hole punch or preallocate fallocate modes. No
> need to actually send a command to the device.
>

Okay, I misunderstood your point earlier. This is indeed prepared for
subsequent overwrites. Thanks a lot for explaining.

Thanks,
Yi.

>>
>> For the "always-cow files", do you mean reflinked files? Could you
>> please give more details?
>
> reflinked files will require out of place writes for shared blocks.
> As will anything on device mapper snapshots. Or any file on
> file systems that write out of place (btrfs, f2fs, nilfs2, the
> upcoming zoned xfs mode).
>