xfstests-dev.git
20 months agoseek_sanity_test: use XFS ioctls to determine file allocation unit size v2022.07.31
Darrick J. Wong [Thu, 28 Jul 2022 18:17:26 +0000 (11:17 -0700)]
seek_sanity_test: use XFS ioctls to determine file allocation unit size

liuyd.fnst@fujitsu.com reported that my recent change to the seek sanity
test broke NFS.  I foolishly thought that st_blksize was sufficient to
find the file allocation unit size so that applications could figure out
the SEEK_HOLE granularity.  Replace that with an explicit callout to XFS
ioctls so that xfs realtime will work again.

Fixes: e861a302 ("seek_sanity_test: fix allocation unit detection on XFS realtime")
Reported-by: liuyd.fnst@fujitsu.com
Tested-by: liuyd.fnst@fujitsu.com
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agocommon/rc: wait for udev before creating dm targets
Darrick J. Wong [Tue, 26 Jul 2022 19:48:36 +0000 (12:48 -0700)]
common/rc: wait for udev before creating dm targets

Every now and then I see a failure when running generic/322 on btrfs:

QA output created by 322
failed to create flakey device

Looking in the 322.full file, I see:

device-mapper: reload ioctl on flakey-test (253:0) failed: Device or resource busy
Command failed.

And looking in dmesg, I see:

device-mapper: table: 8:3: linear: Device lookup failed (-16)
device-mapper: ioctl: error adding target to table

/dev/block/8:3 corresponds to the SCRATCH_DEV on this system.  Given the
failures in 322.out, I think this is caused by generic/322 calling
_init_flakey -> _dmsetup_create -> $DMSETUP_PROG create being unable to
open SCRATCH_DEV exclusively.  Add a call to $UDEV_SETTLE_PROG prior to
the creation of the target to try to calm the system down sufficiently
that the test can proceed.

Note that I don't have any hard evidence that it's udev at fault here --
the few times I've caught this thing, udev *has* been active spraying
error messages for nonexistent sysfs paths to journald and adding a
'udevadm settle' seems to fix it... but that's still only
circumstantial.  Regardless, it seems to have fixed the test failure.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agodmlogwrites: skip generic tests when external logdev in use
Darrick J. Wong [Tue, 26 Jul 2022 19:48:51 +0000 (12:48 -0700)]
dmlogwrites: skip generic tests when external logdev in use

Currently, dm-logwrites and common/dmlogwrites don't seem to have any
means to coordinate the event numbers across multiple devices, and the
fstests setup code is sufficiently intense that it doesn't seem like
there's support for multi-disk filesystems.  For now, we'll _notrun the
tests when we have external log devices, even though that seems like
something we'd _really_ want to test.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agobtrfs: add test case to make sure btrfs can handle one corrupted device
Qu Wenruo [Wed, 27 Jul 2022 05:41:48 +0000 (13:41 +0800)]
btrfs: add test case to make sure btrfs can handle one corrupted device

The new test case will verify that btrfs can handle one corrupted device
without affecting the consistency of the filesystem.

Unlike a missing device, one corrupted device can return garbage to the fs,
thus btrfs has to utilize its data/metadata checksum to verify which
data is correct.

The test case will:

- Create a small fs
  Mostly to speedup the test

- Fill the fs with a regular file

- Use fsstress to create some contents

- Save the fssum for later verification

- Corrupt one device with garbage but keep the primary superblock
  untouched

- Run fssum verification

- Run scrub to fix the fs

- Run scrub again to make sure the fs is fine

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agobtrfs/253: skip on zoned mode as we cannot change the chunk size
Naohiro Aota [Tue, 26 Jul 2022 07:57:59 +0000 (16:57 +0900)]
btrfs/253: skip on zoned mode as we cannot change the chunk size

On zoned mode, we have a fixed chunk size which is equal to the zone size.
So, we cannot change the chunk size, and running this test results in a
failure with below.

    --- tests/btrfs/253.out     2021-12-10 04:33:53.000000000 +0000
    +++ /host/results/btrfs/253.out.bad 2022-07-26 05:58:10.000000000 +0000
    @@ -2,9 +2,16 @@
     Capture default chunk sizes.
     First allocation.
     Second allocation.
    +./common/rc: line 4670: echo: write error: Invalid argument
    +./common/rc: line 4670: echo: write error: Invalid argument
     Calculate request size so last memory allocation cannot be completely fullfilled.
     Third allocation.
    ...

It is no use to test this feature on zoned mode. So, just skip it.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agoxfs/191: Add missing xfsprogs commit
Yang Xu [Thu, 28 Jul 2022 04:36:31 +0000 (12:36 +0800)]
xfs/191: Add missing xfsprogs commit

xfs_repair also needs to think empty xattr leaf block isn't corruption, so
case can pass.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agoxfs: test mkfs.xfs whether terminate getsubopt arrays properly
Yang Xu [Fri, 22 Jul 2022 03:43:04 +0000 (11:43 +0800)]
xfs: test mkfs.xfs whether terminate getsubopt arrays properly

When I run xfs/144 manually, the step as below:
mkfs.xfs -f -d agcount=3200,size=6366g -d file,n

I accidentally pressed the Enter key, it triggers Segmentation fault.
Then I found Darrick has fixed this one week ago. So add this test.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agoxfs: test xfs_db whether still can get corrupted field value
Yang Xu [Tue, 19 Jul 2022 08:31:13 +0000 (16:31 +0800)]
xfs: test xfs_db whether still can get corrupted field value

This is a regression test that xfs_db code doesn't clean up the
LIBXFS_READBUF_SALVAGE call sites in set_cur so that we can't use the
return value directly and scraping it out later.

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agoxfs/270: Fix syntax error
Yang Xu [Tue, 19 Jul 2022 08:31:12 +0000 (16:31 +0800)]
xfs/270: Fix syntax error

Without xfsprogs commit
f4afdcb0a ("xfs_db: clean up the salvage read callsites in set_cur()"),
this case will fail as below:

