format: Don't format with a version higher than supported by tools

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-10-19 09:26:02 -04:00
parent 3609bf8161
commit 0da097dcb2

View File

@ -63,9 +63,12 @@ static inline struct format_opts format_opts_default()
*/
(void)!system("modprobe bcachefs > /dev/null 2>&1");
unsigned kernel_version = bcachefs_kernel_version();
return (struct format_opts) {
.version = bcachefs_kernel_version() ?:
bcachefs_metadata_version_current,
.version = kernel_version
? min(bcachefs_metadata_version_current, kernel_version)
: bcachefs_metadata_version_current,
.superblock_size = SUPERBLOCK_SIZE_DEFAULT,
};
}