diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-10 20:31:34 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-15 17:36:15 -0400 |
commit | c8bec83e307f28751c433ba1d3f648429fb5a34c (patch) | |
tree | 6e70e0cf8f25117f706214d86a0689ee8495dca0 /libbcachefs/disk_groups.c | |
parent | 1c156d5c4667c1c2e2949b229dfef75696196d35 (diff) |
Update bcachefs sources to e14d7c7195 bcachefs: Compression levels
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/disk_groups.c')
-rw-r--r-- | libbcachefs/disk_groups.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libbcachefs/disk_groups.c b/libbcachefs/disk_groups.c index 52b64007..de14ca3a 100644 --- a/libbcachefs/disk_groups.c +++ b/libbcachefs/disk_groups.c @@ -460,30 +460,37 @@ int bch2_dev_group_set(struct bch_fs *c, struct bch_dev *ca, const char *name) 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 *val, u64 *res, + struct printbuf *err) { struct bch_dev *ca; int g; - if (!strlen(buf) || !strcmp(buf, "none")) { - *v = 0; + if (!val) + return -EINVAL; + + if (!c) + return 0; + + if (!strlen(val) || !strcmp(val, "none")) { + *res = 0; return 0; } /* Is it a device? */ - ca = bch2_dev_lookup(c, buf); + ca = bch2_dev_lookup(c, val); if (!IS_ERR(ca)) { - *v = dev_to_target(ca->dev_idx); + *res = dev_to_target(ca->dev_idx); percpu_ref_put(&ca->ref); return 0; } mutex_lock(&c->sb_lock); - g = bch2_disk_path_find(&c->disk_sb, buf); + g = bch2_disk_path_find(&c->disk_sb, val); mutex_unlock(&c->sb_lock); if (g >= 0) { - *v = group_to_target(g); + *res = group_to_target(g); return 0; } |