+/var/lib/xfstests/tests/xfs/270: line 51: [: !=: unary operator expected

With this xfsprogs bug, xfs_db can't get new_ro_compat value, so report
this bash syntax error.

Fix this and add a helper output for xfsprogs bug.

Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agoext4: resize an ext4 which resize_inode feature is disabled but has reserved GDT...
Sun Ke [Wed, 27 Jul 2022 07:11:40 +0000 (15:11 +0800)]
ext4: resize an ext4 which resize_inode feature is disabled but has reserved GDT blocks.

A regression test for b55c3cd102a6 ("ext4: add reserved GDT blocks
check"). Make sure there's not kernel crash, if resize an ext4 which
resize_inode feature is disabled but has reserved GDT blocks.

Signed-off-by: Sun Ke <sunke32@huawei.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agoext4: set 256 blocks in a block group then apply io pressure
Sun Ke [Wed, 13 Jul 2022 09:28:59 +0000 (17:28 +0800)]
ext4: set 256 blocks in a block group then apply io pressure

Set 256 blocks in a block group, then inject I/O pressure, it will
trigger off kernel BUG in ext4_mb_mark_diskspace_used.

Regression test for commit a08f789d2ab5 ext4: fix bug_on
ext4_mb_use_inode_pa.

Signed-off-by: Sun Ke <sunke32@huawei.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agoreport: add support for the xunit-quiet format v2022.07.24
Theodore Ts'o [Wed, 20 Jul 2022 16:43:53 +0000 (12:43 -0400)]
report: add support for the xunit-quiet format

The xunit-quiet format excludes the NNN.{full,dmesg,bad} files in
<system-out> and <system-err> nodes which are included in the xunit
report format.

For test runners that save the entire results directory to preserve
all of the test artifacts, capturing the NNN.{full,dmesg,bad} in the
results.xml file is redundant.  In addition, if the NNN.bad is too
large, it can cause the junitparser python library to refuse to parse
the XML file to prevent potential denial of service attacks[1].  A
simple way to avoid this problem is to simply to omit the <system-out>
and <system-err> nodes in the results.xml file.

[1] https://gitlab.com/gitlab-org/gitlab/-/issues/268035

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agoext4: add test for ext4 uuid get/set ioctls during fsstress.
Jeremy Bongio [Thu, 21 Jul 2022 22:39:30 +0000 (15:39 -0700)]
ext4: add test for ext4 uuid get/set ioctls during fsstress.

Adds a utility to get/set uuid through ext4 ioctl. Executes the ioctls
while running fsstress. These ioctls are used by tune2fs to safely change
the uuid without racing other filesystem modifications.

Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Jeremy Bongio <bongiojp@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agopunch: skip fpunch tests when page size not congruent with file allocation unit
Darrick J. Wong [Tue, 19 Jul 2022 21:38:01 +0000 (14:38 -0700)]
punch: skip fpunch tests when page size not congruent with file allocation unit

Skip the generic fpunch tests on a file when the file's allocation unit
size is not congruent with the system page size.  This is needed for
testing swapfiles and mmap collisions wiht fallocate.

Assuming this edgecase configuration of an edgecase feature is
vanishingly rare, let's just _notrun the tests instead of rewriting a
ton of tests to do their integrity checking by hand.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agofilter: report data block mappings and od offsets in multiples of allocation units
Darrick J. Wong [Tue, 19 Jul 2022 21:37:55 +0000 (14:37 -0700)]
filter: report data block mappings and od offsets in multiples of allocation units

All the tests that use these two filter functions also make all of their
fallocate calls in units of file allocation units, not filesystem
blocks.  Make them transform the file offsets to multiples of file
allocation units (via _get_file_block_size) so that xfs/242 and xfs/252
will work with XFS with a rt extent size set.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agopunch: skip fpunch tests when op length not congruent with file allocation unit
Darrick J. Wong [Tue, 19 Jul 2022 21:37:50 +0000 (14:37 -0700)]
punch: skip fpunch tests when op length not congruent with file allocation unit

Skip the generic fpunch tests on a file when the file's allocation unit
size is not congruent with the proposed testing operations.

This can be the case when we're testing reflink and fallocate on the XFS
realtime device.  For those configurations, the file allocation unit is
a realtime extent, which can be any integer multiple of the block size.
If the request length isn't an exact multiple of the allocation unit
size, reflink and fallocate will fail due to alignment issues, so
there's no point in running these tests.

Assuming this edgecase configuration of an edgecase feature is
vanishingly rare, let's just _notrun the tests instead of rewriting a
ton of tests to do their integrity checking by hand.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agopunch: use allocation unit to test punching holes
Darrick J. Wong [Tue, 19 Jul 2022 21:37:44 +0000 (14:37 -0700)]
punch: use allocation unit to test punching holes

In step 17 of _test_generic_punch, we want to test that we can write
a file with a single block, use one of unresvsp, fpunch, or fzero to
modify the file, and then check that the file has one written block
followed by a hole.

Unfortunately, the test helper uses _get_block_size to determine how
much data to write to the test file.  For filesystems with an allocation
unit size that is not the fs block size (e.g. XFS realtime with a rt
extent size), this produces unwritten extents in the fiemap output,
which causes test failures.

Fix step 17 to obtain the file allocation unit size with
_get_file_block_size.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agomisc: avoid tests encoding FIEMAP/BMAP golden output with weird file blocksizes
Darrick J. Wong [Tue, 19 Jul 2022 21:37:39 +0000 (14:37 -0700)]
misc: avoid tests encoding FIEMAP/BMAP golden output with weird file blocksizes

Some tests encode FIEMAP/XFS_IOC_BMAP results in the golden output.
Typically these tests cannot handle a filesystem that chooses to
allocate extents that are much larger than the filesystem block size
(aka XFS rt extents and ext4 bigalloc).  Since these tests are /never/
going to pass, disable them when these configurations are detected.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agomisc: skip extent size hint tests when hint not congruent with file allocation unit
Darrick J. Wong [Tue, 19 Jul 2022 21:37:33 +0000 (14:37 -0700)]
misc: skip extent size hint tests when hint not congruent with file allocation unit

XFS files have an extent size hint, which tells the block allocator that
it should try to allocate larger aligned blocks when possible.  These
hints must be some integer multiple of the allocation unit size, which
is one fs block for files on the data device, and one rt extent for
files on the realtime device.  For tests that are hardwired to a static
extent size hint, the fssetxattr call will fail if the hint isn't
congruent, so just skip those tests.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agomisc: skip remap/fallocate tests when op length not congruent with file allocation...
Darrick J. Wong [Tue, 19 Jul 2022 21:37:27 +0000 (14:37 -0700)]
misc: skip remap/fallocate tests when op length not congruent with file allocation unit

Nearly all of the reflink and fpunch/fcollapse/finsert tests that I have
written assumed that it was ok to use 64k as the fundamental unit of
allocation.  This works fine for testing the XFS data device, since the
file allocation unit is always a power of two, and never larger than
64k.  Making this assumption allows those tests to encode md5sums in the
golden output for easy file data integrity checking.

Unfortunately, this isn't necessarily the case when we're testing
reflink and fallocate on the XFS realtime device.  For those
configurations, the file allocation unit is a realtime extent, which can
be any integer multiple of the block size.  If the request length isn't
an exact multiple of the allocation unit size, reflink and fallocate
will fail due to alignment issues, so there's no point in running these
tests.

Assuming this edgecase configuration of an edgecase feature is
vanishingly rare, let's just _notrun the tests instead of rewriting a
ton of tests to do their integrity checking by hand.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agomisc: use _get_file_block_size for block (re)mapping tests
Darrick J. Wong [Tue, 19 Jul 2022 21:37:22 +0000 (14:37 -0700)]
misc: use _get_file_block_size for block (re)mapping tests

Tests that exercise block remapping functionality such as reflink,
hole punching, fcollapse, and finsert all require the input parameters
to be aligned to allocation unit size for regular files.  This could be
different from the fundamental filesystem block size (think ext4
bigalloc or xfs realtime), so use the appropriate function here.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
signed-off-by: Zorro Lang <zlang@kernel.org>

20 months agogeneric: test fs-verity EFBIG scenarios
Boris Burkov [Wed, 20 Jul 2022 00:49:50 +0000 (17:49 -0700)]
generic: test fs-verity EFBIG scenarios

btrfs, ext4, and f2fs cache the Merkle tree past EOF, which restricts
the maximum file size beneath the normal maximum. Test the logic in
those filesystems against files with sizes near the maximum.

To work properly, this does require some understanding of the practical
but not standardized layout of the Merkle tree. This is a bit unpleasant
and could make the test incorrect in the future, if the implementation
changes. On the other hand, it feels quite useful to test this tricky
edge case. It could perhaps be made more generic by adding some ioctls
to let the file system communicate the maximum file size for a verity
file or some information about the storage of the Merkle tree.

Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agobtrfs: test verity orphans with dmlogwrites
Boris Burkov [Wed, 20 Jul 2022 00:49:49 +0000 (17:49 -0700)]
btrfs: test verity orphans with dmlogwrites

The behavior of orphans is most interesting across mounts, interrupted
at arbitrary points during fsverity enable. To cover as many such cases
as possible, use dmlogwrites and dmsnapshot as in
log-writes/replay-individual.sh. As we replay the log events, we run a
state machine with different invariants enforced at each state.

There are three possible states for a given point in the log:
0. Verity has not yet started
1. Verity has started but not finished
2. Verity has finished.

The possible transitions with causes are:
0->1: We see an orphan item for the file.
1->2: Running 'fsverity measure' succeeds on the file.

Each state has its own invariant for testing:
0: No verity items exist.
1: Mount should handle the orphan and blow away verity data: expect 0
   Merkle items after mounting.
2: The orphan should be gone and mount should not blow away merkle
   items. Expect the same number of merkle items before and after
   mounting.

As a result, we can be confident that if the file system loses power at
any point during enabling verity on a file, the work is either completed,
or gets rolled-back by mount.

Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agobtrfs: test btrfs specific fsverity corruption
Boris Burkov [Wed, 20 Jul 2022 00:49:48 +0000 (17:49 -0700)]
btrfs: test btrfs specific fsverity corruption

There are some btrfs specific fsverity scenarios that don't map
neatly onto the tests in generic/574 like holes, inline extents,
and preallocated extents. Cover those in a btrfs specific test.

This test relies on the btrfs implementation of fsverity in the patch:
btrfs: initial fsverity support

and on btrfs-corrupt-block for corruption in the patches titled:
btrfs-progs: corrupt generic item data with btrfs-corrupt-block
btrfs-progs: expand corrupt_file_extent in btrfs-corrupt-block

Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agocommon/verity: support btrfs in generic fsverity tests
Boris Burkov [Wed, 20 Jul 2022 00:49:47 +0000 (17:49 -0700)]
common/verity: support btrfs in generic fsverity tests

generic/572-579 have tests for fsverity. Now that btrfs supports
fsverity, make these tests function as well. For a majority of the tests
that pass, simply adding the case to mkfs a btrfs filesystem with no
extra options is sufficient.

However, generic/574 has tests for corrupting the merkle tree itself.
Since btrfs uses a different scheme from ext4 and f2fs for storing this
data, the existing logic for corrupting it doesn't work out of the box.
Adapt it to properly corrupt btrfs merkle items.

576 does not run because btrfs does not support transparent encryption.

This test relies on the btrfs implementation of fsverity in the patch:
btrfs: initial fsverity support

and on btrfs-corrupt-block for corruption in the patches titled:
btrfs-progs: corrupt generic item data with btrfs-corrupt-block
btrfs-progs: expand corrupt_file_extent in btrfs-corrupt-block

Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agocommon/verity: require corruption functionality
Boris Burkov [Wed, 20 Jul 2022 00:49:46 +0000 (17:49 -0700)]
common/verity: require corruption functionality

Corrupting ext4 and f2fs relies on xfs_io fiemap. Btrfs corruption
testing will rely on a btrfs specific corruption utility. Add the
ability to require corruption functionality to make this properly
modular. To start, just check for fiemap, as that is needed
universally for _fsv_scratch_corrupt_bytes.

Signed-off-by: Boris Burkov <boris@bur.io>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agogeneric/275: fix premature enospc errors when fs block size is large
Darrick J. Wong [Tue, 19 Jul 2022 21:37:13 +0000 (14:37 -0700)]
generic/275: fix premature enospc errors when fs block size is large

When running this test on an XFS filesystem with a 64k block size, I
see this error:

generic/275       - output mismatch (see /var/tmp/fstests/generic/275.out.bad)
    --- tests/generic/275.out   2021-05-13 11:47:55.694860280 -0700
    +++ /var/tmp/fstests/generic/275.out.bad    2022-07-19 10:38:41.840000000 -0700
    @@ -2,4 +2,7 @@
     ------------------------------
     write until ENOSPC test
     ------------------------------
    +du: cannot access '/opt/tmp1': No such file or directory
    +stat: cannot statx '/opt/tmp1': No such file or directory
    +/tmp/fstests/tests/generic/275: line 74: [: -lt: unary operator expected
     done
    ...
    (Run 'diff -u /tmp/fstests/tests/generic/275.out /var/tmp/fstests/generic/275.out.bad'  to see the entire diff)

The 275.full file indicates that the test was unable to recreate the
$SCRATCH_MNT/tmp1 file after we freed all but the last 256K of free
space in the filesystem.  I mounted the scratch fs, and df reported
exactly 256K of free space available, which means there are 4 blocks
left in the filesystem for user programs to use.

Unfortunately for this test, xfs_create requires sufficient free blocks
in the filesystem to handle full inode btree splits and the maximal
directory expansion for a new dirent.  In other words, there must be
enough free space to handle the worst case space consumption.  That
quantity is 26 blocks, hence the last dd in the test fails with ENOSPC,
which makes the test fail.

Fix all this by creating the file that we use to test the low-space file
write *before* we drain the free space down to 256K.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agobtrfs/257: not run if we have compression enabled
Josef Bacik [Tue, 19 Jul 2022 15:27:35 +0000 (11:27 -0400)]
btrfs/257: not run if we have compression enabled

This fails on all of our compression config variations because it
depends on specific file extent layout.  Add _require_btrfs_no_compress
so we don't complain about failures that don't apply.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Signed-off-by: Zorro Lang <zlang@kernel.org>
20 months agobtrfs/270: fix uncompressed data from previously bad mirror
Christoph Hellwig [Tue, 19 Jul 2022 06:14:54 +0000 (08:14 +0200)]
btrfs/270: fix uncompressed data from previously bad mirror

The commited old version test the broken behavior of the current
upstream code that writes the uncompressed data into a previously
bad mirror.  Fix the test to check that the compressed data gets
re-replicated and add it to the compress group while we're at it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs/144: fix test mkfs.xfs sizing of internal logs that overflow the AG v2022.07.10
Darrick J. Wong [Tue, 5 Jul 2022 22:02:08 +0000 (15:02 -0700)]
xfs/144: fix test mkfs.xfs sizing of internal logs that overflow the AG

Fix a few problems with this test -- one of the things we test require
mkfs to run in -N mode, so we need to have a certain amount of free
space, and fix that test not to use -N mode.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs/547: fix problems with realtime
Darrick J. Wong [Tue, 5 Jul 2022 22:02:19 +0000 (15:02 -0700)]
xfs/547: fix problems with realtime

This test needs to fragment the free space on the data device so that
each block added to the attr fork gets its own mapping.  If the test
configuration sets up a rt device and rtinherit=1 on the root dir, the
test will erroneously fragment space on the *realtime* volume.  When
this happens, attr fork allocations are contiguous and get merged into
fewer than 10 extents and the test fails.

Fix this test to force all allocations to be on the data device, and fix
incorrect variable usage in the error messages.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs: make sure that we handle empty xattr leaf blocks ok
Darrick J. Wong [Fri, 8 Jul 2022 17:44:23 +0000 (10:44 -0700)]
xfs: make sure that we handle empty xattr leaf blocks ok

Make sure that the kernel can handle empty xattr leaf blocks properly,
since we've screwed this up enough times.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs/288: skip repair -n when checking empty root leaf block behavior
Darrick J. Wong [Tue, 5 Jul 2022 22:02:34 +0000 (15:02 -0700)]
xfs/288: skip repair -n when checking empty root leaf block behavior

Update this test to reflect the (once again) corrected behavior of the
xattr leaf block verifiers.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agobtrfs: test raid1 write error handling
Christoph Hellwig [Sat, 2 Jul 2022 09:33:30 +0000 (11:33 +0200)]
btrfs: test raid1 write error handling

Test that a write with a single bad mirror works fine but reports errors
in the error counters, and that a write with two bad mirrors fails.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agocheck: add -L <n> parameter to rerun failed tests
David Disseldorp [Fri, 8 Jul 2022 08:51:42 +0000 (10:51 +0200)]
check: add -L <n> parameter to rerun failed tests

If check is run with -L <n>, then a failed test will be rerun <n> times
before proceeding to the next test. Following completion of the rerun
loop, aggregate pass/fail statistics are printed.

Rerun tests will be tracked as a single failure in overall pass/fail
metrics (via @try and @bad), with .out.bad, .dmesg, .core, .hints,
.notrun and .full saved using a .rerun# suffix.

Suggested-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lwn.net/Articles/897061/
Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agocheck: append bad / notrun arrays in helper function
David Disseldorp [Fri, 8 Jul 2022 08:51:41 +0000 (10:51 +0200)]
check: append bad / notrun arrays in helper function

Currently the @try, @bad and @notrun arrays are appended with seqnum at
different points in the main run_section() loop:
- @try: shortly prior to test script execution
- @notrun: on list (check -n), or after .notrun flagged test completion
- @bad: at the start of subsequent test loop and loop exit

For future loop-test-following-failure functionality it makes sense to
combine some of these steps. This change moves both @notrun and @bad
appends into a helper function which is called at the end of each loop
iteration.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agocheck: make a few variables local
David Disseldorp [Fri, 8 Jul 2022 08:51:40 +0000 (10:51 +0200)]
check: make a few variables local

The variables aren't used outside of function scope. Also convert one
timestamp output to use the helper.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoreport: pass through most details as function parameters
David Disseldorp [Fri, 8 Jul 2022 08:51:39 +0000 (10:51 +0200)]
report: pass through most details as function parameters

Report generation currently involves reaching into a whole bunch of
globals for things like section name and start/end times. Pass these
through as explicit function parameters to avoid unintentional breakage.

One minor fix included is the default xunit error message, which used
$sequm instead of $seqnum.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoreport: use array for REPORT_ENV_LIST
David Disseldorp [Fri, 8 Jul 2022 08:51:38 +0000 (10:51 +0200)]
report: use array for REPORT_ENV_LIST

There's no need for multiple assignments.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs: test xfs_copy doesn't do cached read before libxfs_mount v2022.07.03
Darrick J. Wong [Thu, 30 Jun 2022 00:48:14 +0000 (17:48 -0700)]
xfs: test xfs_copy doesn't do cached read before libxfs_mount

This is a regression test for an xfs_copy fix that ensures that it
doesn't perform a cached read of an XFS filesystem prior to initializing
libxfs, since the xfs_mount (and hence the buffer cache) isn't set up
yet.

[zlang: change the supported fs from generic to xfs]

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs: test mkfs.xfs sizing of internal logs that
Darrick J. Wong [Tue, 28 Jun 2022 20:21:34 +0000 (13:21 -0700)]
xfs: test mkfs.xfs sizing of internal logs that

This is a regression test that exercises the mkfs.xfs code that creates
log sizes that are very close to the AG size when stripe units are in
play and/or when the log is forced to be in AG 0.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs/166: fix golden output failures when multipage folios enabled
Darrick J. Wong [Tue, 28 Jun 2022 20:22:02 +0000 (13:22 -0700)]
xfs/166: fix golden output failures when multipage folios enabled

Beginning with 5.18, some filesystems support creating large folios for
the page cache.  A system with 64k pages can create 256k folios, which
means that with the old file size of 1M, the last half of the file is
completely converted from unwritten to written by page_mkwrite.  The
test encodes a translated version of the xfs_bmap output in the golden
output, which means that the test now fails on 64k pages.  Fixing the
64k page case by increasing the file size to 2MB broke fsdax because
fsdax uses 2MB PMDs, hence 12MB.

Increase the size to prevent this from happening.  This may require
further revision if folios get larger or fsdax starts supporting PMDs
that are larger than 2MB.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs/109: handle larger minimum filesystem size
Darrick J. Wong [Tue, 28 Jun 2022 20:21:51 +0000 (13:21 -0700)]
xfs/109: handle larger minimum filesystem size

mkfs will soon refuse to format a filesystem smaller than 300MB, so
increase the size of the filesystem to keep this test scenario
realistic.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agocheck: document mkfs.xfs reliance on fstests exports
Darrick J. Wong [Tue, 28 Jun 2022 20:21:45 +0000 (13:21 -0700)]
check: document mkfs.xfs reliance on fstests exports

There are a number of fstests that employ special (and now unsupported)
XFS filesystem configurations to perform testing in a controlled
environment.  The presence of the QA_CHECK_FS and MSGVERB variables are
used by mkfs.xfs to detect that it's running inside fstests, which
enables the unsupported configurations.  Nobody else should be using
filesystems with tiny logs, non-redundant superblocks, or smaller than
the (new) minimum supported size.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoseek_sanity_test: fix allocation unit detection on XFS realtime
Darrick J. Wong [Tue, 28 Jun 2022 20:21:23 +0000 (13:21 -0700)]
seek_sanity_test: fix allocation unit detection on XFS realtime

The seek sanity test tries to figure out a file space allocation unit by
calling stat and then using an iterative SEEK_DATA method to try to
detect a smaller blocksize based on SEEK_DATA's consultation of the
filesystem's internal block mapping.  This was put in (AFAICT) because
XFS' stat implementation returns max(filesystem blocksize, PAGESIZE) for
most regular files.

Unfortunately, for a realtime file with an extent size larger than a
single filesystem block this doesn't work at all because block mappings
still work at filesystem block granularity, but allocation units do not.
To fix this, detect the specific case where st_blksize != PAGE_SIZE and
trust the fstat results.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoext4: create file systems with the encrypt feature as necessary
Theodore Ts'o [Thu, 30 Jun 2022 14:46:37 +0000 (10:46 -0400)]
ext4: create file systems with the encrypt feature as necessary

The linux kernel commit 5f41fdaea63d ("ext4: only allow
test_dummy_encryption when supported") the kernel will reject mounts
with the test_dummy_encryption option if the ext4 file system does not
have the encrypt feature enabled.

There are a handful of tests (ext4/003, ext4/035, ext4/306, and
generic/260) which will format the scratch file system using a
hard-coded set of mkfs.ext4 parameters ignoring the MKFS_OPTION that
is set by the file system test config.

For file system configs which includes test_dummy_encryption in
MOUNT_OPTIONS and "-O encrypt" in MKFS_OPTIONS, we need to test for
test_dummy_encryption and force the hard-coded mkfs options to enable
the encrypt feature.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoext4/035: skip this test if the scratch device does not support 1k block sizes
Theodore Ts'o [Thu, 30 Jun 2022 14:46:36 +0000 (10:46 -0400)]
ext4/035: skip this test if the scratch device does not support 1k block sizes

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoext4/055: skip test if dax mount option is used
Theodore Ts'o [Thu, 30 Jun 2022 14:46:35 +0000 (10:46 -0400)]
ext4/055: skip test if dax mount option is used

This test creates a 1k block file system with the quota feature
enabled.   As such, it is incompatible with DAX.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoext4/054: skip test if the dax mount option is enabled
Theodore Ts'o [Thu, 30 Jun 2022 14:46:34 +0000 (10:46 -0400)]
ext4/054: skip test if the dax mount option is enabled

The ext4/054 test explicitly creates a file system with a 1k
blocksize.  This can't possibly work on if the dax mount option is
enabled, so change ext4/054 to use _scratch_mkfs_blocksized, and and a
check to _scratch_mkfs_blocksized to _notrun the test if the block
size is less than the page size.

Also remove an unnecessary _require_test declaration since this test
does not use the test device.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoext4/045: _require_dumpe2fs doesn't take any arguments so remove them
Theodore Ts'o [Thu, 30 Jun 2022 14:46:33 +0000 (10:46 -0400)]
ext4/045: _require_dumpe2fs doesn't take any arguments so remove them

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoext4/044: skip test if the file system does not have a journal
Theodore Ts'o [Thu, 30 Jun 2022 14:46:32 +0000 (10:46 -0400)]
ext4/044: skip test if the file system does not have a journal

This test mounts the file system using "mount -t ext3"; if the file
system config creates the file system without the jbd2 journal, the
"mount -t ext3" will fail.  So skip this test in that case.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoext4/050: support indirect as well as extent mapped journals
Theodore Ts'o [Thu, 30 Jun 2022 14:46:31 +0000 (10:46 -0400)]
ext4/050: support indirect as well as extent mapped journals

Simplify the test and fix ext4/050 failures when running ext4 without
extents enabled (e.g., in ext3 emulation mode).

Instead of relying on parsing debugfs output's (which varies depending
on whether the journal inode is extent mapped or indirect block
mapped), use debugfs's "cat" command to get the contents of the
journal.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoceph/005: verify correct statfs behaviour with quotas
Luís Henriques [Mon, 27 Jun 2022 10:26:31 +0000 (11:26 +0100)]
ceph/005: verify correct statfs behaviour with quotas

When using a directory with 'max_bytes' quota as a base for a mount,
statfs shall use that 'max_bytes' value as the total disk size.  That
value shall be used even when using subdirectory as base for the mount.

A bug was found where, when this subdirectory also had a 'max_files'
quota, the real filesystem size would be returned instead of the parent
'max_bytes' quota value.  This test case verifies this bug is fixed.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agobtrfs: test read repair on a corrupted compressed extent
Christoph Hellwig [Wed, 22 Jun 2022 04:58:44 +0000 (06:58 +0200)]
btrfs: test read repair on a corrupted compressed extent

Exercise read repair on a corrupted compressed sector.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agobtrfs: test checker pattern corruption on raid10
Christoph Hellwig [Wed, 22 Jun 2022 04:58:43 +0000 (06:58 +0200)]
btrfs: test checker pattern corruption on raid10

Check read repair for the case where the corruption is spread over
the different legs of a raid10 set.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agobtrfs; add a test for impossible repair cases
Christoph Hellwig [Wed, 22 Jun 2022 04:58:42 +0000 (06:58 +0200)]
btrfs; add a test for impossible repair cases

Verify that a repair attempt that can't succeed because all copies are
bad returns a proper I/O error and doesn't cause any deadlocks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agobtrfs: fix the_btrfs_get_physical invocation in btrfs-map-logical
Christoph Hellwig [Wed, 22 Jun 2022 04:58:41 +0000 (06:58 +0200)]
btrfs: fix the_btrfs_get_physical invocation in btrfs-map-logical

The -b flag without an argument is not supported, so remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs/{422,517}: kill background jobs on test termination v2022.06.26
Amir Goldstein [Tue, 21 Jun 2022 17:37:29 +0000 (20:37 +0300)]
xfs/{422,517}: kill background jobs on test termination

Those tests failed to cleanup background jobs properly after test
is interrupted and even sometimes when it completed succefully.

xfs/517 would sometime fails randomally with this false positive error:
     QA output created by 517
     Format and populate
     Concurrent fsmap and freeze
    +Terminated
     Test done

The tests have several background sub-shells that spawn short lived
programs in a loop.  By killing the spawned programs using killall,
killall could find no process to kill and the sub-shell loop could still
spawn another process that is not going to be killed and in the worst
case, the freeze_loop() could spawn the xfs_io "freeze" command after
test has thawn the fs before exit, which leaves the fs frozen after the
test.

The "Terminated" output is emitted by the sub-shell when killing the
programs that it has spawned when the loop did not finish before test
timeout.  By killing the sub-shell and not the spawned programs, we
avoid the false positive "Terminated" error.

Use a helper to perform this cleanup dance:
First kill and wait the freeze_loop so it won't try to freeze fs again
Then make sure fs is not frozen.
Then kill and wait for the rest of the sub-shells, because
if fs is frozen a killed writer process will never exit.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agofstests: unfreeze fs on cleanup routines
Amir Goldstein [Tue, 21 Jun 2022 17:37:28 +0000 (20:37 +0300)]
fstests: unfreeze fs on cleanup routines

Many of tests that freeze fs do not make sure that fs is unfrozen on
test termination.

Some tests also need to kill and wait for writer processes after
unfreezing the fs.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agofstests: add missing _require_freeze() to tests
Amir Goldstein [Tue, 21 Jun 2022 17:37:27 +0000 (20:37 +0300)]
fstests: add missing _require_freeze() to tests

And add a few tests that use freeze to the freeze group

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoext4/053: test changing test_dummy_encryption on remount
Eric Biggers [Thu, 23 Jun 2022 18:41:13 +0000 (11:41 -0700)]
ext4/053: test changing test_dummy_encryption on remount

The test_dummy_encryption mount option isn't supposed to be settable or
changeable via a remount, so add test cases for this.  This is a
regression test for a bug that was introduced in Linux v5.17 and fixed
in v5.19-rc3 by commit 85456054e10b ("ext4: fix up test_dummy_encryption
handling for new mount API").

Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoxfs/122: escape %zu in printf with %% not \\%
Eric Sandeen [Mon, 20 Jun 2022 21:43:31 +0000 (16:43 -0500)]
xfs/122: escape %zu in printf with %% not \\%

The standard way to escape % in a printf is with %%; although \\%zu
seems to have worked in awk until recently, an upgrade on Fedora 36
has started failing:

awk: cmd. line:1: (FILENAME=- FNR=1) fatal: not enough arguments to satisfy format string
        'printf("sizeof(%s) = \%zu\n", sizeof(%s));
    '
                                              ^ ran out for this one
Switching the escape to "%%" fixes this for me, and also works
on my very old RHEL7 mcahine.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agocheck: remove err and first_test variables
David Disseldorp [Mon, 20 Jun 2022 19:29:34 +0000 (21:29 +0200)]
check: remove err and first_test variables

tc_status can be used for both of these.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agocheck: use arrays instead of separate n_ counters
David Disseldorp [Mon, 20 Jun 2022 19:29:33 +0000 (21:29 +0200)]
check: use arrays instead of separate n_ counters

The separate n_try, n_bad and n_notrun counters are unnecessary when
the corresponding lists are switched to bash arrays.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoreport: fix xunit tests count
David Disseldorp [Mon, 20 Jun 2022 19:29:32 +0000 (21:29 +0200)]
report: fix xunit tests count

The xunit "section report" provides a tests attribute, which according
to https://llg.cubic.org/docs/junit/ represents:
tests=""     <!-- The total number of tests in the suite, required. -->

The current value is generated as a sum of the $n_try and $n_notrun
counters. This is incorrect as the $n_try counter already includes tests
which are run but complete with _notrun.
One special case exists for $showme (check -n), where $n_try remains
zero, so $n_notrun can be used as-is.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agoreport: drop unused _xunit_make_section_report parameter
David Disseldorp [Mon, 20 Jun 2022 19:29:31 +0000 (21:29 +0200)]
report: drop unused _xunit_make_section_report parameter

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agocheck: simplify check.time parsing
David Disseldorp [Mon, 20 Jun 2022 19:29:30 +0000 (21:29 +0200)]
check: simplify check.time parsing

There's no need to use grep and awk when the latter can do all that's
needed, including the pretty printing.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agocheck: avoid FSTYP=<fstyp parameter> repetition
David Disseldorp [Mon, 20 Jun 2022 19:29:29 +0000 (21:29 +0200)]
check: avoid FSTYP=<fstyp parameter> repetition

Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agogeneric/486: adjust the max xattr size
Luís Henriques [Mon, 13 Jun 2022 11:31:42 +0000 (12:31 +0100)]
generic/486: adjust the max xattr size

CephFS doesn't have a maximum xattr size.  Instead, it imposes a maximum
size for the full set of xattrs names+values, which by default is 64K.  And
since it reports 4M as the blocksize (the default ceph object size),
generic/486 will fail in ceph because the XATTR_SIZE_MAX value can't be used
in attr_replace_test.

The fix is to add a new argument to the test so that the max size can be
passed in instead of trying to auto-probe a value for it.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
21 months agogeneric/020: adjust max_attrval_size for ceph
Luís Henriques [Mon, 13 Jun 2022 11:31:41 +0000 (12:31 +0100)]
generic/020: adjust max_attrval_size for ceph

CephFS doesn't have a maximum xattr size.  Instead, it imposes a maximum
size for the full set of xattrs names+values, which by default is 64K.

This patch fixes the max_attrval_size for ceph so that it is takes into
account any already existing attrs in the file.

Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agoxfs: Verify correctness of upgrading an fs to support large extent counters v2022.06.12
Chandan Babu R [Sat, 11 Jun 2022 11:10:37 +0000 (16:40 +0530)]
xfs: Verify correctness of upgrading an fs to support large extent counters

This commit adds a test to verify upgrade of an existing V5 filesystem to
support large extent counters.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agoxfs: Verify that the correct inode extent counters are updated with/without nrext64
Chandan Babu R [Sat, 11 Jun 2022 11:10:36 +0000 (16:40 +0530)]
xfs: Verify that the correct inode extent counters are updated with/without nrext64

This commit adds a new test to verify if the correct inode extent counter
fields are updated with/without nrext64 mkfs option.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agocommon/xfs: Add helper to check if nrext64 option is supported
Chandan Babu R [Sat, 11 Jun 2022 11:10:35 +0000 (16:40 +0530)]
common/xfs: Add helper to check if nrext64 option is supported

This commit adds a new helper to allow tests to check if xfsprogs and xfs
kernel module support nrext64 option.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agoxfs/270: Fix ro mount failure when nrext64 option is enabled
Chandan Babu R [Sat, 11 Jun 2022 11:10:34 +0000 (16:40 +0530)]
xfs/270: Fix ro mount failure when nrext64 option is enabled

With nrext64 option enabled at run time, the read-only mount performed by the
test fails because,
1. mkfs.xfs would have calculated log size based on reflink being enabled.
2. Clearing the reflink ro compat bit causes log size calculations to yield a
   different value.
3. In the case where nrext64 is enabled, this causes attr reservation to be
   the largest among all the transaction reservations.
4. This ends up causing XFS to require a larger ondisk log size than that
   which is available.

This commit fixes the problem by setting features_ro_compat to the value
obtained by the bitwise-OR of features_ro_compat field with 2^31.

This commit includes changes suggested by Dave Chinner to replace bashisms
with invocations to inline awk scripts.

Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agobtrfs/220: zoned: skip nodatacow mount option for zoned btrfs
Naohiro Aota [Tue, 7 Jun 2022 08:06:35 +0000 (17:06 +0900)]
btrfs/220: zoned: skip nodatacow mount option for zoned btrfs

The nodatacow mount option is not allowed on zoned btrfs and failing the
test. Skip the cases for zoned btrfs.

Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agocommon/filter: filter out extra mount error output
Zorro Lang [Fri, 27 May 2022 12:11:15 +0000 (20:11 +0800)]
common/filter: filter out extra mount error output

The lastest mount command (from util-linux) merged below commit:
  79534c0d7e0f ("mount: add hint about dmesg(8) to error messages")
which brought in a new error output when mount fails, no matter
ro/rw/busy mount fails.

That cause some cases (e.g. xfs/005) fail as:
  mount: Structure needs cleaning
         dmesg(1) may have more information after failed mount system call

More failed cases like generic/050, ext4/002, xfs/154, xfs/158 etc.
Especially xfs/154 and xfs/158, need to change their _filter_scratch
to _filter_error_mount.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@redhat.com>
22 months agoxfs: corrupted xattr should not block removexattr
Zorro Lang [Fri, 3 Jun 2022 08:24:57 +0000 (16:24 +0800)]
xfs: corrupted xattr should not block removexattr

After we corrupted an attr leaf block (under node block), getxattr
might hit EFSCORRUPTED in xfs_attr_node_get when it does
xfs_attr_node_hasname. A known bug cause xfs_attr_node_get won't do
xfs_buf_trans release job, then a subsequent removexattr will hang.

This case covers a1de97fe296c ("xfs: Fix the free logic of state in
xfs_attr_node_hasname")

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
22 months agoxfs/189: systemd monitoring of /etc/fstab sucks v2022.06.05
Dave Chinner [Fri, 3 Jun 2022 01:54:13 +0000 (11:54 +1000)]
xfs/189: systemd monitoring of /etc/fstab sucks

On a recently upgraded system, xfs/189 still works just fine, but
every test run after it now gets spammed from mount/systemd
like so:

xfs/189 [not run] noattr2 mount option not supported on /dev/vdc
xfs/190 1s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
 1s
xfs/192 3s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
 2s
xfs/193 2s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.
 2s
xfs/194 1s ... mount: (hint) your fstab has been modified, but systemd still uses
       the old version; use 'systemctl daemon-reload' to reload.

This is because xfs/189 modifies /etc/fstab during the test, then
restores it to it's original condition so there's nothing to update.
However, systemd is sees that the mtime of /etc/fstab has changed,
and assumes they sky has fallen and so everything must be reloaded
from scratch to silence the unnecessary "hint".

We can avoid this clumsiness by capturing the mtime of /etc/fstab
before we modify it, and restore it afterwards and that means
systemd doesn't even notice that we've being playing around with
/etc/fstab.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agoxfs/167: adjust runtime with TIME_FACTOR
Dave Chinner [Thu, 2 Jun 2022 00:31:25 +0000 (10:31 +1000)]
xfs/167: adjust runtime with TIME_FACTOR

xfs/167 takes between 6 and 10 minutes to run on my SSD based test
machines. It's running 50 loops of a unwritten extent conversion
test program whilst running a heavy fsstress workload in the
background. This does not need to run for 10 minutes on every auto
group regression test run. Shorten it to loop 5 * TIME_FACTOR
so that normal runtime drops to something sane but can still be
easily ramped up if soak/stress testing is being run.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agoxfs/070: filter the bad sb magic number error
Dave Chinner [Thu, 2 Jun 2022 00:31:24 +0000 (10:31 +1000)]
xfs/070: filter the bad sb magic number error

Lastest XFS kernel makes the superblock bad magic number error
message more meaningful, and that's being picked up by xfsprogs in
very short order. And, of course, the error is output by xfs_repair,
too, and it's been captured in the golden output of a test. Fix it
by filtering the output back down to the old message.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agoxfs/538: fix fsstress scaling
Dave Chinner [Thu, 2 Jun 2022 00:31:23 +0000 (10:31 +1000)]
xfs/538: fix fsstress scaling

_scale_fsstress_args() does time/load scaling of parameters. Doing
it also in the test causes exponential scaling instead of linear
scaling as the time/load parameters are meant to do.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agogeneric/038: kill background threads on interrupt
Dave Chinner [Thu, 2 Jun 2022 00:31:22 +0000 (10:31 +1000)]
generic/038: kill background threads on interrupt

When I ctrl-c g/038, it either does nothing or it leaves processes
running in the background. It is not cleaning up it's background
processes correctly, so add kill vectors into the cleanup. Make sure
we only kill in the cleanup trap if the background processes are
running.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agogeneric/081: don't run on DAX capable devices
Dave Chinner [Thu, 2 Jun 2022 00:31:21 +0000 (10:31 +1000)]
generic/081: don't run on DAX capable devices

LVM/DM has conniptions when you try to use snapshots on a device
that has DAX capability. It first sets up the underlying device as a
DAX capable mapping (type 3 or DM_TYPE_DAX_BIO_BASED) but because
snapshots require COW and shared mappings, it isn't supported on DAX
capable devices. Hence creating the snapshot device fails because it
requires a type 1 (DM_TYPE_BIO_BASED) device and DM can't change
types on a loaded mapping.

Hence we get this obscure error message in the log:

device-mapper: ioctl: can't change device type (old=3 vs new=1) after initial table load.

and these obscure, unhelpful error messages from the LVM command
outputs:

  device-mapper: reload ioctl on  (251:0) failed: Invalid argument
  Failed to suspend logical volume vg_081/base_081.
  Device vg_081-base_081-real (251:1) is used by another device.
  Failed to revert logical volume vg_081/base_081.
  Aborting. Manual intervention required.
Failed to create snapshot

How to turn off DAX capability is not documented in dmsetup or LVM
man pages, nor is dax mentioned anywhere in
Documentation/admin/device-mapper/ so I have no idea how to tell
LVM/DM "don't try to enable DAX support!".

As such, if the uderlying block device is dax capable, skip this
test.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agoREADME: document _begin_fstests better
Dave Chinner [Thu, 2 Jun 2022 00:31:20 +0000 (10:31 +1000)]
README: document _begin_fstests better

Because how it actually gets used by the fstests infrastructure
has been undocumented and that has impact on how it should be set
up.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agofstests: Add Log Attribute Replay test
Allison Henderson [Fri, 3 Jun 2022 01:41:12 +0000 (11:41 +1000)]
fstests: Add Log Attribute Replay test

This patch adds tests to exercise the log attribute error
inject and log replay. These tests aim to cover cases where attributes
are added, removed, and overwritten in each format (shortform, leaf,
node). Error inject is used to replay these operations from the log.

dchinner: sanitise md5sum input to just attr values.
dchinner: correct md5sums.
dchinner: ensure replace tests use different values so recovery can
          determine the replace was replayed correctly.
dchinner: don't remove corpse in _cleanup - scratch devices don't
  require cleanup, and if the test fails we want to leave
  the broken state for post-mortem analysis.
dchinner: only run on v5 filesystems.

[zlang: restore the old value of /sys/fs/xfs/debug/larp]

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Signed-off-by: Catherine Hoang <catherine.hoang@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agogeneric/591: use proper sector size
Zorro Lang [Tue, 31 May 2022 07:45:01 +0000 (15:45 +0800)]
generic/591: use proper sector size

The generic/591 fails if the sector size of TEST_DEV isn't 512:

  splice-test: write: /mnt/test/a: Invalid argument

To fix this issue, this patch help src/splice-test.c to get a specify
sector size from the test case. Then let g/591 give it a proper
sector size which dio aligned.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
22 months agogeneric/591: remove redundant output from golden image
Zorro Lang [Sun, 29 May 2022 08:13:25 +0000 (16:13 +0800)]
generic/591: remove redundant output from golden image

In generic/591.out expects below output:
  concurrent reader with O_DIRECT
  concurrent reader with O_DIRECT     <=== ???
  concurrent reader without O_DIRECT
  concurrent reader without O_DIRECT  <=== ???
  sequential reader with O_DIRECT
  sequential reader without O_DIRECT

The lines marked "???" are unbelievable, due to the src/splice-test.c
only calls printf to output that message once in main function. So
Why splice-test prints that message twice sometimes? It seems related
with the "-r" option, due to the test lines without "-r" option only
print one line each time running.

A stanger thing is this "double output" issue only can be triggered by
running g/591, can't reproduce it by running splice-test manually.

By checking the code of splice-test.c, I found a "fork()" in it, and
it'll be called if the '-r' option is specified. So I suspect the
redundant output come from the child process. By the help of strace
tool, I got:

  10554 execve("/root/git/xfstests/src/splice-test", ["/root/git/xfstests/src/splice-te"..., "-r", "/mnt/test/a"], 0x7ffcabc2c0a8 /* 202 vars */) = 0
  ...
  10554 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f937f5d5a10) = 10555
  ...
  10555 read(4, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., 512) = 512
  10555 write(1, "concurrent reader with O_DIRECT\n", 32) = 32
  10555 exit_group(0)                     = ?
  10555 +++ exited with 0 +++
  10554 <... wait4 resumed>NULL, 0, NULL) = 10555
  10554 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=10555, si_uid=0, si_status=0, si_utime=0, si_stime=1} ---
  10554 unlink("/mnt/test/a")             = 0
  10554 write(1, "concurrent reader with O_DIRECT\n", 32) = 32
  10554 exit_group(0)                     = ?
  10554 +++ exited with 0 +++

We can see the "concurrent reader with O_DIRECT\n" be printed by
parent process 10554 and child process 10555 separately.

Due to the stdout redirection that fstests does cause the stream
doesn't refer to a tty anymore, then the stdout become block
buffered, so the '\n' doesn't help to flush that printf message,
and the child print it again.

So use setlinebuf(stdout) to force it line buffered, to avoid the
confused output to be golden image. Then correct the generic/591.out

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
22 months agogeneric/506: call _require_quota before _qmount
Zorro Lang [Sun, 29 May 2022 09:03:36 +0000 (17:03 +0800)]
generic/506: call _require_quota before _qmount

The g/506 fails on some filesystems (e.g. overlay) which doesn't
support prjquota:

  MOUNT_OPTIONS =  -o prjquota
  qmount failed

To avoid this failure, call _require_quota before doing real quota
mount.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
22 months agogeneric/139: require 512 bytes to be the minimum dio size
Zorro Lang [Thu, 2 Jun 2022 05:17:16 +0000 (13:17 +0800)]
generic/139: require 512 bytes to be the minimum dio size

Due to generic/139 tests base on 512 bytes aligned, so skip this test
if the minimum dio write size >512. This patch also change the
common/rc::_require_dio helper, supports a minimum aligned size
argument.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
22 months agocommon/rc: Fix _require_batched_discard to skip test correctly
Liu Yiding [Tue, 31 May 2022 07:12:52 +0000 (15:12 +0800)]
common/rc: Fix _require_batched_discard to skip test correctly

xfstest commit ee264b3f ("common/rc: Modify _require_batched_discard to
improve test coverage") changed the way of determing if discard is
supported by checking whether fstrim output contains "not supported"
keywords.

On RHEL, fstrim output below info when discard is not supported
"fstrim: /mnt/share0/: FITRIM ioctl failed: Function not implemented"

Supplyment unsupported keywords to _require_batched_discard.

Signed-off-by: Liu Yiding <liuyd.fnst@fujitsu.com>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agoext4/053: update the test_dummy_encryption tests
Eric Biggers [Mon, 30 May 2022 17:30:44 +0000 (10:30 -0700)]
ext4/053: update the test_dummy_encryption tests

Kernel commit 5f41fdaea63d ("ext4: only allow test_dummy_encryption when
supported") tightened the requirements on when the test_dummy_encryption
mount option is accepted.  Update ext4/053 accordingly.

Move the test cases to later in the file to group them with the other
test cases that use do_mkfs to add custom mkfs options instead of using
the "default" filesystem that the test creates at the beginning.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agogeneric: adjust strict SPO recovery testcases for f2fs
Chao Yu [Sat, 21 May 2022 03:16:21 +0000 (11:16 +0800)]
generic: adjust strict SPO recovery testcases for f2fs

Testcases like generic 342/502/526/527 expect that filesystems will
recover all related metadata changes to the file which was fsynced
before sudden power off.

This patch adjusts to use "fsync_mode=strict" mountoption for f2fs
to pass these testcases.

Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agobtrfs: test direct I/O read repair with interleaved corrupted sectors v2022.05.29
Christoph Hellwig [Fri, 27 May 2022 08:19:15 +0000 (10:19 +0200)]
btrfs: test direct I/O read repair with interleaved corrupted sectors

Test that repair handles the case where it needs to read from more than
a single mirror on the raid1c3 profile and needs to take turns over the
mirrors to recover data for the whole read.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agobtrfs: test buffered I/O read repair with interleaved corrupted sectors
Christoph Hellwig [Fri, 27 May 2022 08:19:14 +0000 (10:19 +0200)]
btrfs: test buffered I/O read repair with interleaved corrupted sectors

Test that repair handles the case where it needs to read from more than
a single mirror on the raid1c3 profile and needs to take turns over the
mirrors to recover data for the whole read.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agobtrfs: test repair with sectors corrupted in multiple mirrors
Christoph Hellwig [Fri, 27 May 2022 08:19:13 +0000 (10:19 +0200)]
btrfs: test repair with sectors corrupted in multiple mirrors

Test that repair handles the case where it needs to read from more than
a single mirror on the raid1c3 profile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agobtrfs/215: use _btrfs_get_first_logical
Christoph Hellwig [Fri, 27 May 2022 08:19:12 +0000 (10:19 +0200)]
btrfs/215: use _btrfs_get_first_logical

Use the _btrfs_get_first_logical helper instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agobtrfs/157: use _btrfs_get_first_logical
Christoph Hellwig [Fri, 27 May 2022 08:19:11 +0000 (10:19 +0200)]
btrfs/157: use _btrfs_get_first_logical

Use the _btrfs_get_first_logical helper instead of open coding it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agobtrfs/143: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:10 +0000 (10:19 +0200)]
btrfs/143: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agobtrfs/142: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:09 +0000 (10:19 +0200)]
btrfs/142: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
22 months agobtrfs/141: use common read repair helpers
Christoph Hellwig [Fri, 27 May 2022 08:19:08 +0000 (10:19 +0200)]
btrfs/141: use common read repair helpers

Use the common helpers to find the btrfs logical address and to read from
a specific mirror.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>