Thread (2 messages) 2 messages, 2 authors, 2021-11-25

Re: [PATCH] btrfs-progs: Add test for btrfs fi usage output

From: David Sterba <hidden>
Date: 2021-11-25 14:29:03

On Thu, Nov 18, 2021 at 05:22:04PM +0200, Nikolay Borisov wrote:
There was a regression in btrfs progs release 5.15 due to changes in how
the ratio for the various raid profiles got calculated and this in turn
had a cascading effect on unallocated/allocated space reported.

Add a test to ensure this regression doesn't occur again.

Signed-off-by: Nikolay Borisov <redacted>
Added to devel, thanks.
+report_numbers()
+{
+	vars=($(run_check_stdout $SUDO_HELPER "$TOP/btrfs" filesystem usage -b "$TEST_MNT" | awk '
Please declare local variables
+	/Data ratio/ { ratio=$3 }
+	a {dev_alloc=$2; exit}
+	/Data,(DUP|RAID[0156][C34]{0,2}|single)/ { size=substr($2,6,length($2)-6); a=1 }
+END {print ratio " " size " " dev_alloc}'))
+
+	echo "${vars[@]}"
+}
+
+test_dup()
+{
+	run_check_mkfs_test_dev -ddup
+	run_check_mount_test_dev
+	vars=($(report_numbers))
+	data_chunk_size=${vars[1]}
+	used_on_dev=${vars[2]}
+	data_ratio=${vars[0]}
And the whole bunch
+
+	[[ $used_on_dev -eq $((2*$data_chunk_size)) ]] || _fail "DUP inconsistent chunk/device usage. Chunk: $data_chunk_size Device: $used_on_dev"
Though there's no limit for the line width, if it can be at the pipe/||
point it's preferred, in this case the _fail is not hidden in the middle
of the long command.

All fixed.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help