Skip to contentSkip to conversation

common/rc: Remove special handing of 'dup' argument for btrfs

PATCH In review Nikolay Borisov 3 participants 5 messages Oct 1, 2019 – Oct 5, 2019 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 common/rc: Remove special handing of 'dup' argument for btrfs

_scratch_pool_mkfs special cases the command executed when 'dup' option is used when creating a filesystem. This is wrong since 'dup' works for all profiles and number of devices. This bug manifested while exercising btrfs' balance argument combinations test.

---
V2:
* No change since v1

 common/rc | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
common/rc +1 -7
index 9f2c252e5aa5..1b150cbad2f6 100644
@@ -885,13 +885,7 @@ _scratch_pool_mkfs()
 {
     case $FSTYP in
     btrfs)
-        # if dup profile is in mkfs options call _scratch_mkfs instead
-        # because dup profile only works with single device
-        if [[ "$*" =~ dup ]]; then
-            _scratch_mkfs $*
-        else
-            $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null
-        fi
+        $MKFS_BTRFS_PROG $MKFS_OPTIONS $* $SCRATCH_DEV_POOL > /dev/null
         ;;
     *)
         echo "_scratch_pool_mkfs is not implemented for $FSTYP" 1>&2
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/2 btrfs: Add test for btrfs balance convert functionality

Add basic test to ensure btrfs conversion functionality is tested. This test exercies conversion to all possible types of the data portion. This is sufficient since from the POV of relocation we are only moving blockgroups.

---
 tests/btrfs/194     | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/194.out |  2 ++
 tests/btrfs/group   |  1 +
 3 files changed, 87 insertions(+)
 create mode 100755 tests/btrfs/194
 create mode 100644 tests/btrfs/194.out
tests/btrfs/194 new file +84 -0
new file mode 100755
index 000000000000..39b6e0a969c1
@@ -0,0 +1,84 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019 SUSE Linux Products GmbH. All Rights Reserved.
+#
+# FS QA Test 194
+#
+# Test raid profile conversion. It's sufficient to test all dest profiles as 
+# source profiles just rely on being able to read the metadata. 
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch_dev_pool 4
+
+
+declare -a TEST_VECTORS=(
+# $nr_dev_min:$data:$metadata:$data_convert:$metadata_convert
+"4:single:raid1"
+"4:single:raid0"
+"4:single:raid10"
+"4:single:dup"
+"4:single:raid5"
+"4:single:raid6"
+"2:raid1:single"
+)
+
+run_testcase() {
+	IFS=':' read -ra args <<< $1
+	num_disks=${args[0]}
+	src_type=${args[1]}
+	dst_type=${args[2]}
+
+	_scratch_dev_pool_get $num_disks
+
+	echo "=== Running test: $1 ===" >> $seqres.full 
+
+	_scratch_pool_mkfs -d$src_type >> $seqres.full 2>&1
+	_scratch_mount 
+
+	# Create random filesystem with 20k write ops
+	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -n 10000 $FSSTRESS_AVOID
+
+	$BTRFS_UTIL_PROG balance start -f -dconvert=$dst_type $SCRATCH_MNT >> $seqres.full 2>&1
+	[ $? -eq 0 ] || echo "$1: Failed convert"
+
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	[ $? -eq 0 ] || echo "$1: Scrub failed"
+
+	_scratch_unmount
+	_check_btrfs_filesystem $SCRATCH_DEV
+	_scratch_dev_pool_put
+}
+
+for i in "${TEST_VECTORS[@]}"; do 
+	run_testcase $i
+done
+
+echo "Silence is golden"
+status=0
+exit
tests/btrfs/194.out new file +2 -0
new file mode 100644
index 000000000000..7bfd50ffb5a4
@@ -0,0 +1,2 @@
+QA output created by 194
+Silence is golden
tests/btrfs/group +1 -0
index b92cb12ca66f..a2c0ad87d0f6 100644
@@ -196,3 +196,4 @@
 191 auto quick send dedupe
 192 auto replay snapshot stress
 193 auto quick qgroup enospc limit
+194 auto volume balance
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v2 2/2] btrfs: Add test for btrfs balance convert functionality

Quoted 5 lines · Nikolay Borisov

Add basic test to ensure btrfs conversion functionality is tested. This test exercies conversion to all possible types of the data portion. This is sufficient since from the POV of relocation we are only moving blockgroups.

V2:
* Only test all possible destination profiles, this reduces the
test run times massively.

#3 lore raw

Re: [PATCH v2 2/2] btrfs: Add test for btrfs balance convert functionality

In reply to Nikolay Borisov

Hi Qu,

Quoted 5 lines · Nikolay Borisov

Add basic test to ensure btrfs conversion functionality is tested. This test exercies conversion to all possible types of the data portion. This is sufficient since from the POV of relocation we are only moving blockgroups.

Would you please help review this v2 as well? Thanks a lot!

Eryu

Quoted 118 lines
---
 tests/btrfs/194     | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/194.out |  2 ++
 tests/btrfs/group   |  1 +
 3 files changed, 87 insertions(+)
 create mode 100755 tests/btrfs/194
 create mode 100644 tests/btrfs/194.out
