Re: [PATCH v2 05/13] generic/1226: Add atomic write test using fio crc check verifier

Ojaswin Mujoo
2025-07-08T12:02:08Z

On Tue, Jul 08, 2025 at 12:11:06PM +0100, John Garry wrote:
> On 08/07/2025 07:50, Ojaswin Mujoo wrote:
> > > > Further, handling awu_max vs awu_max_opt and their different
> > > > interpretations for XFS vs EXT4 etc are adding uneccessary complexity.
> > > You could assume awu max opt == awu max for ext4, as we no there are no
> > > software-based atomic writes. That could be simpler than my previous
> > > suggestion, which involves a kernel change.
> > I want to avoid adding something like
> >
> > iosize = FSTYP == "ext4" ? awu_max : awu_max_opt
> >
> > in the test iteslf, because it is a bit difficult to remember changing
> > this in case things change in the kernel later, eg if ext4 gets a
> > fallback.
>
> You could do the statx call on the mounted bdev, and see if atomics are
> supported there. If not, skip the test.
>
> But even for xfs when HW support is available, we can still use software
> fallback when HW support is not possible, i.e. misaligned. So, in that
> regard, we really should only test this on ext4.

Hmm, okay so I'm a bit confused now. What is different in ext4 vs xfs.
Why does the software fallback for xfs matter in this case? If we limit
io to 16KB hoping that reads don't break, then either ways the fio
verify should work. And if reads break then both ext4 and xfs suffer
irrespective of hardware or software fallback. (We also saw that
hardware atomic writes also suffer with same issue when max_sectors is
low)

>
> >
> > Im not sure if returning non-zero for ext4 is also correct as per the
> > documented behavior from 5d894321c49e613.
> >
> > When zero, it means that there is no such performance boundary.
> >
> > Anyways, I think there might be a simpler solution...
> > > > The simplest way seems to be to just limit the $blocksize to
> > > > something like $(_min 16KB awu_max) and hope that 16KB is small enough
> > > > to not be split during reads. We anyways have other tests like
> > > > generic/1230 that can be used to test larger atomic write sizes
> > > >
> > > > Thoughts?
> > > As I said at the start, we never had guarantees of serialization of reads
> > > and atomic writes.
> > >
> > > However I still think that this is a useful test. It's just it is
> > > theoretically possible to give false positives.
> > >
> > > You could get the test to read max_sectors_kb, and check whether it is
> > > greater than the bs. Again, more complexity.
> > I think this might work. So i can set the iosize as 16kb which is
> > already low enought. Incase the max_sectors is < than 16kb then we bail
> > out. (but then maybe there is a very small chance of read split still)
>
> Sure, that seems fine.
>
> >
> > OR another approach is to do the verify at the very end when all threads
> > are done writing so the reads don't race. The tradeoff is that this
> > will reduce the effictiveness of the test though to some extent.
>
> Yeah, right. We would want this test to prove that atomic writes are not
> getting split by the block stack, so racing reads can help prove that.

Yeahh, but now i'm leaning towards this approach of keeping verify at
the very end instead of parallel. Yes, it is a bit less effective but
then having a data integrity test that can theoretically return false
positives is not good, it'll always keep me guessing about any failure.
Having verify at end will not have false failures for sure. Even though
it comes at a cost of less coverage.

Maybe we can also get some other prespectives on this.
@Zorro, @Darrick, can you please give your thoughts on this?

As a sidenote, with this issue of fio's verify read splitting, it seems
like the parallel verify feature in fio itself is flawed for non-atomic
writes as well since the read can always split and race with the writes.

Not sure what the solution is here, maybe time for non splittable atomic
writes (:p)

>
> >
> > > As an alternative, maybe it's better to maintain this test out-of-tree. I'm
> > > not sure.
> > That'll be a hassle for everyone :p Does any of the above 2 approaches
> > seem acceptable for upstreaming this test?
>
> Sure, I think ether are fine, but I am still a bit hesitant to even have
> this test for xfs (and not just ext4).

>
> Thanks,
> John
>
>