]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
fsx: don't skip file size and buf updates on simulated ops
authorBrian Foster <bfoster@redhat.com>
Wed, 28 Aug 2024 18:15:31 +0000 (14:15 -0400)
committerZorro Lang <zlang@kernel.org>
Mon, 2 Sep 2024 20:12:14 +0000 (04:12 +0800)
commitbc0c52655c5a80fcfa4a9b44e6661e5aa14cb67f
treeb8b6b64a18b2f322de28c78df46586a3c8437f25
parentc88734099723030956e8fd69587812ef34392195
fsx: don't skip file size and buf updates on simulated ops

fsx supports the ability to skip through a certain number of
operations of a given command sequence before beginning full
operation. The way this works is by tracking the operation count,
simulating minimal side effects of skipped operations in-memory, and
then finally writing out the in-memory state to the target file when
full operation begins.

Several fallocate() related operations don't correctly track
in-memory state when simulated, however. For example, consider an
ops file with the following two operations:

  zero_range 0x0 0x1000 0x0
  read 0x0 0x1000 0x0

... and an fsx run like so:

  fsx -d -b 2 --replay-ops=<opsfile> <file>

This simulates the zero_range operation, but fails to track the file
extension that occurs as a side effect such that the subsequent read
doesn't occur as expected:

  Will begin at operation 2
  skipping zero size read

The read is skipped in this case because the file size is zero.  The
proper behavior, and what is consistent with other size changing
operations, is to make the appropriate in-core changes before
checking whether an operation is simulated so the end result of
those changes can be reflected on-disk for eventual non-simulated
operations. This results in expected behavior with the same ops file
and test command:

  Will begin at operation 2
  2 read  0x0 thru        0xfff   (0x1000 bytes)

Update zero, copy and clone range to do the file size and EOF change
related zeroing before checking against the simulated ops count.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
ltp/fsx.c