]> www.infradead.org Git - users/hch/xfstests-dev.git/commit
fsx: support unshare range fallocate mode
authorBrian Foster <bfoster@redhat.com>
Thu, 26 Sep 2024 14:41:46 +0000 (10:41 -0400)
committerZorro Lang <zlang@kernel.org>
Sun, 29 Sep 2024 13:06:46 +0000 (21:06 +0800)
commit34ce77ce867d27ad7ad9a180489e4311c3cd15e4
tree1b30eca2616199c42d392214fd68e47f6f6e771f
parent10e6c6772b3d21a233dda763674c297337e88294
fsx: support unshare range fallocate mode

The fallocate unshare mode flag modifies traditional preallocate
mode to unshare any shared extents backing the target range. Without
the unshare flag, preallocate mode simply assures that blocks are
physically allocated, regardless of whether they might be shared.
Unshare mode behaves the same as preallocate mode outside of the
shared extent case.

Since unshare is fundamentally a modifier to preallocate mode,
enable it via an operation flag. Similar to keep size mode, select
it randomly for fallocate operations and track it via a flag and
string combination for operation logging and replay.

Unshare is mainly used for filesystems that support reflink, but the
operation is equivalent to preallocate mode for non-shared ranges,
so enable it by default. Filesystems that do not support the
fallocate flag (such as those that might not support reflink) will
fail the test operation and disable unshare calls at runtime. Also
provide a new command line option to explicitly disable unshare
calls.

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