Skip to contentSkip to conversation

fstests: btrfs/053: use "-n" to replace the deprecated "-l" mkfs option

PATCH In review Qu Wenruo 2 participants 2 messages Nov 13, 2022 – Nov 14, 2022 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 fstests: btrfs/053: use "-n" to replace the deprecated "-l" mkfs option

[BUG]
Test case btrfs/053 will fail if using newer btrfs-progs with the extra error output:

mount: /mnt/scratch: wrong fs type, bad option, bad superblock on /dev/mapper/test-scratch1, missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system call.
mount /dev/mapper/test-scratch1 /mnt/scratch failed

[CAUSE]
The option "-l"/"--leafsize" is already marked deprecated since btrfs-progs v4.0, and finally in btrfs-progs v6.0 we removes the support for such deprecated option completely.

But unfortunately the test case is still using the old option.

[FIX]
Fix and improve the test case by:

- Use "-n" to replace the "-l" option

- Rename "leaf_size" variable to "node_size"

- Save the output of _scratch_mkfs to $seqres.full
This would save quite some time if it later failed due to some other reasons in mkfs.btrfs.

---
 tests/btrfs/053 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/btrfs/053 +3 -3
index fbd2e7d9..006ea0e6 100755
@@ -37,14 +37,14 @@ _require_attrs
 # max(16384, PAGE_SIZE) is the default leaf/node size on btrfs-progs v3.12+.
 # Older versions just use max(4096, PAGE_SIZE).
 # mkfs.btrfs can't create an fs with a leaf/node size smaller than PAGE_SIZE.
-leaf_size=$(echo -e "16384\n`getconf PAGE_SIZE`" | sort -nr | head -1)
+node_size=$(echo -e "16384\n`getconf PAGE_SIZE`" | sort -nr | head -1)
 
 send_files_dir=$TEST_DIR/btrfs-test-$seq
 
 rm -fr $send_files_dir
 mkdir $send_files_dir
 
-_scratch_mkfs "-l $leaf_size" >/dev/null 2>&1
+_scratch_mkfs "-n $node_size" >> $seqres.full 2>&1
 _scratch_mount
 
 echo "hello world" > $SCRATCH_MNT/foobar
@@ -72,7 +72,7 @@ _run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 -f $send_files_dir/2.snap \
 _scratch_unmount
 _check_scratch_fs
 
-_scratch_mkfs "-l $leaf_size" >/dev/null 2>&1
+_scratch_mkfs "-n $node_size" >> $seqres.full 2>&1
 _scratch_mount
 
 _run_btrfs_util_prog receive -f $send_files_dir/1.snap $SCRATCH_MNT
Signature · 1 line
2.38.0
#1 lore raw
Quoted 23 lines · Qu Wenruo

[BUG]
Test case btrfs/053 will fail if using newer btrfs-progs with the extra error output:

mount: /mnt/scratch: wrong fs type, bad option, bad superblock on /dev/mapper/test-scratch1, missing codepage or helper program, or other error.
dmesg(1) may have more information after failed mount system call.
mount /dev/mapper/test-scratch1 /mnt/scratch failed

[CAUSE]
The option "-l"/"--leafsize" is already marked deprecated since btrfs-progs v4.0, and finally in btrfs-progs v6.0 we removes the support for such deprecated option completely.

But unfortunately the test case is still using the old option.

[FIX]
Fix and improve the test case by:

- Use "-n" to replace the "-l" option

- Rename "leaf_size" variable to "node_size"

Quoted 8 lines

- Save the output of _scratch_mkfs to $seqres.full
This would save quite some time if it later failed due to some other reasons in mkfs.btrfs.

---
 tests/btrfs/053 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

I had already sent a fix for this last week:

https://lore.kernel.org/fstests/793a063833727ea80a1d0c6f13f531cff9581a1a.1668011940.git.fdmanana@suse.com/

Thanks.

Quoted 34 lines
tests/btrfs/053 +3 -4
index fbd2e7d9..006ea0e6 100755
@@ -37,14 +37,14 @@ _require_attrs
 # max(16384, PAGE_SIZE) is the default leaf/node size on btrfs-progs v3.12+.
 # Older versions just use max(4096, PAGE_SIZE).
 # mkfs.btrfs can't create an fs with a leaf/node size smaller than PAGE_SIZE.
-leaf_size=$(echo -e "16384\n`getconf PAGE_SIZE`" | sort -nr | head -1)
+node_size=$(echo -e "16384\n`getconf PAGE_SIZE`" | sort -nr | head -1)
 
 send_files_dir=$TEST_DIR/btrfs-test-$seq
 
 rm -fr $send_files_dir
 mkdir $send_files_dir
 
-_scratch_mkfs "-l $leaf_size" >/dev/null 2>&1
+_scratch_mkfs "-n $node_size" >> $seqres.full 2>&1
 _scratch_mount
 
 echo "hello world" > $SCRATCH_MNT/foobar
@@ -72,7 +72,7 @@ _run_btrfs_util_prog send -p $SCRATCH_MNT/mysnap1 -f $send_files_dir/2.snap \
 _scratch_unmount
 _check_scratch_fs
 
-_scratch_mkfs "-l $leaf_size" >/dev/null 2>&1
+_scratch_mkfs "-n $node_size" >> $seqres.full 2>&1
 _scratch_mount
 
 _run_btrfs_util_prog receive -f $send_files_dir/1.snap $SCRATCH_MNT
--

2.38.0