btrfs-progs: mkfs: use sectorsize as nodesize fallback for mixed profiles

[BUG]
When running btrfs/011 with subpage case, even with RAID56 support, it
still fails with the following error:

 QA output created by 011
 *** test btrfs replace
 mkfs failed
 (see /home/adam/xfstests-dev/results//btrfs/011.full for details)

The full log shows:

  ---------workout "-m single -d single -M" 1 no 64-----------
  ERROR: illegal nodesize 65536 (not equal to 4096 for mixed block group)
  mkfs failed

This is a critical error, making test case to be aborted, without
checking the rest profiles.

[CAUSE]
Mkfs.btrfs always uses the maximum value between sectorsize and page
size for its mixed profile nodesize.

For subpage case, it means we always go PAGE_SIZE, no matter whatever
the sectorsize is passed in.

[FIX]
Just get rid of the direct PAGE_SIZE usage when determining nodesize for
mixed profiles.
And use sectorsize directly (either passed in by the user, or
determined from page size).

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2022-04-03 15:20:11 +08:00 committed by David Sterba
parent 2d6acbaee4
commit 007c799ca8
1 changed files with 1 additions and 3 deletions

View File

@ -1261,8 +1261,6 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
data_profile = tmp;
}
} else {
u32 best_nodesize = max_t(u32, sysconf(_SC_PAGESIZE), sectorsize);
if (metadata_profile_opt || data_profile_opt) {
if (metadata_profile != data_profile) {
error(
@ -1272,7 +1270,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
}
if (!nodesize_forced)
nodesize = best_nodesize;
nodesize = sectorsize;
}
/*