Commit 01566db2 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix disk groups not being updated when set via sysfs

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 142cbdff
...@@ -387,6 +387,7 @@ int bch2_dev_group_set(struct bch_fs *c, struct bch_dev *ca, const char *name) ...@@ -387,6 +387,7 @@ int bch2_dev_group_set(struct bch_fs *c, struct bch_dev *ca, const char *name)
{ {
struct bch_member *mi; struct bch_member *mi;
int v = -1; int v = -1;
int ret = 0;
mutex_lock(&c->sb_lock); mutex_lock(&c->sb_lock);
...@@ -399,14 +400,18 @@ int bch2_dev_group_set(struct bch_fs *c, struct bch_dev *ca, const char *name) ...@@ -399,14 +400,18 @@ int bch2_dev_group_set(struct bch_fs *c, struct bch_dev *ca, const char *name)
return v; return v;
} }
ret = bch2_sb_disk_groups_to_cpu(c);
if (ret)
goto unlock;
write_sb: write_sb:
mi = &bch2_sb_get_members(c->disk_sb.sb)->members[ca->dev_idx]; mi = &bch2_sb_get_members(c->disk_sb.sb)->members[ca->dev_idx];
SET_BCH_MEMBER_GROUP(mi, v + 1); SET_BCH_MEMBER_GROUP(mi, v + 1);
bch2_write_super(c); bch2_write_super(c);
unlock:
mutex_unlock(&c->sb_lock); mutex_unlock(&c->sb_lock);
return 0; return ret;
} }
int bch2_opt_target_parse(struct bch_fs *c, const char *buf, u64 *v) int bch2_opt_target_parse(struct bch_fs *c, const char *buf, u64 *v)
......
...@@ -71,7 +71,10 @@ static inline struct bch_devs_mask target_rw_devs(struct bch_fs *c, ...@@ -71,7 +71,10 @@ static inline struct bch_devs_mask target_rw_devs(struct bch_fs *c,
bool bch2_dev_in_target(struct bch_fs *, unsigned, unsigned); bool bch2_dev_in_target(struct bch_fs *, unsigned, unsigned);
int bch2_disk_path_find(struct bch_sb_handle *, const char *); int bch2_disk_path_find(struct bch_sb_handle *, const char *);
/* Exported for userspace bcachefs-tools: */
int bch2_disk_path_find_or_create(struct bch_sb_handle *, const char *); int bch2_disk_path_find_or_create(struct bch_sb_handle *, const char *);
void bch2_disk_path_to_text(struct printbuf *, struct bch_sb_handle *, void bch2_disk_path_to_text(struct printbuf *, struct bch_sb_handle *,
unsigned); unsigned);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment