Re: [PATCH v7 11/14] xfs: add xfs_file_dio_write_atomic()

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

 



On Mon, Apr 21, 2025 at 06:47:44AM +0100, John Garry wrote:
> On 21/04/2025 05:00, Darrick J. Wong wrote:
> > > @@ -843,6 +909,8 @@ xfs_file_dio_write(
> > >   		return xfs_file_dio_write_unaligned(ip, iocb, from);
> > >   	if (xfs_is_zoned_inode(ip))
> > >   		return xfs_file_dio_write_zoned(ip, iocb, from);
> > What happens to an IOCB_ATOMIC write to a zoned file?  I think the
> > ioend for an atomic write to a zoned file involves a similar change as
> > an outofplace atomic write to a file (one big transaction to absorb
> > all the mapping changes) but I don't think the zoned code quite does
> > that...?
> 
> Correct. For now, I don't think that we should try to support zoned device
> atomic writes. However we don't have proper checks for this. How about
> adding a xfs_has_zoned() check in xfs_get_atomic_write_{min, max, opt}()?

Well it turns out that was a stupid question -- zoned=1 can't be enabled
with reflink, which means there's no cow fallback so atomic writes just
plain don't work:

$ xfs_info /mnt
meta-data=/dev/sda               isize=512    agcount=4, agsize=32768 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=1
         =                       reflink=0    bigtime=1 inobtcount=1 nrext64=1
         =                       exchange=1   metadir=1
data     =                       bsize=4096   blocks=131072, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=1
log      =internal log           bsize=4096   blocks=16384, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =internal               extsz=4096   blocks=5061632, rtextents=5061632
         =                       rgcount=78   rgsize=65536 extents
         =                       zoned=1      start=131072 reserved=0
$ xfs_io -c 'statx -r -m 0x10000' /mnt/a | grep atomic
stat.atomic_write_unit_min = 0
stat.atomic_write_unit_max = 0
stat.atomic_write_segments_max = 0
stat.atomic_write_unit_max_opt = 0

I /think/ all you'd have to do is create an xfs_zoned_end_atomic_io
function that does what xfs_zoned_end_io but with a single
tr_atomic_ioend transaction; figure out how to convey "this is an
atomic out of place write" to xfs_end_ioend so that it knows to call
xfs_zoned_end_atomic_io; and then update the xfs_get_atomic_write*
helpers.

--D

> Thanks,
> John




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux