Skip to content

Commit c3b02e6

Browse files
author
Kent Overstreet
committed
bcachefs: Log message when incompat version requested but not enabled
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 14bcf98 commit c3b02e6

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

fs/bcachefs/bcachefs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,8 @@ struct bch_fs {
788788
unsigned long errors_silent[BITS_TO_LONGS(BCH_FSCK_ERR_MAX)];
789789
u64 btrees_lost_data;
790790
} sb;
791+
DARRAY(enum bcachefs_metadata_version)
792+
incompat_versions_requested;
791793

792794
#ifdef CONFIG_UNICODE
793795
struct unicode_map *cf_encoding;

fs/bcachefs/fs-ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static int bch2_inode_flags_set(struct btree_trans *trans,
6969
if (ret < 0)
7070
return ret;
7171

72-
ret = bch2_request_incompat_feature(c,bcachefs_metadata_version_casefolding);
72+
ret = bch2_request_incompat_feature(c, bcachefs_metadata_version_casefolding);
7373
if (ret)
7474
return ret;
7575

fs/bcachefs/super-io.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,30 @@ int bch2_set_version_incompat(struct bch_fs *c, enum bcachefs_metadata_version v
7373
? 0
7474
: -BCH_ERR_may_not_use_incompat_feature;
7575

76+
mutex_lock(&c->sb_lock);
7677
if (!ret) {
77-
mutex_lock(&c->sb_lock);
7878
SET_BCH_SB_VERSION_INCOMPAT(c->disk_sb.sb,
7979
max(BCH_SB_VERSION_INCOMPAT(c->disk_sb.sb), version));
8080
bch2_write_super(c);
81-
mutex_unlock(&c->sb_lock);
81+
} else {
82+
darray_for_each(c->incompat_versions_requested, i)
83+
if (version == *i)
84+
goto out;
85+
86+
darray_push(&c->incompat_versions_requested, version);
87+
struct printbuf buf = PRINTBUF;
88+
prt_str(&buf, "requested incompat feature ");
89+
bch2_version_to_text(&buf, version);
90+
prt_str(&buf, " currently not enabled");
91+
prt_printf(&buf, "\n set version_upgrade=incompat to enable");
92+
93+
bch_notice(c, "%s", buf.buf);
94+
printbuf_exit(&buf);
8295
}
8396

97+
out:
98+
mutex_unlock(&c->sb_lock);
99+
84100
return ret;
85101
}
86102

fs/bcachefs/super.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ static void __bch2_fs_free(struct bch_fs *c)
589589
free_percpu(c->online_reserved);
590590
}
591591

592+
darray_exit(&c->incompat_versions_requested);
592593
darray_exit(&c->btree_roots_extra);
593594
free_percpu(c->pcpu);
594595
free_percpu(c->usage);

0 commit comments

Comments
 (0)