From e882906929c55a9561641944d24c11dc3f338225 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Wed, 14 May 2025 17:58:00 -0400 Subject: [PATCH] bcachefs: Fix opt hooks in sysfs for non sb option We weren't checking if the option changed for non-superblock options - this led to rebalance not waking up when enabling the "rebalance_enabled" option. Signed-off-by: Kent Overstreet --- fs/bcachefs/sysfs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c index 4c7d609d79fd..de7cda282a8c 100644 --- a/fs/bcachefs/sysfs.c +++ b/fs/bcachefs/sysfs.c @@ -642,7 +642,18 @@ static ssize_t sysfs_opt_store(struct bch_fs *c, if (ret < 0) goto err; - bool changed = bch2_opt_set_sb(c, ca, opt, v); + bool is_sb = opt->get_sb || opt->get_member; + bool changed = false; + + if (is_sb) { + changed = bch2_opt_set_sb(c, ca, opt, v); + } else if (!ca) { + changed = bch2_opt_get_by_id(&c->opts, id) != v; + } else { + /* device options that aren't superblock options aren't + * supported */ + BUG(); + } if (!ca) bch2_opt_set_by_id(&c->opts, id, v); -- 2.25.1