Re: [RFC 0/7] ext4: Allocator changes for atomic write support with DIO

From: Ojaswin Mujoo
Date: Wed Dec 13 2023 - 01:42:50 EST


On Mon, Dec 11, 2023 at 04:24:14PM +0530, Ojaswin Mujoo wrote:
> > > > looks ok so far, then write 4KB at offset 0:
> > > >
> > > > # /test-pwritev2 -a -d -p 0 -l 4096 /root/mnt/file
> > > > file=/root/mnt/file write_size=4096 offset=0 o_flags=0x4002 wr_flags=0x24
> >
> > ...
> >
> > > > Please note that I tested on my own dev branch, which contains changes over
> > > > [1], but I expect it would not make a difference for this test.
> > > Hmm this should not ideally happen, can you please share your test
> > > script with me if possible?
> >
> > It's doing nothing special, just RWF_ATOMIC flag is set for DIO write:
> >
> > https://github.com/johnpgarry/linux/blob/236870d48ecb19c1cf89dc439e188182a0524cd4/samples/vfs/test-pwritev2.c
>
> Thanks for the script, will try to replicate this today and get back to
> you.
>

Hi John,

So I don't seem to be able to hit the warn on:

$ touch mnt/testfile
$ ./test-pwritev2 -a -d -p 0 -l 4096 mnt/testfile

file=mnt/testfile write_size=4096 offset=0 o_flags=0x4002 wr_flags=0x24
main wrote 4096 bytes at offset 0

$ filefrag -v mnt/testfile

Filesystem type is: ef53
File size of testfile is 4096 (1 block of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 0: 32900.. 32900: 1: last,eof

$ ./test-pwritev2 -a -d -p 8192 -l 8192 mnt/testfile

file=mnt/testfile write_size=8192 offset=8192 o_flags=0x4002 wr_flags=0x24
main wrote 8192 bytes at offset 8192

$ filefrag -v mnt/testfile

Filesystem type is: ef53
File size of mnt/testfile is 16384 (4 blocks of 4096 bytes)
ext: logical_offset: physical_offset: length: expected: flags:
0: 0.. 0: 32900.. 32900: 1:
1: 2.. 3: 33288.. 33289: 2: 32902: last,eof
mnt/testfile: 2 extents found

Not sure why you are hitting the WARN_ON. The tree I used is:

Latest ted/dev + your atomic patchset v1 + this patchset

Regards,
ojaswin