Skip to contentSkip to conversation

btrfs-progs: output sectorsize related warning message into stdout

PATCH In review Qu Wenruo 3 participants 4 messages Mar 9, 2021 – Mar 10, 2021 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 btrfs-progs: output sectorsize related warning message into stdout

Since commit 90020a760584 ("btrfs-progs: mkfs: refactor how we handle sectorsize override") we have extra warning message if the sectorsize of mkfs doesn't match page size.

But this warning is show as stderr, which makes a lot of fstests cases failure due to golden output mismatch.

Fix this by manually output the warning message as stdout.

This is just a temporary fix, a proper fix would needs kernel /sys/fs/btrfs/features/supported_rw_sectorsize interface to do proper prompt.

Fixes 90020a760584 ("btrfs-progs: mkfs: refactor how we handle sectorsize override")
---
 common/fsfeatures.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
common/fsfeatures.c +10 -2
index 569208a9e5b1..f9492e30d57a 100644
@@ -341,8 +341,16 @@ int btrfs_check_sectorsize(u32 sectorsize)
 		return -EINVAL;
 	}
 	if (page_size != sectorsize)
-		warning(
-"the filesystem may not be mountable, sectorsize %u doesn't match page size %u",
+		/*
+		 * warning() will output message into stderr, which will screw
+		 * up a lot of golden output of fstests. So here we use
+		 * printf().
+		 *
+		 * This will be replaced by proper supported rw/ro sector size
+		 * detection with kernel change in the future.
+		 */
+		printf(
+"WARNING: the filesystem may not be mountable, sectorsize %u doesn't match page size %u\n",
 			sectorsize, page_size);
 	return 0;
 }
Signature · 1 line
2.30.1
#1 lore raw
Quoted 6 lines · Qu Wenruo

Since commit 90020a760584 ("btrfs-progs: mkfs: refactor how we handle sectorsize override") we have extra warning message if the sectorsize of mkfs doesn't match page size.

But this warning is show as stderr, which makes a lot of fstests cases failure due to golden output mismatch.

Well, no. Using message helpers in progs is what we want to do everywhere, working around fstests output matching design is fixing the problem in the wrong place. That this is fragile has been is known and I want to keep the liberty to adjust output in progs as users need, not as fstests require.

I can compare two different approaches of testsuites, fstests vs btrfs-progs and I can say that the number of false positives on fstests side was much higher and actually making the whole testing experience much worse, up to ignoring test failures because they were not failures at all because the tests are not robust enoughh. In btrfs-progs there have been like 1 or 2 silent test breakages (unexpected pass) but that led to stronger checks of the expected or unexpected output.

#2 lore raw
Quoted 5 lines · David Sterba
Quoted 4 lines · Qu Wenruo

Since commit 90020a760584 ("btrfs-progs: mkfs: refactor how we handle sectorsize override") we have extra warning message if the sectorsize of mkfs doesn't match page size.

Quoted 8 lines
Quoted 2 lines

But this warning is show as stderr, which makes a lot of fstests cases failure due to golden output mismatch.

Well, no. Using message helpers in progs is what we want to do everywhere, working around fstests output matching design is fixing the problem in the wrong place. That this is fragile has been is known and I want to keep the liberty to adjust output in progs as users need, not as fstests require.

OK, then I guess the best way to fix the problem is to add sysfs interface to export supported rw/ro sectorsize.

It shouldn't be that complex and would be small enough for next merge window.

Thanks,
Qu

Quoted 9 lines

I can compare two different approaches of testsuites, fstests vs btrfs-progs and I can say that the number of false positives on fstests side was much higher and actually making the whole testing experience much worse, up to ignoring test failures because they were not failures at all because the tests are not robust enoughh. In btrfs-progs there have been like 1 or 2 silent test breakages (unexpected pass) but that led to stronger checks of the expected or unexpected output.

#3 lore raw
Quoted 17 lines · Qu Wenruo
Quoted 5 lines · David Sterba
Quoted 4 lines · Qu Wenruo

Since commit 90020a760584 ("btrfs-progs: mkfs: refactor how we handle sectorsize override") we have extra warning message if the sectorsize of mkfs doesn't match page size.

Quoted 8 lines
Quoted 2 lines

But this warning is show as stderr, which makes a lot of fstests cases failure due to golden output mismatch.

Well, no. Using message helpers in progs is what we want to do everywhere, working around fstests output matching design is fixing the problem in the wrong place. That this is fragile has been is known and I want to keep the liberty to adjust output in progs as users need, not as fstests require.

Quoted 5 lines

OK, then I guess the best way to fix the problem is to add sysfs interface to export supported rw/ro sectorsize.

It shouldn't be that complex and would be small enough for next merge window.

The subpage support should be advertised somewhere in sysfs so the range of supported sector sizes sounds like a good idea.