From ba239c954e840875a912230439f28b4e4fbea8ff Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Fri, 29 Nov 2019 13:47:42 -0500 Subject: bcachefs: bch2_check_set_feature() New helper function for setting incompatible feature bits Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- fs/bcachefs/opts.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'fs/bcachefs/opts.c') diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c index 13a9a2fcd575..cbacd2f36799 100644 --- a/fs/bcachefs/opts.c +++ b/fs/bcachefs/opts.c @@ -299,15 +299,8 @@ int bch2_opt_check_may_set(struct bch_fs *c, int id, u64 v) ret = bch2_check_set_has_compressed_data(c, v); break; case Opt_erasure_code: - if (v && - !(c->sb.features & (1ULL << BCH_FEATURE_EC))) { - mutex_lock(&c->sb_lock); - c->disk_sb.sb->features[0] |= - cpu_to_le64(1ULL << BCH_FEATURE_EC); - - bch2_write_super(c); - mutex_unlock(&c->sb_lock); - } + if (v) + bch2_check_set_feature(c, BCH_FEATURE_EC); break; } -- cgit v1.2.3