From: Christoph Hellwig <hch@lst.de>
To: Zhang Yi <yi.zhang@huaweicloud.com>
Cc: Christoph Hellwig <hch@lst.de>,
"Darrick J. Wong" <djwong@kernel.org>,
linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-block@vger.kernel.org, dm-devel@lists.linux.dev,
linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
tytso@mit.edu, john.g.garry@oracle.com, bmarzins@redhat.com,
chaitanyak@nvidia.com, shinichiro.kawasaki@wdc.com,
brauner@kernel.org, yi.zhang@huawei.com, chengzhihao1@huawei.com,
yukuai3@huawei.com, yangerkun@huawei.com
Subject: Re: [RFC PATCH v4 07/11] fs: statx add write zeroes unmap attribute
Date: Thu, 8 May 2025 07:01:47 +0200 [thread overview]
Message-ID: <20250508050147.GA26916@lst.de> (raw)
In-Reply-To: <a39a6612-89ac-4255-b737-37c7d16b3185@huaweicloud.com>
On Wed, May 07, 2025 at 03:33:23PM +0800, Zhang Yi wrote:
> On 2025/5/6 20:11, Christoph Hellwig wrote:
> > On Tue, May 06, 2025 at 07:16:56PM +0800, Zhang Yi wrote:
> >> Sorry, but I don't understand your suggestion. The
> >> STATX_ATTR_WRITE_ZEROES_UNMAP attribute only indicate whether the bdev
> >> and the block device that under the specified file support unmap write
> >> zeroes commoand. It does not reflect whether the bdev and the
> >> filesystems support FALLOC_FL_WRITE_ZEROES. The implementation of
> >> FALLOC_FL_WRITE_ZEROES doesn't fully rely on the unmap write zeroes
> >> commoand now, users simply refer to this attribute flag to determine
> >> whether to use FALLOC_FL_WRITE_ZEROES when preallocating a file.
> >> So, STATX_ATTR_WRITE_ZEROES_UNMAP and FALLOC_FL_WRITE_ZEROES doesn't
> >> have strong relations, why do you suggested to put this into the ext4
> >> and bdev patches that adding FALLOC_FL_WRITE_ZEROES?
> >
> > So what is the point of STATX_ATTR_WRITE_ZEROES_UNMAP?
>
> My idea is not to strictly limiting the use of FALLOC_FL_WRITE_ZEROES to
> only bdev or files where bdev_unmap_write_zeroes() returns true. In
> other words, STATX_ATTR_WRITE_ZEROES_UNMAP and FALLOC_FL_WRITE_ZEROES
> are not consistent, they are two independent features. Even if some
> devices STATX_ATTR_WRITE_ZEROES_UNMAP are not set, users should still be
> allowed to call fallcoate(FALLOC_FL_WRITE_ZEROES). This is because some
> devices and drivers currently cannot reliably ascertain whether they
> support the unmap write zero command; however, certain devices, such as
> specific cloud storage devices, do support it. Users of these devices
> may also wish to use FALLOC_FL_WRITE_ZEROES to expedite the zeroing
> process.
What are those "cloud storage devices" where you set it reliably,
i.e.g what drivers?
> Therefore, I think that the current point of
> STATX_ATTR_WRITE_ZEROES_UNMAP (possibly STATX_WRITE_ZEROES_UNMAP) should
> be to just indicate whether a bdev or file supports the unmap write zero
> command (i.e., whether bdev_unmap_write_zeroes() returns true). If we
> use standard SCSI and NVMe storage devices, and the
> STATX_ATTR_WRITE_ZEROES_UNMAP attribute is set, users can be assured
> that FALLOC_FL_WRITE_ZEROES is fast and can choose to use
> fallocate(FALLOC_FL_WRITE_ZEROES) immediately.
That's breaking the abstracton again. An attribute must say something
about the specific file, not about some underlying semi-related feature.
> Would you prefer to make STATX_ATTR_WRITE_ZEROES_UNMAP and
> FALLOC_FL_WRITE_ZEROES consistent, which means
> fallcoate(FALLOC_FL_WRITE_ZEROES) will return -EOPNOTSUPP if the block
> device doesn't set STATX_ATTR_WRITE_ZEROES_UNMAP ?
Not sure where the block device comes from here, both of these operate
on a file.
> If so, I'd suggested we need to:
> 1) Remove STATX_ATTR_WRITE_ZEROES_UNMAP since users can check the
> existence by calling fallocate(FALLOC_FL_WRITE_ZEROES) directly, this
> statx flag seems useless.
Yes, that was my inital thought.
> 2) Make the BLK_FEAT_WRITE_ZEROES_UNMAP sysfs interface to RW, allowing
> users to adjust the block device's support state according to the
> real situation.
No, it's a feature and not a flag.
next prev parent reply other threads:[~2025-05-08 5:01 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-21 2:14 [RFC PATCH v4 00/11] fallocate: introduce FALLOC_FL_WRITE_ZEROES flag Zhang Yi
2025-04-21 2:14 ` [RFC PATCH v4 01/11] block: introduce BLK_FEAT_WRITE_ZEROES_UNMAP to queue limits features Zhang Yi
2025-05-05 11:54 ` Christoph Hellwig
2025-05-06 4:21 ` Martin K. Petersen
2025-05-06 7:51 ` Zhang Yi
2025-04-21 2:15 ` [RFC PATCH v4 02/11] nvme: set BLK_FEAT_WRITE_ZEROES_UNMAP if device supports DEAC bit Zhang Yi
2025-05-05 11:55 ` Christoph Hellwig
2025-04-21 2:15 ` [RFC PATCH v4 03/11] nvme-multipath: add BLK_FEAT_WRITE_ZEROES_UNMAP support Zhang Yi
2025-05-05 11:55 ` Christoph Hellwig
2025-04-21 2:15 ` [RFC PATCH v4 04/11] nvmet: set WZDS and DRB if device supports BLK_FEAT_WRITE_ZEROES_UNMAP Zhang Yi
2025-05-05 11:56 ` Christoph Hellwig
2025-04-21 2:15 ` [RFC PATCH v4 05/11] scsi: sd: set BLK_FEAT_WRITE_ZEROES_UNMAP if device supports unmap zeroing mode Zhang Yi
2025-04-21 2:15 ` [RFC PATCH v4 06/11] dm: add BLK_FEAT_WRITE_ZEROES_UNMAP support Zhang Yi
2025-04-21 2:15 ` [RFC PATCH v4 07/11] fs: statx add write zeroes unmap attribute Zhang Yi
2025-05-05 13:22 ` Christoph Hellwig
2025-05-05 14:29 ` Darrick J. Wong
2025-05-06 4:28 ` Zhang Yi
2025-05-06 4:39 ` Christoph Hellwig
2025-05-06 11:16 ` Zhang Yi
2025-05-06 12:11 ` Christoph Hellwig
2025-05-07 7:33 ` Zhang Yi
2025-05-07 21:03 ` Darrick J. Wong
2025-05-08 5:01 ` Christoph Hellwig [this message]
2025-05-08 12:17 ` Zhang Yi
2025-05-08 20:24 ` Theodore Ts'o
2025-05-09 12:35 ` Zhang Yi
2025-05-06 5:02 ` Christoph Hellwig
2025-05-06 5:36 ` Darrick J. Wong
2025-05-06 5:47 ` Christoph Hellwig
2025-05-06 11:25 ` Zhang Yi
2025-05-06 12:10 ` Christoph Hellwig
2025-05-06 15:55 ` Darrick J. Wong
2025-05-07 8:23 ` Zhang Yi
2025-04-21 2:15 ` [RFC PATCH v4 08/11] fs: introduce FALLOC_FL_WRITE_ZEROES to fallocate Zhang Yi
2025-05-05 13:22 ` Christoph Hellwig
2025-04-21 2:15 ` [RFC PATCH v4 09/11] block: factor out common part in blkdev_fallocate() Zhang Yi
2025-04-21 2:15 ` [RFC PATCH v4 10/11] block: add FALLOC_FL_WRITE_ZEROES support Zhang Yi
2025-04-21 2:15 ` [RFC PATCH v4 11/11] ext4: " Zhang Yi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250508050147.GA26916@lst.de \
--to=hch@lst.de \
--cc=bmarzins@redhat.com \
--cc=brauner@kernel.org \
--cc=chaitanyak@nvidia.com \
--cc=chengzhihao1@huawei.com \
--cc=djwong@kernel.org \
--cc=dm-devel@lists.linux.dev \
--cc=john.g.garry@oracle.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=shinichiro.kawasaki@wdc.com \
--cc=tytso@mit.edu \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yi.zhang@huaweicloud.com \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).