mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-10 00:00:24 +03:00
format: Ensure bcachefs module is loaded before checking version
this prevents accidentally formatting with a version unsupported by the running kernel Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
33483738c6
commit
3aa2a4c47c
@ -54,6 +54,12 @@ static inline unsigned bcachefs_kernel_version(void)
|
|||||||
|
|
||||||
static inline struct format_opts format_opts_default()
|
static inline struct format_opts format_opts_default()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Ensure bcachefs module is loaded so we know the supported on disk
|
||||||
|
* format version:
|
||||||
|
*/
|
||||||
|
system("modprobe bcachefs > /dev/null 2>&1");
|
||||||
|
|
||||||
return (struct format_opts) {
|
return (struct format_opts) {
|
||||||
.version = bcachefs_kernel_version() ?:
|
.version = bcachefs_kernel_version() ?:
|
||||||
bcachefs_metadata_version_current,
|
bcachefs_metadata_version_current,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user