Skip to contentSkip to conversation

fstests: add tests for btrfs' raid-stripe-tree feature

PATCH Superseded Johannes Thumshirn 4 participants 15 messages Dec 7, 2023 – Dec 11, 2023 Btrfs file system

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover fstests: add tests for btrfs' raid-stripe-tree feature

Add tests for btrfs' raid-stripe-tree feature. All of these test work by writing a specific pattern to a newly created filesystem and afterwards using btrfs inspect-internal -t raid-stripe $SCRATCH_DEV_POOL to verify the placement and the layout of the metadata.

The md5sum of each file will be compared as well after a re-mount of the filesystem.

---
Changes in v5:
- add _require_btrfs_free_space_tree helper and use in tests
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- add _require_btrfs_no_compress to all tests
- add _require_btrfs_no_nodatacow helper and add to btrfs/308
- add _require_btrfs_feature "free_space_tree" to all tests
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- added 'raid-stripe-tree' to mkfs options, as only zoned raid gets it automatically
- Rename test cases as btrfs/302 and btrfs/303 already exist upstream
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Re-ordered series so the newly introduced group is added before the tests
- Changes Filipe requested to the tests.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Johannes Thumshirn (9):
fstests: doc: add new raid-stripe-tree group
common: add filter for btrfs raid-stripe dump
common: add _require_btrfs_no_nodatacow helper
common: add _require_btrfs_free_space_tree
btrfs: add fstest for stripe-tree metadata with 4k write
btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree
btrfs: add fstest for writing to a file at an offset with RST
btrfs: add fstests to write 128k to a RST filesystem
btrfs: add fstest for overwriting a file partially with RST

 common/btrfs        |  17 +++++++++
 common/filter.btrfs |  14 +++++++
 doc/group-names.txt |   1 +
 tests/btrfs/304     |  56 +++++++++++++++++++++++++++
 tests/btrfs/304.out |  58 ++++++++++++++++++++++++++++
 tests/btrfs/305     |  61 ++++++++++++++++++++++++++++++
 tests/btrfs/305.out |  82 ++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/306     |  59 +++++++++++++++++++++++++++++
 tests/btrfs/306.out |  75 +++++++++++++++++++++++++++++++++++++
 tests/btrfs/307     |  56 +++++++++++++++++++++++++++
 tests/btrfs/307.out |  65 ++++++++++++++++++++++++++++++++
 tests/btrfs/308     |  60 +++++++++++++++++++++++++++++
 tests/btrfs/308.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 13 files changed, 710 insertions(+)

---
base-commit: baca8a2b5cb6e798ce3a07e79a081031370c6cb8
change-id: 20231204-btrfs-raid-75975797f97d

Best regards,

Signature · 1 line
Johannes Thumshirn <[email protected]>
#1 lore raw

PATCH v5 1/9 fstests: doc: add new raid-stripe-tree group

Add a new test group for testing the raid-stripe-tree feature of btrfs with fstests.

---
 doc/group-names.txt | 1 +
 1 file changed, 1 insertion(+)
doc/group-names.txt +1 -0
index c3dcca375537..9c1624868518 100644
@@ -94,6 +94,7 @@ punch			fallocate FALLOC_FL_PUNCH_HOLE
 qgroup			btrfs qgroup feature
 quota			filesystem usage quotas
 raid			btrfs RAID
+raid-stripe-tree	btrfs raid-stripe-tree feature
 read_repair		btrfs error correction on read failure
 realtime		XFS realtime volumes
 recoveryloop		crash recovery loops
Signature · 1 line
2.43.0
#2 lore raw

PATCH v5 2/9 common: add filter for btrfs raid-stripe dump

In reply to Johannes Thumshirn
---
 common/filter.btrfs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
common/filter.btrfs +14 -0
index 02c6b92dfa94..2003ba7b7015 100644
@@ -125,5 +125,19 @@ _filter_btrfs_cloner_error()
 	sed -e "s/\(clone failed:\) Operation not supported/\1 Invalid argument/g"
 }
 
