Skip to contentSkip to conversation

common/rc: add btrfs support for _small_fs_size_mb()

PATCH In review Qu Wenruo 3 participants 3 messages Jun 25, 2025 – Jun 26, 2025 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 common/rc: add btrfs support for _small_fs_size_mb()

[FAILURE]
With the incoming shutdown ioctl and remove_bdev callback support, btrfs is able to run the shutdown group.

However test case like generic/042 fails on btrfs:

generic/042 9s ... [failed, exit status 1]- output mismatch (see /home/adam/xfstests/results//generic/042.out.bad)

    --- tests/generic/042.out	2022-05-11 11:25:30.763333331 +0930
    +++ /home/adam/xfstests/results//generic/042.out.bad	2025-06-26 08:43:56.078509452 +0930
    @@ -1,10 +1 @@
     QA output created by 042
    -falloc -k
    -wrote 65536/65536 bytes at offset 0
    -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    -fpunch
    -wrote 65536/65536 bytes at offset 0
    -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    ...
    (Run 'diff -u /home/adam/xfstests/tests/generic/042.out /home/adam/xfstests/results//generic/042.out.bad'  to see the entire diff)

Ran: generic/042
Failures: generic/042
Failed 1 of 1 tests

[CAUSE]
The full output shows the reason directly:

ERROR: '/mnt/scratch/042.img' is too small to make a usable filesystem
ERROR: minimum size for each btrfs device is 114294784

And the helper _small_fs_size_mb() doesn't support btrfs, thus the small 25M file is not large enough to support a btrfs.

[FIX]
Fix the false alert by adding btrfs support in _small_fs_size_mb().

The btrfs minimal size is depending on the profiles even on a single device, e.g. DUP data will cost extra space.

So here we go safe by using 512MiB as the minimal size for btrfs.

---
 common/rc | 5 +++++
 1 file changed, 5 insertions(+)
common/rc +5 -0
index d8ee8328..2d8e7167 100644
@@ -1195,6 +1195,11 @@ _small_fs_size_mb()
 		# it will change again. So just set it 128M.
 		fs_min_size=128
 		;;
+	btrfs)
+		# Minimal btrfs size depends on the profiles, for single device
+		# case, 512M should be enough.
+		fs_min_size=512
+		;;
 	esac
 	(( size < fs_min_size )) && size="$fs_min_size"
 
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 38 lines · Qu Wenruo

[FAILURE]
With the incoming shutdown ioctl and remove_bdev callback support, btrfs is able to run the shutdown group.

However test case like generic/042 fails on btrfs:

generic/042 9s ... [failed, exit status 1]- output mismatch (see /home/adam/xfstests/results//generic/042.out.bad)

    --- tests/generic/042.out	2022-05-11 11:25:30.763333331 +0930
    +++ /home/adam/xfstests/results//generic/042.out.bad	2025-06-26 08:43:56.078509452 +0930
    @@ -1,10 +1 @@
     QA output created by 042
    -falloc -k
    -wrote 65536/65536 bytes at offset 0
    -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    -fpunch
    -wrote 65536/65536 bytes at offset 0
    -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    ...
    (Run 'diff -u /home/adam/xfstests/tests/generic/042.out /home/adam/xfstests/results//generic/042.out.bad'  to see the entire diff)

Ran: generic/042
Failures: generic/042
Failed 1 of 1 tests

[CAUSE]
The full output shows the reason directly:

ERROR: '/mnt/scratch/042.img' is too small to make a usable filesystem
ERROR: minimum size for each btrfs device is 114294784

And the helper _small_fs_size_mb() doesn't support btrfs, thus the small 25M file is not large enough to support a btrfs.

[FIX]
Fix the false alert by adding btrfs support in _small_fs_size_mb().

The btrfs minimal size is depending on the profiles even on a single device, e.g. DUP data will cost extra space.

Quoted 6 lines

So here we go safe by using 512MiB as the minimal size for btrfs.

---
 common/rc | 5 +++++
 1 file changed, 5 insertions(+)

Looks good.

Quoted 17 lines
common/rc +5 -0
index d8ee8328..2d8e7167 100644
@@ -1195,6 +1195,11 @@ _small_fs_size_mb()
 		# it will change again. So just set it 128M.
 		fs_min_size=128
 		;;
+	btrfs)
+		# Minimal btrfs size depends on the profiles, for single device
+		# case, 512M should be enough.
+		fs_min_size=512
+		;;
 	esac
 	(( size < fs_min_size )) && size="$fs_min_size"
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Qu Wenruo
Quoted 35 lines · Qu Wenruo

[FAILURE]
With the incoming shutdown ioctl and remove_bdev callback support, btrfs is able to run the shutdown group.

However test case like generic/042 fails on btrfs:

generic/042 9s ... [failed, exit status 1]- output mismatch (see /home/adam/xfstests/results//generic/042.out.bad)

    --- tests/generic/042.out	2022-05-11 11:25:30.763333331 +0930
    +++ /home/adam/xfstests/results//generic/042.out.bad	2025-06-26 08:43:56.078509452 +0930
    @@ -1,10 +1 @@
     QA output created by 042
    -falloc -k
    -wrote 65536/65536 bytes at offset 0
    -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    -fpunch
    -wrote 65536/65536 bytes at offset 0
    -XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
    ...
    (Run 'diff -u /home/adam/xfstests/tests/generic/042.out /home/adam/xfstests/results//generic/042.out.bad'  to see the entire diff)

Ran: generic/042
Failures: generic/042
Failed 1 of 1 tests

[CAUSE]
The full output shows the reason directly:

ERROR: '/mnt/scratch/042.img' is too small to make a usable filesystem
ERROR: minimum size for each btrfs device is 114294784

And the helper _small_fs_size_mb() doesn't support btrfs, thus the small 25M file is not large enough to support a btrfs.

[FIX]
Fix the false alert by adding btrfs support in _small_fs_size_mb().

Quoted 7 lines

The btrfs minimal size is depending on the profiles even on a single device, e.g. DUP data will cost extra space.

So here we go safe by using 512MiB as the minimal size for btrfs.

---

Makes sense to me, thanks for fixing this test failure.

Quoted 23 lines
 common/rc | 5 +++++
 1 file changed, 5 insertions(+)
common/rc +5 -0
index d8ee8328..2d8e7167 100644
@@ -1195,6 +1195,11 @@ _small_fs_size_mb()
 		# it will change again. So just set it 128M.
 		fs_min_size=128
 		;;
+	btrfs)
+		# Minimal btrfs size depends on the profiles, for single device
+		# case, 512M should be enough.
+		fs_min_size=512
+		;;
 	esac
 	(( size < fs_min_size )) && size="$fs_min_size"
 
Signature · 1 line
2.49.0