On Mon, Apr 21, 2025 at 10:15:05AM +0800, Zhang Yi wrote: > From: Zhang Yi <yi.zh...@huawei.com> > > Add a new attribute flag to statx to determine whether a bdev or a file > supports the unmap write zeroes command. > > Signed-off-by: Zhang Yi <yi.zh...@huawei.com> > --- > block/bdev.c | 4 ++++ > fs/ext4/inode.c | 9 ++++++--- > include/uapi/linux/stat.h | 1 + > 3 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/block/bdev.c b/block/bdev.c > index 4844d1e27b6f..29b0e5feb138 100644 > --- a/block/bdev.c > +++ b/block/bdev.c > @@ -1304,6 +1304,10 @@ void bdev_statx(struct path *path, struct kstat *stat, > queue_atomic_write_unit_max_bytes(bd_queue)); > } > > + if (bdev_write_zeroes_unmap(bdev)) > + stat->attributes |= STATX_ATTR_WRITE_ZEROES_UNMAP; > + stat->attributes_mask |= STATX_ATTR_WRITE_ZEROES_UNMAP;
Hmm, shouldn't this always be set by stat? But I might just be really confused what attributes_mask is, and might in fact have misapplied it in past patches of my own.. Also shouldn't the patches to report the flag go into the bdev/ext4 patches that actually implement the feature for the respective files to keep bisectability?