public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/7] fstests: add tests for btrfs' raid-stripe-tree feature
@ 2023-12-05 12:45 Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 1/7] fstests: doc: add new raid-stripe-tree group Johannes Thumshirn
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 12:45 UTC (permalink / raw)
  To: Anand Jain, Zorro Lang
  Cc: Filipe Manana, fstests, linux-btrfs, 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 welli after a re-mount of the
filesystem.

---
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/20231204-btrfs-raid-v1-0-b254eb1bcff8@wdc.com

---
Johannes Thumshirn (7):
      fstests: doc: add new raid-stripe-tree group
      common: add filter for btrfs raid-stripe dump
      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/filter.btrfs |  14 +++++++
 doc/group-names.txt |   1 +
 tests/btrfs/302     |  53 ++++++++++++++++++++++++++
 tests/btrfs/302.out |  58 ++++++++++++++++++++++++++++
 tests/btrfs/303     |  58 ++++++++++++++++++++++++++++
 tests/btrfs/303.out |  82 ++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/304     |  56 +++++++++++++++++++++++++++
 tests/btrfs/304.out |  75 +++++++++++++++++++++++++++++++++++++
 tests/btrfs/305     |  53 ++++++++++++++++++++++++++
 tests/btrfs/305.out |  65 ++++++++++++++++++++++++++++++++
 tests/btrfs/306     |  56 +++++++++++++++++++++++++++
 tests/btrfs/306.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 12 files changed, 677 insertions(+)
---
base-commit: baca8a2b5cb6e798ce3a07e79a081031370c6cb8
change-id: 20231204-btrfs-raid-75975797f97d

Best regards,
-- 
Johannes Thumshirn <johannes.thumshirn@wdc.com>


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/7] fstests: doc: add new raid-stripe-tree group
  2023-12-05 12:45 [PATCH v2 0/7] fstests: add tests for btrfs' raid-stripe-tree feature Johannes Thumshirn
@ 2023-12-05 12:45 ` Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 2/7] common: add filter for btrfs raid-stripe dump Johannes Thumshirn
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 12:45 UTC (permalink / raw)
  To: Anand Jain, Zorro Lang
  Cc: Filipe Manana, fstests, linux-btrfs, Johannes Thumshirn

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

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 doc/group-names.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/doc/group-names.txt b/doc/group-names.txt
index c3dcca375537..9c1624868518 100644
--- a/doc/group-names.txt
+++ b/doc/group-names.txt
@@ -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

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/7] common: add filter for btrfs raid-stripe dump
  2023-12-05 12:45 [PATCH v2 0/7] fstests: add tests for btrfs' raid-stripe-tree feature Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 1/7] fstests: doc: add new raid-stripe-tree group Johannes Thumshirn
@ 2023-12-05 12:45 ` Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 3/7] btrfs: add fstest for stripe-tree metadata with 4k write Johannes Thumshirn
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 12:45 UTC (permalink / raw)
  To: Anand Jain, Zorro Lang
  Cc: Filipe Manana, fstests, linux-btrfs, Johannes Thumshirn

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 common/filter.btrfs | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/common/filter.btrfs b/common/filter.btrfs
index 02c6b92dfa94..2003ba7b7015 100644
--- a/common/filter.btrfs
+++ b/common/filter.btrfs
@@ -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

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 3/7] btrfs: add fstest for stripe-tree metadata with 4k write
  2023-12-05 12:45 [PATCH v2 0/7] fstests: add tests for btrfs' raid-stripe-tree feature Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 1/7] fstests: doc: add new raid-stripe-tree group Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 2/7] common: add filter for btrfs raid-stripe dump Johannes Thumshirn
@ 2023-12-05 12:45 ` Johannes Thumshirn
  2023-12-05 17:11   ` Filipe Manana
  2023-12-05 12:45 ` [PATCH v2 4/7] btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree Johannes Thumshirn
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 12:45 UTC (permalink / raw)
  To: Anand Jain, Zorro Lang
  Cc: Filipe Manana, fstests, linux-btrfs, Johannes Thumshirn

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(+)

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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 4/7] btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree
  2023-12-05 12:45 [PATCH v2 0/7] fstests: add tests for btrfs' raid-stripe-tree feature Johannes Thumshirn
                   ` (2 preceding siblings ...)
  2023-12-05 12:45 ` [PATCH v2 3/7] btrfs: add fstest for stripe-tree metadata with 4k write Johannes Thumshirn
@ 2023-12-05 12:45 ` Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 5/7] btrfs: add fstest for writing to a file at an offset with RST Johannes Thumshirn
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 12:45 UTC (permalink / raw)
  To: Anand Jain, Zorro Lang
  Cc: Filipe Manana, fstests, linux-btrfs, 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.

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

