diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-05-15 00:58:00 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-05-22 03:14:59 +0300 |
commit | e882906929c55a9561641944d24c11dc3f338225 (patch) | |
tree | c16f98e12d89b05e344efd57f0aef7ff57fc4c42 | |
parent | 648c1142c9f1ad914c9fd79cedbd6b92ac788cd6 (diff) | |
download | linux-e882906929c55a9561641944d24c11dc3f338225.tar.xz |
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 <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/sysfs.c | 13 |
1 files changed, 12 insertions, 1 deletions
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); |