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")
Signed-off-by: Qu Wenruo <w...@suse.com>
---
 common/fsfeatures.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/common/fsfeatures.c b/common/fsfeatures.c
index 569208a9e5b1..f9492e30d57a 100644
--- a/common/fsfeatures.c
+++ b/common/fsfeatures.c
@@ -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;
 }
-- 
2.30.1

Reply via email to