diff --git a/tests/btrfs/303 b/tests/btrfs/303
new file mode 100755
index 000000000000..9f3a5df16423
--- /dev/null
+++ b/tests/btrfs/303
@@ -0,0 +1,58 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Western Digital Cooperation.  All Rights Reserved.
+#
+# FS QA Test 303
+#
+# 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"
+
+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
+	_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
diff --git a/tests/btrfs/303.out b/tests/btrfs/303.out
new file mode 100644
index 000000000000..1259d0f4a587
--- /dev/null
+++ b/tests/btrfs/303.out
@@ -0,0 +1,82 @@
+QA output created by 303
+= Test 8k write to a new file so that 4k start a new stripe =
+==== Testing raid0 ====
+wrote 61440/61440 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 8192/8192 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+9d3940adb41dd525e008a847e01b15f4  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 61440) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 1 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 1 physical XXXXXXXXX
+	item 2 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 2 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>
+==== Testing raid1 ====
+wrote 61440/61440 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 8192/8192 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+9d3940adb41dd525e008a847e01b15f4  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 61440) itemoff XXXXX itemsize 40
+			encoding: RAID1
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 8192) 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 61440/61440 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 8192/8192 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+9d3940adb41dd525e008a847e01b15f4  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 61440) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 2 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 3 physical XXXXXXXXX
+			stripe 1 devid 4 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 5/7] btrfs: add fstest for writing to a file at an offset with RST
  2023-12-05 12:45 [PATCH v2 0/7] fstests: add tests for btrfs' raid-stripe-tree feature Johannes Thumshirn
                   ` (3 preceding siblings ...)
  2023-12-05 12:45 ` [PATCH v2 4/7] btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree Johannes Thumshirn
