[LTP] [PATCH 2/3] swapon04: Add test for discard flags
Li Wang
li.wang@linux.dev
Fri Aug 28 11:01:02 CEST 2026
> > this is interesting. Also I notice how it's hard to read the logs, so
> > I need a TINFO before the checks. But technically, this could be a kernel
> > bug: can you please add a sync() before stat() while we are getting the
> > blocks_after? We might need to flush the cache before reading the blocks.
> >
> > fd = SAFE_OPEN(BACKING_FILE, O_RDONLY);
> > SAFE_FSYNC(fd);
> > SAFE_CLOSE(fd);
>
> sorry, this should stay after the tst_fill_file()
Great, this works!
I think the fsync after tst_fill_file() ensures all allocated blocks are
flushed to disk, so stat() reflects the real block count.
Feel free to add my RBT with this change applied:
Reviewed-by: Li Wang <li.wang@linux.dev>
--
Regards,
Li Wang
More information about the ltp
mailing list