[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0eda581-ae6c-4b49-8b4f-7bb039b17487@huaweicloud.com>
Date: Fri, 15 Aug 2025 17:29:19 +0800
From: Zhang Yi <yi.zhang@...weicloud.com>
To: "Darrick J. Wong" <djwong@...nel.org>
Cc: linux-fsdevel@...r.kernel.org, linux-block@...r.kernel.org,
dm-devel@...ts.linux.dev, linux-nvme@...ts.infradead.org,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-api@...r.kernel.org, hch@....de, tytso@....edu, bmarzins@...hat.com,
chaitanyak@...dia.com, shinichiro.kawasaki@....com, brauner@...nel.org,
martin.petersen@...cle.com, yi.zhang@...wei.com, chengzhihao1@...wei.com,
yukuai3@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH util-linux v2] fallocate: add FALLOC_FL_WRITE_ZEROES
support
Thank you for your review comments!
On 2025/8/15 0:52, Darrick J. Wong wrote:
> On Wed, Aug 13, 2025 at 10:40:15AM +0800, Zhang Yi wrote:
>> From: Zhang Yi <yi.zhang@...wei.com>
>>
>> The Linux kernel (since version 6.17) supports FALLOC_FL_WRITE_ZEROES in
>> fallocate(2). Add support for FALLOC_FL_WRITE_ZEROES to the fallocate
>> utility by introducing a new option -w|--write-zeroes.
>>
>> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=278c7d9b5e0c
>> Signed-off-by: Zhang Yi <yi.zhang@...wei.com>
>> ---
>> v1->v2:
>> - Minor description modification to align with the kernel.
>>
>> sys-utils/fallocate.1.adoc | 11 +++++++++--
>> sys-utils/fallocate.c | 20 ++++++++++++++++----
>> 2 files changed, 25 insertions(+), 6 deletions(-)
>>
>> diff --git a/sys-utils/fallocate.1.adoc b/sys-utils/fallocate.1.adoc
>> index 44ee0ef4c..0ec9ff9a9 100644
>> --- a/sys-utils/fallocate.1.adoc
>> +++ b/sys-utils/fallocate.1.adoc
>> @@ -12,7 +12,7 @@ fallocate - preallocate or deallocate space to a file
>
> <snip all the long lines>
>
>> +*-w*, *--write-zeroes*::
>> +Zeroes space in the byte range starting at _offset_ and continuing
>> for _length_ bytes. Within the specified range, blocks are
>> preallocated for the regions that span the holes in the file. After a
>> successful call, subsequent reads from this range will return zeroes,
>> subsequent writes to that range do not require further changes to the
>> file mapping metadata.
>
> "...will return zeroes and subsequent writes to that range..." ?
>
Yeah.
>> ++
>> +Zeroing is done within the filesystem by preferably submitting write
>
> I think we should say less about what the filesystem actually does to
> preserve some flexibility:
>
> "Zeroing is done within the filesystem. The filesystem may use a
> hardware accelerated zeroing command, or it may submit regular writes.
> The behavior depends on the filesystem design and available hardware."
>
Sure.
>> zeores commands, the alternative way is submitting actual zeroed data,
>> the specified range will be converted into written extents. The write
>> zeroes command is typically faster than write actual data if the
>> device supports unmap write zeroes, the specified range will not be
>> physically zeroed out on the device.
>> ++
>> +Options *--keep-size* can not be specified for the write-zeroes
>> operation.
>> +
>> include::man-common/help-version.adoc[]
>>
>> == AUTHORS
[..]
>> @@ -429,6 +438,9 @@ int main(int argc, char **argv)
>> else if (mode & FALLOC_FL_ZERO_RANGE)
>> fprintf(stdout, _("%s: %s (%ju bytes) zeroed.\n"),
>> filename, str, length);
>> + else if (mode & FALLOC_FL_WRITE_ZEROES)
>> + fprintf(stdout, _("%s: %s (%ju bytes) write zeroed.\n"),
>
> "write zeroed" is a little strange, but I don't have a better
> suggestion. :)
>
Hmm... What about simply using "zeroed", the same to FALLOC_FL_ZERO_RANGE?
Users should be aware of the parameters they have passed to fallocate(),
so they should not use this print for further differentiation.
Thanks,
Yi.
Powered by blists - more mailing lists