+# filter output of "btrfs inspect-internal dump-tree -t raid-stripe"
+_filter_stripe_tree()
+{
+	sed -E -e "s/leaf [0-9]+ items [0-9]+ free space [0-9]+ generation [0-9]+ owner RAID_STRIPE_TREE/leaf XXXXXXXXX items X free space XXXXX generation X owner RAID_STRIPE_TREE/" \
+		-e "s/leaf [0-9]+ flags 0x1\(WRITTEN\) backref revision 1/leaf XXXXXXXXX flags 0x1\(WRITTEN\) backref revision 1/" \
+		-e "s/checksum stored [0-9a-f]+/checksum stored <CHECKSUM>/"  \
+		-e "s/checksum calced [0-9a-f]+/checksum calced <CHECKSUM>/"  \
+		-e "s/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/<UUID>/" \
+		-e "s/item ([0-9]+) key \([0-9]+ RAID_STRIPE ([0-9]+)\) itemoff [0-9]+ itemsize ([0-9]+)/item \1 key \(XXXXXX RAID_STRIPE \2\) itemoff XXXXX itemsize \3/" \
+		-e "s/stripe ([0-9]+) devid ([0-9]+) physical [0-9]+/stripe \1 devid \2 physical XXXXXXXXX/" \
+		-e "s/total bytes [0-9]+/total bytes XXXXXXXX/" \
+		-e "s/bytes used [0-9]+/bytes used XXXXXX/"
+}
+
 # make sure this script returns success
 /bin/true
Signature · 1 line
2.43.0
#3 lore raw

PATCH v5 3/9 common: add _require_btrfs_no_nodatacow helper

In reply to Johannes Thumshirn
---
 common/btrfs | 7 +++++++
 1 file changed, 7 insertions(+)
common/btrfs +7 -0
index e3ccb4fa07d4..bf69bcee158b 100644
@@ -120,6 +120,13 @@ _require_btrfs_no_compress()
 	fi
 }
 
+_require_btrfs_no_nodatacow()
+{
+	if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "nodatacow"; then
+		_notrun "This test requires no nodatacow enabled"
+	fi
+}
+
 _require_btrfs_no_block_group_tree()
 {
 	_scratch_mkfs > /dev/null 2>&1
Signature · 1 line
2.43.0
#4 lore raw

PATCH v5 4/9 common: add _require_btrfs_free_space_tree

In reply to Johannes Thumshirn
---
 common/btrfs | 10 ++++++++++
 1 file changed, 10 insertions(+)
common/btrfs +10 -0
index bf69bcee158b..95e46726a801 100644
@@ -137,6 +137,16 @@ _require_btrfs_no_block_group_tree()
 	fi
 }
 
+_require_btrfs_free_space_tree()
+{
+	_scratch_mkfs > /dev/null 2>&1
+	if ! $BTRFS_UTIL_PROG inspect-internal dump-super $SCRATCH_DEV | \
+		grep -q "FREE_SPACE_TREE"
+	then
+		_notrun "This test requires a free-space-tree"
+	fi
+}
+
 _check_btrfs_filesystem()
 {
 	device=$1
Signature · 1 line
2.43.0
#5 lore raw

PATCH v5 5/9 btrfs: add fstest for stripe-tree metadata with 4k write

In reply to Johannes Thumshirn

Test a simple 4k write on all RAID profiles currently supported with the raid-stripe-tree.

---
 tests/btrfs/304     | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/304.out | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+)
