Re: [PATCH 03/21] fs/bdev: Add atomic write support info to statx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/10/2023 03:57, Darrick J. Wong wrote:
+#define STATX_ATTR_WRITE_ATOMIC        0x00400000 /* File
supports atomic write operations */
How would this differ from stx_atomic_write_unit_min != 0?
Yeah, I suppose that we can just not set this for the case of
stx_atomic_write_unit_min == 0.
Please use the STATX_ATTR_WRITE_ATOMIC flag to indicate that the
filesystem, file and underlying device support atomic writes when
the values are non-zero. The whole point of the attribute mask is
that the caller can check the mask for supported functionality
without having to read every field in the statx structure to
determine if the functionality it wants is present.

Sure, but again that would be just checking atomic_write_unit_min_bytes or another atomic write block setting as that is the only way to tell from the block layer (if atomic writes are supported), so it will be something like:

if (request_mask & STATX_WRITE_ATOMIC && queue_atomic_write_unit_min_bytes(bdev->bd_queue)) {
    stat->atomic_write_unit_min =
      queue_atomic_write_unit_min_bytes(bdev->bd_queue);
    stat->atomic_write_unit_max =
      queue_atomic_write_unit_max_bytes(bdev->bd_queue);
    stat->attributes |= STATX_ATTR_WRITE_ATOMIC;
    stat->attributes_mask |= STATX_ATTR_WRITE_ATOMIC;
    stat->result_mask |= STATX_WRITE_ATOMIC;
}

Thanks,
John



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux