btrfs-progs: mkfs: check blkid version on zoned filesystems

Prior to version 2.38, libblkid fails to detect zoned mode's superblock
location resulting in blkid failing to detect btrfs on zoned block
devices. This patch suggest to the user to upgrade libblkid if it
detects a version lower then 2.38.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Naohiro Aota 2023-01-16 12:08:53 +09:00 committed by David Sterba
parent f5884fc8ca
commit d8c6021727

View File

@ -28,6 +28,7 @@
#include <string.h>
#include <pthread.h>
#include <uuid/uuid.h>
#include <blkid/blkid.h>
#include "kernel-lib/list.h"
#include "kernel-lib/list_sort.h"
#include "kernel-lib/rbtree.h"
@ -1346,6 +1347,8 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
exit(1);
}
if (opt_zoned) {
const int blkid_version = blkid_get_library_version(NULL, NULL);
if (source_dir_set) {
error("the option -r and zoned mode are incompatible");
exit(1);
@ -1360,6 +1363,9 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
error("cannot enable RAID5/6 in zoned mode");
exit(1);
}
if (blkid_version < 2380)
warning("libblkid < 2.38 does not support zoned mode's superblock location, update recommended");
}
if (btrfs_check_nodesize(nodesize, sectorsize, &features))