diff mbox series

[v2,3/7] btrfs: add fstest for stripe-tree metadata with 4k write

Message ID 20231205-btrfs-raid-v2-3-25f80eea345b@wdc.com (mailing list archive)
State New, archived
Headers show
Series fstests: add tests for btrfs' raid-stripe-tree feature | expand

Commit Message

Johannes Thumshirn Dec. 5, 2023, 12:45 p.m. UTC
Test a simple 4k write on all RAID profiles currently supported with the
raid-stripe-tree.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 tests/btrfs/302     | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/302.out | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+)

Comments

Filipe Manana Dec. 5, 2023, 5:11 p.m. UTC | #1
On Tue, Dec 5, 2023 at 12:45 PM Johannes Thumshirn
<johannes.thumshirn@wdc.com> wrote:
>
> Test a simple 4k write on all RAID profiles currently supported with the
> raid-stripe-tree.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  tests/btrfs/302     | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/302.out | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++

Btw, tests 302 and 303 already exist, you need to refresh your local repo.

So I tried this locally, renaming the test from 302 to 304, and it
fails on current misc-next and btrfs-progs 6.6.2:

root 17:08:09 /home/fdmanana/git/hub/xfstests > ./check btrfs/304
FSTYP         -- btrfs
PLATFORM      -- Linux/x86_64 debian0 6.7.0-rc3-btrfs-next-143+ #1 SMP
PREEMPT_DYNAMIC Mon Dec  4 11:01:37 WET 2023
MKFS_OPTIONS  -- /dev/sdb
MOUNT_OPTIONS -- /dev/sdb /home/fdmanana/btrfs-tests/scratch_1

btrfs/304       - output mismatch (see
/home/fdmanana/git/hub/xfstests/results//btrfs/304.out.bad)
    --- tests/btrfs/304.out 2023-12-05 17:08:16.096135003 +0000
    +++ /home/fdmanana/git/hub/xfstests/results//btrfs/304.out.bad
2023-12-05 17:08:18.700218463 +0000
    @@ -5,16 +5,6 @@
     XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
     5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo

    -raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0)
    -leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
    -leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
    -checksum stored <CHECKSUM>
    ...
    (Run 'diff -u /home/fdmanana/git/hub/xfstests/tests/btrfs/304.out
/home/fdmanana/git/hub/xfstests/results//btrfs/304.out.bad'  to see
the entire diff)
Ran: btrfs/304
Failures: btrfs/304
Failed 1 of 1 tests

root 17:08:18 /home/fdmanana/git/hub/xfstests > diff -u
/home/fdmanana/git/hub/xfstests/tests/btrfs/304.out
/home/fdmanana/git/hub/xfstests/results//btrfs/304.out.bad
--- /home/fdmanana/git/hub/xfstests/tests/btrfs/304.out 2023-12-05
17:08:16.096135003 +0000
+++ /home/fdmanana/git/hub/xfstests/results//btrfs/304.out.bad
2023-12-05 17:08:18.700218463 +0000
@@ -5,16 +5,6 @@
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo

-raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0)
-leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
-leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
-checksum stored <CHECKSUM>
-checksum calced <CHECKSUM>
-fs uuid <UUID>
-chunk uuid <UUID>
- item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24
- encoding: RAID0
- stripe 0 devid 1 physical XXXXXXXXX
 total bytes XXXXXXXX
 bytes used XXXXXX
 uuid <UUID>
@@ -23,17 +13,6 @@
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo

-raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0)
-leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
-leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
-checksum stored <CHECKSUM>
-checksum calced <CHECKSUM>
-fs uuid <UUID>
-chunk uuid <UUID>
- item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40
- encoding: RAID1
- stripe 0 devid 1 physical XXXXXXXXX
- stripe 1 devid 2 physical XXXXXXXXX
 total bytes XXXXXXXX
 bytes used XXXXXX
 uuid <UUID>
@@ -42,17 +21,6 @@
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo

-raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0)
-leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
-leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
-checksum stored <CHECKSUM>
-checksum calced <CHECKSUM>
-fs uuid <UUID>
-chunk uuid <UUID>
- item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40
- encoding: RAID10
- stripe 0 devid 1 physical XXXXXXXXX
- stripe 1 devid 2 physical XXXXXXXXX
 total bytes XXXXXXXX
 bytes used XXXXXX
-uuid <UUID>
\ No newline at end of file
+uuid <UUID>
root 17:08:34 /home/fdmanana/git/hub/xfstests >


Any ideias?

Thanks.