tests/btrfs/304 new file +56 -0
new file mode 100755
index 000000000000..7774a1bd74d0
@@ -0,0 +1,56 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Western Digital Cooperation.  All Rights Reserved.
+#
+# FS QA Test 304
+#
+# 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"
+_require_btrfs_fs_feature "free_space_tree"
+_require_btrfs_free_space_tree
+_require_btrfs_no_compress
+
+test_4k_write()
+{
+	local profile=$1
+	local ndevs=$2
+
+	_scratch_dev_pool_get $ndevs
+
+	echo "==== Testing $profile ===="
+	_scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree
+	_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
tests/btrfs/304.out new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
2.43.0
#6 lore raw

PATCH v5 6/9 btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree

In reply to Johannes Thumshirn

Add a test-case writing 8k to a raid-stripe-tree formatted filesystem with one stripe pre-filled to 60k so the 8k are split into a 4k write finishing stripe 1 and a 4k write starting the next stripe.

---
 tests/btrfs/305     | 61 +++++++++++++++++++++++++++++++++++++++
 tests/btrfs/305.out | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 143 insertions(+)
tests/btrfs/305 new file +61 -0
new file mode 100755
index 000000000000..df8a12ab9a6a
@@ -0,0 +1,61 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Western Digital Cooperation.  All Rights Reserved.
+#
+# FS QA Test 305
+#
+# Test on-disk layout of RAID Stripe Tree Metadata by writing 8k to a new file
+# with a filesystem prepropulated, so that 4k of the write are written to the
+# 1st stripe and 4k start a new stripe.
+#
+. ./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"
+_require_btrfs_fs_feature "free_space_tree"
+_require_btrfs_free_space_tree
+_require_btrfs_no_compress
+
+test_8k_new_stripe()
+{
+	local profile=$1
+	local ndevs=$2
+
+	_scratch_dev_pool_get $ndevs
+
+	echo "==== Testing $profile ===="
+	_scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree
+	_scratch_mount
+
+	# Fill the first stripe up to 64k - 4k
+	$XFS_IO_PROG -fc "pwrite 0 60k" -c fsync "$SCRATCH_MNT/bar" | _filter_xfs_io
+
+	# The actual 8k write
+	$XFS_IO_PROG -fc "pwrite 0 8k" "$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 8k write to a new file so that 4k start a new stripe ="
+test_8k_new_stripe raid0 2
+test_8k_new_stripe raid1 2
+test_8k_new_stripe raid10 4
+
+# success, all done
+status=0
+exit
tests/btrfs/305.out new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
2.43.0
#7 lore raw

PATCH v5 7/9 btrfs: add fstest for writing to a file at an offset with RST

In reply to Johannes Thumshirn

Add a fstest writing 4k at offset 64k to a file with one RAID tripe already pre-filled for a raid-stripe-tree formatted file system.

---
 tests/btrfs/306     | 59 +++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/306.out | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 134 insertions(+)
tests/btrfs/306 new file +59 -0
new file mode 100755
index 000000000000..72c066aa6940
@@ -0,0 +1,59 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Western Digital Cooperation.  All Rights Reserved.
+#
+# FS QA Test 306
+#
+# Test on-disk layout of RAID Stripe Tree Metadata by writing 4k to an emppty
+# file at offset 64k with one stripe pre-filled on an otherwise pristine
+# filesystem.
+#
+. ./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"
+_require_btrfs_fs_feature "free_space_tree"
+_require_btrfs_free_space_tree
+_require_btrfs_no_compress
+
+test_4k_write_64koff()
+{
+	local profile=$1
+	local ndevs=$2
+
+	_scratch_dev_pool_get $ndevs
+
+	echo "==== Testing $profile ===="
+	_scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree
+	_scratch_mount
+
+	# precondition one stripe
+	$XFS_IO_PROG -fc "pwrite 0 64k" "$SCRATCH_MNT/bar" | _filter_xfs_io
+
+	$XFS_IO_PROG -fc "pwrite 64k 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 4k write to an empty file at offset 64k with one stripe prefilled ="
+test_4k_write_64koff raid0 2
+test_4k_write_64koff raid1 2
+test_4k_write_64koff raid10 4
+
+# success, all done
+status=0
+exit
tests/btrfs/306.out new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.43.0
#8 lore raw

PATCH v5 8/9 btrfs: add fstests to write 128k to a RST filesystem

In reply to Johannes Thumshirn

Add a test writing 128k to a file on an empty filesystem formatted with a raid-stripe-tree.

---
 tests/btrfs/307     | 56 +++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/307.out | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+)
tests/btrfs/307 new file +56 -0
new file mode 100755
index 000000000000..9509019b50cc
@@ -0,0 +1,56 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Western Digital Cooperation.  All Rights Reserved.
+#
+# FS QA Test 307
+#
+# Test on-disk layout of RAID Stripe Tree Metadata by writing 128k to a new
+# file on a pristine filesystem
+#
+. ./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"
+_require_btrfs_fs_feature "free_space_tree"
+_require_btrfs_free_space_tree
+_require_btrfs_no_compress
+
+test_128k_write()
+{
+	local profile=$1
+	local ndevs=$2
+
+	_scratch_dev_pool_get $ndevs
+
+	echo "==== Testing $profile ===="
+	_scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree
+	_scratch_mount
+
+	$XFS_IO_PROG -fc "pwrite 0 128k" "$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 128k write to empty file  ="
+test_128k_write raid0 2
+test_128k_write raid1 2
+test_128k_write raid10 4
+
+# success, all done
+status=0
+exit
tests/btrfs/307.out new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.43.0
#9 lore raw

PATCH v5 9/9 btrfs: add fstest for overwriting a file partially with RST

In reply to Johannes Thumshirn

Add a test writing 128k to an empty file with one stripe already pre-filled on-disk. Then overwrite a portion of the file in the middle.

---
 tests/btrfs/308     |  60 +++++++++++++++++++++++++++++
 tests/btrfs/308.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 166 insertions(+)
tests/btrfs/308 new file +60 -0
new file mode 100755
index 000000000000..eb63acf6a9f2
@@ -0,0 +1,60 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Western Digital Cooperation.  All Rights Reserved.
+#
+# FS QA Test 308
+#
+# Test on-disk layout of RAID Stripe Tree Metadata by writing 128k to an empty
+# file on a filesystem that has one stripe already pre-filled. Afterwards
+# overwrite a portion of the file.
+#
+. ./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"
+_require_btrfs_fs_feature "free_space_tree"
+_require_btrfs_free_space_tree
+_require_btrfs_no_compress
+_require_btrfs_no_nodatacow
+
+test_128k_write_overwrite()
+{
+	local profile=$1
+	local ndevs=$2
+
+	_scratch_dev_pool_get $ndevs
+
+	echo "==== Testing $profile ===="
+	_scratch_pool_mkfs -d $profile -m $profile -O raid-stripe-tree
+	_scratch_mount
+
+	$XFS_IO_PROG -fc "pwrite -W 0 32k" "$SCRATCH_MNT/bar" | _filter_xfs_io
+	$XFS_IO_PROG -fc "pwrite -W 0 128k" "$SCRATCH_MNT/foo" | _filter_xfs_io
+	$XFS_IO_PROG -fc "pwrite -W 64k 8k" "$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 128k write to empty file with 1st stripe partially prefilled then overwrite ="
+test_128k_write_overwrite raid0 2
+test_128k_write_overwrite raid1 2
+test_128k_write_overwrite raid10 4
+
+# success, all done
+status=0
+exit
tests/btrfs/308.out new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
2.43.0
Reviewed-by on the v5 series
#10 lore raw
In reply to Johannes Thumshirn
Quoted 58 lines · Johannes Thumshirn

Add tests for btrfs' raid-stripe-tree feature. All of these test work by writing a specific pattern to a newly created filesystem and afterwards using btrfs inspect-internal -t raid-stripe $SCRATCH_DEV_POOL to verify the placement and the layout of the metadata.

The md5sum of each file will be compared as well after a re-mount of the filesystem.

---
Changes in v5:
- add _require_btrfs_free_space_tree helper and use in tests
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- add _require_btrfs_no_compress to all tests
- add _require_btrfs_no_nodatacow helper and add to btrfs/308
- add _require_btrfs_feature "free_space_tree" to all tests
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- added 'raid-stripe-tree' to mkfs options, as only zoned raid gets it automatically
- Rename test cases as btrfs/302 and btrfs/303 already exist upstream
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Re-ordered series so the newly introduced group is added before the tests
- Changes Filipe requested to the tests.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Johannes Thumshirn (9):
fstests: doc: add new raid-stripe-tree group
common: add filter for btrfs raid-stripe dump
common: add _require_btrfs_no_nodatacow helper
common: add _require_btrfs_free_space_tree
btrfs: add fstest for stripe-tree metadata with 4k write
btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree
btrfs: add fstest for writing to a file at an offset with RST
btrfs: add fstests to write 128k to a RST filesystem
btrfs: add fstest for overwriting a file partially with RST

 common/btrfs        |  17 +++++++++
 common/filter.btrfs |  14 +++++++
 doc/group-names.txt |   1 +
 tests/btrfs/304     |  56 +++++++++++++++++++++++++++
 tests/btrfs/304.out |  58 ++++++++++++++++++++++++++++
 tests/btrfs/305     |  61 ++++++++++++++++++++++++++++++
 tests/btrfs/305.out |  82 ++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/306     |  59 +++++++++++++++++++++++++++++
 tests/btrfs/306.out |  75 +++++++++++++++++++++++++++++++++++++
 tests/btrfs/307     |  56 +++++++++++++++++++++++++++
 tests/btrfs/307.out |  65 ++++++++++++++++++++++++++++++++
 tests/btrfs/308     |  60 +++++++++++++++++++++++++++++
 tests/btrfs/308.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 13 files changed, 710 insertions(+)
Quoted 2 lines

---
base-commit: baca8a2b5cb6e798ce3a07e79a081031370c6cb8

Btw this base commit does not exist in the official fstests repo. That commit is from the staging branch at https://github.com/kdave/xfstests

A "git am" will fail because the official fstests repo doesn't have _require_btrfs_no_block_group_tree() at common/btrfs,
so it needs to be manually adjusted when applying the 3rd patch.

I tried the tests and they look good, so:

One question I missed before. Test 304 for example does a 4K write and expects in the golden output to get a 4K raid stripe item. What happens on a machine with 64K page size? There the default sector size is 64K, will the write result in a 64K raid stripe item or will it be 4K? In the former case, it will make the test fail.

Thanks.

Quoted 7 lines

change-id: 20231204-btrfs-raid-75975797f97d

Best regards,
--
Johannes Thumshirn <[email protected]>

#11 lore raw
Quoted 72 lines · Filipe Manana
Quoted 58 lines · Johannes Thumshirn

Add tests for btrfs' raid-stripe-tree feature. All of these test work by writing a specific pattern to a newly created filesystem and afterwards using btrfs inspect-internal -t raid-stripe $SCRATCH_DEV_POOL to verify the placement and the layout of the metadata.

The md5sum of each file will be compared as well after a re-mount of the filesystem.

---
Changes in v5:
- add _require_btrfs_free_space_tree helper and use in tests
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- add _require_btrfs_no_compress to all tests
- add _require_btrfs_no_nodatacow helper and add to btrfs/308
- add _require_btrfs_feature "free_space_tree" to all tests
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- added 'raid-stripe-tree' to mkfs options, as only zoned raid gets it automatically
- Rename test cases as btrfs/302 and btrfs/303 already exist upstream
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Re-ordered series so the newly introduced group is added before the tests
- Changes Filipe requested to the tests.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Johannes Thumshirn (9):
fstests: doc: add new raid-stripe-tree group
common: add filter for btrfs raid-stripe dump
common: add _require_btrfs_no_nodatacow helper
common: add _require_btrfs_free_space_tree
btrfs: add fstest for stripe-tree metadata with 4k write
btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree
btrfs: add fstest for writing to a file at an offset with RST
btrfs: add fstests to write 128k to a RST filesystem
btrfs: add fstest for overwriting a file partially with RST

  common/btrfs        |  17 +++++++++
  common/filter.btrfs |  14 +++++++
  doc/group-names.txt |   1 +
  tests/btrfs/304     |  56 +++++++++++++++++++++++++++
  tests/btrfs/304.out |  58 ++++++++++++++++++++++++++++
  tests/btrfs/305     |  61 ++++++++++++++++++++++++++++++
  tests/btrfs/305.out |  82 ++++++++++++++++++++++++++++++++++++++++
  tests/btrfs/306     |  59 +++++++++++++++++++++++++++++
  tests/btrfs/306.out |  75 +++++++++++++++++++++++++++++++++++++
  tests/btrfs/307     |  56 +++++++++++++++++++++++++++
  tests/btrfs/307.out |  65 ++++++++++++++++++++++++++++++++
  tests/btrfs/308     |  60 +++++++++++++++++++++++++++++
  tests/btrfs/308.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  13 files changed, 710 insertions(+)
Quoted 2 lines

---
base-commit: baca8a2b5cb6e798ce3a07e79a081031370c6cb8

Btw this base commit does not exist in the official fstests repo. That commit is from the staging branch at https://github.com/kdave/xfstests

A "git am" will fail because the official fstests repo doesn't have _require_btrfs_no_block_group_tree() at common/btrfs,
so it needs to be manually adjusted when applying the 3rd patch.

I tried the tests and they look good, so:

Quoted 8 lines

One question I missed before. Test 304 for example does a 4K write and expects in the golden output to get a 4K raid stripe item. What happens on a machine with 64K page size? There the default sector size is 64K, will the write result in a 64K raid stripe item or will it be 4K? In the former case, it will make the test fail.

Testing on a 64K pagesize. Will run it. Apologies for intermittent responses; OOO until December 21.

Thanks Anand

Quoted 10 lines

Thanks.

Quoted 7 lines

change-id: 20231204-btrfs-raid-75975797f97d

Best regards,
--
Johannes Thumshirn <[email protected]>

#12 lore raw
Quoted 84 lines · Anand Jain
Quoted 72 lines · Filipe Manana
Quoted 58 lines · Johannes Thumshirn

Add tests for btrfs' raid-stripe-tree feature. All of these test work by writing a specific pattern to a newly created filesystem and afterwards using btrfs inspect-internal -t raid-stripe $SCRATCH_DEV_POOL to verify the placement and the layout of the metadata.

The md5sum of each file will be compared as well after a re-mount of the filesystem.

---
Changes in v5:
- add _require_btrfs_free_space_tree helper and use in tests
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- add _require_btrfs_no_compress to all tests
- add _require_btrfs_no_nodatacow helper and add to btrfs/308
- add _require_btrfs_feature "free_space_tree" to all tests
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- added 'raid-stripe-tree' to mkfs options, as only zoned raid gets it automatically
- Rename test cases as btrfs/302 and btrfs/303 already exist upstream
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Re-ordered series so the newly introduced group is added before the tests
- Changes Filipe requested to the tests.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Johannes Thumshirn (9):
fstests: doc: add new raid-stripe-tree group
common: add filter for btrfs raid-stripe dump
common: add _require_btrfs_no_nodatacow helper
common: add _require_btrfs_free_space_tree
btrfs: add fstest for stripe-tree metadata with 4k write
btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree
btrfs: add fstest for writing to a file at an offset with RST
btrfs: add fstests to write 128k to a RST filesystem
btrfs: add fstest for overwriting a file partially with RST

   common/btrfs        |  17 +++++++++
   common/filter.btrfs |  14 +++++++
   doc/group-names.txt |   1 +
   tests/btrfs/304     |  56 +++++++++++++++++++++++++++
   tests/btrfs/304.out |  58 ++++++++++++++++++++++++++++
   tests/btrfs/305     |  61 ++++++++++++++++++++++++++++++
   tests/btrfs/305.out |  82 ++++++++++++++++++++++++++++++++++++++++
   tests/btrfs/306     |  59 +++++++++++++++++++++++++++++
   tests/btrfs/306.out |  75 +++++++++++++++++++++++++++++++++++++
   tests/btrfs/307     |  56 +++++++++++++++++++++++++++
   tests/btrfs/307.out |  65 ++++++++++++++++++++++++++++++++
   tests/btrfs/308     |  60 +++++++++++++++++++++++++++++
   tests/btrfs/308.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++
   13 files changed, 710 insertions(+)
Quoted 2 lines

---
base-commit: baca8a2b5cb6e798ce3a07e79a081031370c6cb8

Btw this base commit does not exist in the official fstests repo. That commit is from the staging branch at https://github.com/kdave/xfstests

A "git am" will fail because the official fstests repo doesn't have _require_btrfs_no_block_group_tree() at common/btrfs,
so it needs to be manually adjusted when applying the 3rd patch.

I tried the tests and they look good, so:

Quoted 8 lines

One question I missed before. Test 304 for example does a 4K write and expects in the golden output to get a 4K raid stripe item. What happens on a machine with 64K page size? There the default sector size is 64K, will the write result in a 64K raid stripe item or will it be 4K? In the former case, it will make the test fail.

Quoted 2 lines

Testing on a 64K pagesize. Will run it. Apologies for intermittent responses; OOO until December 21.

Thanks Anand!

I don't have a 64k page size system to test, but I _think_ Filipe is right, that will fail. I think we should skip these tests on non 4k sectors.

#13 lore raw
Quoted 86 lines · Johannes Thumshirn
Quoted 84 lines · Anand Jain
Quoted 80 lines · Filipe Manana
Quoted 58 lines · Johannes Thumshirn

Add tests for btrfs' raid-stripe-tree feature. All of these test work by writing a specific pattern to a newly created filesystem and afterwards using btrfs inspect-internal -t raid-stripe $SCRATCH_DEV_POOL to verify the placement and the layout of the metadata.

The md5sum of each file will be compared as well after a re-mount of the filesystem.

---
Changes in v5:
- add _require_btrfs_free_space_tree helper and use in tests
- Link to v4: https://lore.kernel.org/r/[email protected]

Changes in v4:
- add _require_btrfs_no_compress to all tests
- add _require_btrfs_no_nodatacow helper and add to btrfs/308
- add _require_btrfs_feature "free_space_tree" to all tests
- Link to v3: https://lore.kernel.org/r/[email protected]

Changes in v3:
- added 'raid-stripe-tree' to mkfs options, as only zoned raid gets it automatically
- Rename test cases as btrfs/302 and btrfs/303 already exist upstream
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Re-ordered series so the newly introduced group is added before the tests
- Changes Filipe requested to the tests.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Johannes Thumshirn (9):
fstests: doc: add new raid-stripe-tree group
common: add filter for btrfs raid-stripe dump
common: add _require_btrfs_no_nodatacow helper
common: add _require_btrfs_free_space_tree
btrfs: add fstest for stripe-tree metadata with 4k write
btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree
btrfs: add fstest for writing to a file at an offset with RST
btrfs: add fstests to write 128k to a RST filesystem
btrfs: add fstest for overwriting a file partially with RST

   common/btrfs        |  17 +++++++++
   common/filter.btrfs |  14 +++++++
   doc/group-names.txt |   1 +
   tests/btrfs/304     |  56 +++++++++++++++++++++++++++
   tests/btrfs/304.out |  58 ++++++++++++++++++++++++++++
   tests/btrfs/305     |  61 ++++++++++++++++++++++++++++++
   tests/btrfs/305.out |  82 ++++++++++++++++++++++++++++++++++++++++
   tests/btrfs/306     |  59 +++++++++++++++++++++++++++++
   tests/btrfs/306.out |  75 +++++++++++++++++++++++++++++++++++++
   tests/btrfs/307     |  56 +++++++++++++++++++++++++++
   tests/btrfs/307.out |  65 ++++++++++++++++++++++++++++++++
   tests/btrfs/308     |  60 +++++++++++++++++++++++++++++
   tests/btrfs/308.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++
   13 files changed, 710 insertions(+)
Quoted 2 lines

---
base-commit: baca8a2b5cb6e798ce3a07e79a081031370c6cb8

Btw this base commit does not exist in the official fstests repo. That commit is from the staging branch at https://github.com/kdave/xfstests

A "git am" will fail because the official fstests repo doesn't have _require_btrfs_no_block_group_tree() at common/btrfs,
so it needs to be manually adjusted when applying the 3rd patch.

I tried the tests and they look good, so:

One question I missed before. Test 304 for example does a 4K write and expects in the golden output to get a 4K raid stripe item. What happens on a machine with 64K page size? There the default sector size is 64K, will the write result in a 64K raid stripe item or will it be 4K? In the former case, it will make the test fail.

Quoted 8 lines
Quoted 2 lines

Testing on a 64K pagesize. Will run it. Apologies for intermittent responses; OOO until December 21.

Thanks Anand!

I don't have a 64k page size system to test, but I _think_ Filipe is right, that will fail. I think we should skip these tests on non 4k sectors.

Once we land the patch to default to 4k sector size[1] regardless of page size, this should all work across all architectures, no?

[1]: https://lore.kernel.org/linux-btrfs/[email protected]/

--
真実はいつも一つ!/ Always, there's only one truth!