@ 2023-12-05 12:45 ` Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 6/7] btrfs: add fstests to write 128k to a RST filesystem Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 7/7] btrfs: add fstest for overwriting a file partially with RST Johannes Thumshirn
  6 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 12:45 UTC (permalink / raw)
  To: Anand Jain, Zorro Lang
  Cc: Filipe Manana, fstests, linux-btrfs, 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.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 tests/btrfs/304     | 56 +++++++++++++++++++++++++++++++++++++++
 tests/btrfs/304.out | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 131 insertions(+)

diff --git a/tests/btrfs/304 b/tests/btrfs/304
new file mode 100755
index 000000000000..a95cfbac1e1b
--- /dev/null
+++ b/tests/btrfs/304
@@ -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 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"
+
+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
+	_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
diff --git a/tests/btrfs/304.out b/tests/btrfs/304.out
new file mode 100644
index 000000000000..e94deec1ab21
--- /dev/null
+++ b/tests/btrfs/304.out
@@ -0,0 +1,75 @@
+QA output created by 304
+= Test 4k write to an empty file at offset 64k with one stripe prefilled =
+==== Testing raid0 ====
+wrote 65536/65536 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 4096/4096 bytes at offset 65536
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+381b0e7d72cb4f75286fe2b445e8d92a  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 65536) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 1 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 2 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>
+==== Testing raid1 ====
+wrote 65536/65536 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 4096/4096 bytes at offset 65536
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+381b0e7d72cb4f75286fe2b445e8d92a  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 65536) itemoff XXXXX itemsize 40
+			encoding: RAID1
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 1 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 65536/65536 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 4096/4096 bytes at offset 65536
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+381b0e7d72cb4f75286fe2b445e8d92a  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 65536) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 4096) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 3 physical XXXXXXXXX
+			stripe 1 devid 4 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 6/7] btrfs: add fstests to write 128k to a RST filesystem
  2023-12-05 12:45 [PATCH v2 0/7] fstests: add tests for btrfs' raid-stripe-tree feature Johannes Thumshirn
                   ` (4 preceding siblings ...)
  2023-12-05 12:45 ` [PATCH v2 5/7] btrfs: add fstest for writing to a file at an offset with RST Johannes Thumshirn
@ 2023-12-05 12:45 ` Johannes Thumshirn
  2023-12-05 12:45 ` [PATCH v2 7/7] btrfs: add fstest for overwriting a file partially with RST Johannes Thumshirn
  6 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 12:45 UTC (permalink / raw)
  To: Anand Jain, Zorro Lang
  Cc: Filipe Manana, fstests, linux-btrfs, Johannes Thumshirn

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

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

diff --git a/tests/btrfs/305 b/tests/btrfs/305
new file mode 100755
index 000000000000..362ae1966f4f
--- /dev/null
+++ b/tests/btrfs/305
@@ -0,0 +1,53 @@
+#! /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 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"
+
+test_128k_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 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
diff --git a/tests/btrfs/305.out b/tests/btrfs/305.out
new file mode 100644
index 000000000000..0dbd3beca77f
--- /dev/null
+++ b/tests/btrfs/305.out
@@ -0,0 +1,65 @@
+QA output created by 305
+= Test 128k write to empty file  =
+==== Testing raid0 ====
+wrote 131072/131072 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+d48858312a922db7eb86377f638dbc9f  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 65536) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 1 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 2 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>
+==== Testing raid1 ====
+wrote 131072/131072 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+d48858312a922db7eb86377f638dbc9f  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 131072) 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 131072/131072 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+d48858312a922db7eb86377f638dbc9f  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 65536) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 3 physical XXXXXXXXX
+			stripe 1 devid 4 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 7/7] btrfs: add fstest for overwriting a file partially with RST
  2023-12-05 12:45 [PATCH v2 0/7] fstests: add tests for btrfs' raid-stripe-tree feature Johannes Thumshirn
                   ` (5 preceding siblings ...)
  2023-12-05 12:45 ` [PATCH v2 6/7] btrfs: add fstests to write 128k to a RST filesystem Johannes Thumshirn
@ 2023-12-05 12:45 ` Johannes Thumshirn
  6 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 12:45 UTC (permalink / raw)
  To: Anand Jain, Zorro Lang
  Cc: Filipe Manana, fstests, linux-btrfs, 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.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 tests/btrfs/306     |  56 +++++++++++++++++++++++++++
 tests/btrfs/306.out | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 162 insertions(+)

diff --git a/tests/btrfs/306 b/tests/btrfs/306
new file mode 100755
index 000000000000..f2708bbcd2a5
--- /dev/null
+++ b/tests/btrfs/306
@@ -0,0 +1,56 @@
+#! /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 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"
+
+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
+	_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
diff --git a/tests/btrfs/306.out b/tests/btrfs/306.out
new file mode 100644
index 000000000000..52f3d68f77ff
--- /dev/null
+++ b/tests/btrfs/306.out
@@ -0,0 +1,106 @@
+QA output created by 306
+= Test 128k write to empty file with 1st stripe partially prefilled then overwrite =
+==== Testing raid0 ====
+wrote 32768/32768 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 131072/131072 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 8192/8192 bytes at offset 65536
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+d48858312a922db7eb86377f638dbc9f  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 32768) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 1 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 1 physical XXXXXXXXX
+	item 2 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 2 physical XXXXXXXXX
+	item 3 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 1 physical XXXXXXXXX
+	item 4 key (XXXXXX RAID_STRIPE 8192) itemoff XXXXX itemsize 24
+			encoding: RAID0
+			stripe 0 devid 1 physical XXXXXXXXX
+total bytes XXXXXXXX
+bytes used XXXXXX
+uuid <UUID>
+==== Testing raid1 ====
+wrote 32768/32768 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 131072/131072 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 8192/8192 bytes at offset 65536
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+d48858312a922db7eb86377f638dbc9f  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 32768) itemoff XXXXX itemsize 40
+			encoding: RAID1
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 131072) itemoff XXXXX itemsize 40
+			encoding: RAID1
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 2 key (XXXXXX RAID_STRIPE 8192) 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 32768/32768 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 131072/131072 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 8192/8192 bytes at offset 65536
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+d48858312a922db7eb86377f638dbc9f  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 32768) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 1 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 2 key (XXXXXX RAID_STRIPE 65536) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 3 physical XXXXXXXXX
+			stripe 1 devid 4 physical XXXXXXXXX
+	item 3 key (XXXXXX RAID_STRIPE 32768) itemoff XXXXX itemsize 40
+			encoding: RAID10
+			stripe 0 devid 1 physical XXXXXXXXX
+			stripe 1 devid 2 physical XXXXXXXXX
+	item 4 key (XXXXXX RAID_STRIPE 8192) 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/7] btrfs: add fstest for stripe-tree metadata with 4k write
  2023-12-05 12:45 ` [PATCH v2 3/7] btrfs: add fstest for stripe-tree metadata with 4k write Johannes Thumshirn
@ 2023-12-05 17:11   ` Filipe Manana
  2023-12-05 17:18     ` Johannes Thumshirn
  0 siblings, 1 reply; 12+ messages in thread
From: Filipe Manana @ 2023-12-05 17:11 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Anand Jain, Zorro Lang, Filipe Manana, fstests, linux-btrfs

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
>
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/7] btrfs: add fstest for stripe-tree metadata with 4k write
  2023-12-05 17:11   ` Filipe Manana