>  2 files changed, 111 insertions(+)
>
> diff --git a/tests/btrfs/302 b/tests/btrfs/302
> new file mode 100755
> index 000000000000..5d32ca8ba92f
> --- /dev/null
> +++ b/tests/btrfs/302
> @@ -0,0 +1,53 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2023 Western Digital Cooperation.  All Rights Reserved.
> +#
> +# FS QA Test 302
> +#
> +# Test on-disk layout of RAID Stripe Tree Metadata writing 4k to a new file on
> +# a pristine file system.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick raid remount volume raid-stripe-tree
> +
> +. ./common/filter
> +. ./common/filter.btrfs
> +
> +_supported_fs btrfs
> +_require_btrfs_command inspect-internal dump-tree
> +_require_btrfs_mkfs_feature "raid-stripe-tree"
> +_require_scratch_dev_pool 4
> +_require_btrfs_fs_feature "raid_stripe_tree"
> +
> +test_4k_write()
> +{
> +       local profile=$1
> +       local ndevs=$2
> +
> +       _scratch_dev_pool_get $ndevs
> +
> +       echo "==== Testing $profile ===="
> +       _scratch_pool_mkfs -d $profile -m $profile
> +       _scratch_mount
> +
> +       $XFS_IO_PROG -fc "pwrite 0 4k" "$SCRATCH_MNT/foo" | _filter_xfs_io
> +
> +       _scratch_cycle_mount
> +       md5sum "$SCRATCH_MNT/foo" | _filter_scratch
> +
> +       _scratch_unmount
> +
> +       $BTRFS_UTIL_PROG inspect-internal dump-tree -t raid_stripe $SCRATCH_DEV_POOL |\
> +               _filter_btrfs_version |  _filter_stripe_tree
> +
> +       _scratch_dev_pool_put
> +}
> +
> +echo "= Test basic 4k write ="
> +test_4k_write raid0 2
> +test_4k_write raid1 2
> +test_4k_write raid10 4
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/btrfs/302.out b/tests/btrfs/302.out
> new file mode 100644
> index 000000000000..149630e69501
> --- /dev/null
> +++ b/tests/btrfs/302.out
> @@ -0,0 +1,58 @@
> +QA output created by 302
> += Test basic 4k write =
> +==== Testing raid0 ====
> +wrote 4096/4096 bytes at offset 0
> +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> +5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo
> +
> +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0)
> +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
> +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
> +checksum stored <CHECKSUM>
> +checksum calced <CHECKSUM>
> +fs uuid <UUID>
> +chunk uuid <UUID>
> +       item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24
> +                       encoding: RAID0
> +                       stripe 0 devid 1 physical XXXXXXXXX
> +total bytes XXXXXXXX
> +bytes used XXXXXX
> +uuid <UUID>
> +==== Testing raid1 ====
> +wrote 4096/4096 bytes at offset 0
> +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> +5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo
> +
> +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0)
> +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
> +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
> +checksum stored <CHECKSUM>
> +checksum calced <CHECKSUM>
> +fs uuid <UUID>
> +chunk uuid <UUID>
> +       item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40
> +                       encoding: RAID1
> +                       stripe 0 devid 1 physical XXXXXXXXX
> +                       stripe 1 devid 2 physical XXXXXXXXX
> +total bytes XXXXXXXX
> +bytes used XXXXXX
> +uuid <UUID>
> +==== Testing raid10 ====
> +wrote 4096/4096 bytes at offset 0
> +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> +5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo
> +
> +raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0)
> +leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
> +leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
> +checksum stored <CHECKSUM>
> +checksum calced <CHECKSUM>
> +fs uuid <UUID>
> +chunk uuid <UUID>
> +       item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40
> +                       encoding: RAID10
> +                       stripe 0 devid 1 physical XXXXXXXXX
> +                       stripe 1 devid 2 physical XXXXXXXXX
> +total bytes XXXXXXXX
> +bytes used XXXXXX
> +uuid <UUID>
>
> --
> 2.43.0
>
>
Johannes Thumshirn Dec. 5, 2023, 5:18 p.m. UTC | #2
On 05.12.23 18:12, Filipe Manana wrote:
> On Tue, Dec 5, 2023 at 12:45 PM Johannes Thumshirn
> <johannes.thumshirn@wdc.com> wrote:
>>
>> Test a simple 4k write on all RAID profiles currently supported with the
>> raid-stripe-tree.
>>
>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>


[...]

> 
> 
> Any ideias?
> 

Oh for non-zoned drives, you do actually need "-O raid-stripe-tree" 
added to mkfs. Will fix this ASAP, so it can be run on non-zoned as well.
Filipe Manana Dec. 5, 2023, 5:22 p.m. UTC | #3
On Tue, Dec 5, 2023 at 5:19 PM Johannes Thumshirn
<Johannes.Thumshirn@wdc.com> wrote:
>
> On 05.12.23 18:12, Filipe Manana wrote:
> > On Tue, Dec 5, 2023 at 12:45 PM Johannes Thumshirn
> > <johannes.thumshirn@wdc.com> wrote:
> >>
> >> Test a simple 4k write on all RAID profiles currently supported with the
> >> raid-stripe-tree.
> >>
> >> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>
>
> [...]
>
> >
> >
> > Any ideias?
> >
>
> Oh for non-zoned drives, you do actually need "-O raid-stripe-tree"
> added to mkfs. Will fix this ASAP, so it can be run on non-zoned as well.

Ok, that's it, running as:   MKFS_OPTIONS="-O raid-stripe-tree"
./check btrfs/304
The test passes.

Thanks.

>
Johannes Thumshirn Dec. 5, 2023, 5:29 p.m. UTC | #4
On 05.12.23 18:22, Filipe Manana wrote:
> On Tue, Dec 5, 2023 at 5:19 PM Johannes Thumshirn
> <Johannes.Thumshirn@wdc.com> wrote:
>>
>> On 05.12.23 18:12, Filipe Manana wrote:
>>> On Tue, Dec 5, 2023 at 12:45 PM Johannes Thumshirn
>>> <johannes.thumshirn@wdc.com> wrote:
>>>>
>>>> Test a simple 4k write on all RAID profiles currently supported with the
>>>> raid-stripe-tree.
>>>>
>>>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>>
>>
>> [...]
>>
>>>
>>>
>>> Any ideias?
>>>
>>
>> Oh for non-zoned drives, you do actually need "-O raid-stripe-tree"
>> added to mkfs. Will fix this ASAP, so it can be run on non-zoned as well.
> 
> Ok, that's it, running as:   MKFS_OPTIONS="-O raid-stripe-tree"
> ./check btrfs/304
> The test passes.

Perfect.
diff mbox series

Patch

diff --git a/tests/btrfs/302 b/tests/btrfs/302
new file mode 100755
index 000000000000..5d32ca8ba92f
--- /dev/null
+++ b/tests/btrfs/302
@@ -0,0 +1,53 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Western Digital Cooperation.  All Rights Reserved.
+#
+# FS QA Test 302
+#
+# Test on-disk layout of RAID Stripe Tree Metadata writing 4k to a new file on
+# a pristine file system.
+#
+. ./common/preamble
+_begin_fstest auto quick raid remount volume raid-stripe-tree
+
+. ./common/filter
+. ./common/filter.btrfs
+
+_supported_fs btrfs
+_require_btrfs_command inspect-internal dump-tree
+_require_btrfs_mkfs_feature "raid-stripe-tree"
+_require_scratch_dev_pool 4
+_require_btrfs_fs_feature "raid_stripe_tree"
+
+test_4k_write()
+{
+	local profile=$1
+	local ndevs=$2
+
+	_scratch_dev_pool_get $ndevs
+
+	echo "==== Testing $profile ===="
+	_scratch_pool_mkfs -d $profile -m $profile
+	_scratch_mount
+
+	$XFS_IO_PROG -fc "pwrite 0 4k" "$SCRATCH_MNT/foo" | _filter_xfs_io
+
+	_scratch_cycle_mount
+	md5sum "$SCRATCH_MNT/foo" | _filter_scratch
+
+	_scratch_unmount
+
+	$BTRFS_UTIL_PROG inspect-internal dump-tree -t raid_stripe $SCRATCH_DEV_POOL |\
+		_filter_btrfs_version |  _filter_stripe_tree
+
+	_scratch_dev_pool_put
+}
+
+echo "= Test basic 4k write ="
+test_4k_write raid0 2
+test_4k_write raid1 2
+test_4k_write raid10 4
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/302.out b/tests/btrfs/302.out
new file mode 100644
index 000000000000..149630e69501
--- /dev/null
+++ b/tests/btrfs/302.out
@@ -0,0 +1,58 @@ 
+QA output created by 302
+= Test basic 4k write =
+==== Testing raid0 ====
+wrote 4096/4096 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo
+
+raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) 
+leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
+leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
+checksum stored <CHECKSUM>
+checksum calced <CHECKSUM>
+fs uuid <UUID>
+chunk uuid <UUID>
+	item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 1 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>
+==== Testing raid1 ====
+wrote 4096/4096 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo
+
+raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) 
+leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
+leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
+checksum stored <CHECKSUM>
+checksum calced <CHECKSUM>
+fs uuid <UUID>
+chunk uuid <UUID>
+	item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40
+			encoding: RAID1
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>
+==== Testing raid10 ====
+wrote 4096/4096 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+5fed275e7617a806f94c173746a2a723  SCRATCH_MNT/foo
+
+raid stripe tree key (RAID_STRIPE_TREE ROOT_ITEM 0) 
+leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE
+leaf XXXXXXXXX flags 0x1(WRITTEN) backref revision 1
+checksum stored <CHECKSUM>
+checksum calced <CHECKSUM>
+fs uuid <UUID>
+chunk uuid <UUID>
+	item 0 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>