tests/btrfs/194 new file +84 -0
new file mode 100755
index 000000000000..39b6e0a969c1
@@ -0,0 +1,84 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019 SUSE Linux Products GmbH. All Rights Reserved.
+#
+# FS QA Test 194
+#
+# Test raid profile conversion. It's sufficient to test all dest profiles as 
+# source profiles just rely on being able to read the metadata. 
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch_dev_pool 4
+
+
+declare -a TEST_VECTORS=(
+# $nr_dev_min:$data:$metadata:$data_convert:$metadata_convert
+"4:single:raid1"
+"4:single:raid0"
+"4:single:raid10"
+"4:single:dup"
+"4:single:raid5"
+"4:single:raid6"
+"2:raid1:single"
+)
+
+run_testcase() {
+	IFS=':' read -ra args <<< $1
+	num_disks=${args[0]}
+	src_type=${args[1]}
+	dst_type=${args[2]}
+
+	_scratch_dev_pool_get $num_disks
+
+	echo "=== Running test: $1 ===" >> $seqres.full 
+
+	_scratch_pool_mkfs -d$src_type >> $seqres.full 2>&1
+	_scratch_mount 
+
+	# Create random filesystem with 20k write ops
+	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -n 10000 $FSSTRESS_AVOID
+
+	$BTRFS_UTIL_PROG balance start -f -dconvert=$dst_type $SCRATCH_MNT >> $seqres.full 2>&1
+	[ $? -eq 0 ] || echo "$1: Failed convert"
+
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	[ $? -eq 0 ] || echo "$1: Scrub failed"
+
+	_scratch_unmount
+	_check_btrfs_filesystem $SCRATCH_DEV
+	_scratch_dev_pool_put
+}
+
+for i in "${TEST_VECTORS[@]}"; do 
+	run_testcase $i
+done
+
+echo "Silence is golden"
+status=0
+exit
tests/btrfs/194.out new file +2 -0
new file mode 100644
index 000000000000..7bfd50ffb5a4
@@ -0,0 +1,2 @@
+QA output created by 194
+Silence is golden
tests/btrfs/group +1 -0
index b92cb12ca66f..a2c0ad87d0f6 100644
@@ -196,3 +196,4 @@
 191 auto quick send dedupe
 192 auto replay snapshot stress
 193 auto quick qgroup enospc limit
+194 auto volume balance
Signature · 1 line
2.7.4
Reviewed-by
#4 lore raw

Re: [PATCH v2 2/2] btrfs: Add test for btrfs balance convert functionality

Quoted 8 lines · Eryu Guan

Hi Qu,

Quoted 5 lines · Nikolay Borisov

Add basic test to ensure btrfs conversion functionality is tested. This test exercies conversion to all possible types of the data portion. This is sufficient since from the POV of relocation we are only moving blockgroups.

Still one small nitpick inlined below (just small wording, can be fixed at commit time).

Quoted 13 lines

Would you please help review this v2 as well? Thanks a lot!

Eryu

Quoted 8 lines
---
 tests/btrfs/194     | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/194.out |  2 ++
 tests/btrfs/group   |  1 +
 3 files changed, 87 insertions(+)
 create mode 100755 tests/btrfs/194
 create mode 100644 tests/btrfs/194.out
Quoted 14 lines
Quoted 6 lines
tests/btrfs/194 new file +0 -0
new file mode 100755
index 000000000000..39b6e0a969c1

tests/btrfs/194 line 8

Quoted 8 lines
tests/btrfs/194 new file +8 -0
@@ -0,0 +1,84 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019 SUSE Linux Products GmbH. All Rights Reserved.
+#
+# FS QA Test 194
+#
+# Test raid profile conversion. It's sufficient to test all dest profiles as
+# source profiles just rely on being able to read the metadata.

data and metadata.

In fact in the test case itself it's purely data.

THanks,
Qu

Quoted 96 lines
Quoted 96 lines
tests/btrfs/194 new file +76 -0
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch_dev_pool 4
+
+
+declare -a TEST_VECTORS=(
+# $nr_dev_min:$data:$metadata:$data_convert:$metadata_convert
+"4:single:raid1"
+"4:single:raid0"
+"4:single:raid10"
+"4:single:dup"
+"4:single:raid5"
+"4:single:raid6"
+"2:raid1:single"
+)
+
+run_testcase() {
+	IFS=':' read -ra args <<< $1
+	num_disks=${args[0]}
+	src_type=${args[1]}
+	dst_type=${args[2]}
+
+	_scratch_dev_pool_get $num_disks
+
+	echo "=== Running test: $1 ===" >> $seqres.full
+
+	_scratch_pool_mkfs -d$src_type >> $seqres.full 2>&1
+	_scratch_mount
+
+	# Create random filesystem with 20k write ops
+	run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -n 10000 $FSSTRESS_AVOID
+
+	$BTRFS_UTIL_PROG balance start -f -dconvert=$dst_type $SCRATCH_MNT >> $seqres.full 2>&1
+	[ $? -eq 0 ] || echo "$1: Failed convert"
+
+	$BTRFS_UTIL_PROG scrub start -B $SCRATCH_MNT >>$seqres.full 2>&1
+	[ $? -eq 0 ] || echo "$1: Scrub failed"
+
+	_scratch_unmount
+	_check_btrfs_filesystem $SCRATCH_DEV
+	_scratch_dev_pool_put
+}
+
+for i in "${TEST_VECTORS[@]}"; do
+	run_testcase $i
+done
+
+echo "Silence is golden"
+status=0
+exit
tests/btrfs/194.out new file +2 -0
new file mode 100644
index 000000000000..7bfd50ffb5a4
@@ -0,0 +1,2 @@
+QA output created by 194
+Silence is golden
tests/btrfs/group +1 -1
index b92cb12ca66f..a2c0ad87d0f6 100644
@@ -196,3 +196,4 @@
 191 auto quick send dedupe
 192 auto replay snapshot stress
 193 auto quick qgroup enospc limit
+194 auto volume balance
--

2.7.4