@ 2023-12-05 17:18     ` Johannes Thumshirn
  2023-12-05 17:22       ` Filipe Manana
  0 siblings, 1 reply; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 17:18 UTC (permalink / raw)
  To: Filipe Manana
  Cc: Anand Jain, Zorro Lang, Filipe Manana, fstests@vger.kernel.org,
	linux-btrfs@vger.kernel.org

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.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/7] btrfs: add fstest for stripe-tree metadata with 4k write
  2023-12-05 17:18     ` Johannes Thumshirn
@ 2023-12-05 17:22       ` Filipe Manana
  2023-12-05 17:29         ` Johannes Thumshirn
  0 siblings, 1 reply; 12+ messages in thread
From: Filipe Manana @ 2023-12-05 17:22 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Anand Jain, Zorro Lang, Filipe Manana, fstests@vger.kernel.org,
	linux-btrfs@vger.kernel.org

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.

>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 3/7] btrfs: add fstest for stripe-tree metadata with 4k write
  2023-12-05 17:22       ` Filipe Manana
@ 2023-12-05 17:29         ` Johannes Thumshirn
  0 siblings, 0 replies; 12+ messages in thread
From: Johannes Thumshirn @ 2023-12-05 17:29 UTC (permalink / raw)
  To: Filipe Manana
  Cc: Anand Jain, Zorro Lang, Filipe Manana, fstests@vger.kernel.org,
	linux-btrfs@vger.kernel.org

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.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-12-05 17:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-05 12:45 [PATCH v2 0/7] fstests: add tests for btrfs' raid-stripe-tree feature Johannes Thumshirn
2023-12-05 12:45 ` [PATCH v2 1/7] fstests: doc: add new raid-stripe-tree group Johannes Thumshirn
2023-12-05 12:45 ` [PATCH v2 2/7] common: add filter for btrfs raid-stripe dump Johannes Thumshirn
2023-12-05 12:45 ` [PATCH v2 3/7] btrfs: add fstest for stripe-tree metadata with 4k write Johannes Thumshirn
2023-12-05 17:11   ` Filipe Manana
2023-12-05 17:18     ` Johannes Thumshirn
2023-12-05 17:22       ` Filipe Manana
2023-12-05 17:29         ` Johannes Thumshirn
2023-12-05 12:45 ` [PATCH v2 4/7] btrfs: add fstest for 8k write spanning two stripes on raid-stripe-tree Johannes Thumshirn
2023-12-05 12:45 ` [PATCH v2 5/7] btrfs: add fstest for writing to a file at an offset with RST Johannes Thumshirn
2023-12-05 12:45 ` [PATCH v2 6/7] btrfs: add fstests to write 128k to a RST filesystem Johannes Thumshirn
2023-12-05 12:45 ` [PATCH v2 7/7] btrfs: add fstest for overwriting a file partially with RST Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox