summaryrefslogtreecommitdiff
path: root/fs/bcachefs/disk_groups.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-11-20 06:39:08 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:48 +0300
commit78c0b75c34209c471616566b3978eac4c1c53e99 (patch)
treee5c64b4d5d643e6170f2acfff1f279333235b398 /fs/bcachefs/disk_groups.c
parent5f659376fc1b9ad23b00a35242179b8961e0bc2d (diff)
downloadlinux-78c0b75c34209c471616566b3978eac4c1c53e99.tar.xz
bcachefs: More errcode cleanup
We shouldn't be overloading standard error codes now that we have provisions for bcachefs-specific errorcodes: this patch converts super.c and super-io.c to per error site errcodes, with a bit of cleanup. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/disk_groups.c')
-rw-r--r--fs/bcachefs/disk_groups.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/bcachefs/disk_groups.c b/fs/bcachefs/disk_groups.c
index 6b81f35861ac..fcd5dbff248d 100644
--- a/fs/bcachefs/disk_groups.c
+++ b/fs/bcachefs/disk_groups.c
@@ -27,7 +27,7 @@ static int bch2_sb_disk_groups_validate(struct bch_sb *sb,
struct bch_sb_field_members *mi = bch2_sb_get_members(sb);
unsigned nr_groups = disk_groups_nr(groups);
unsigned i, len;
- int ret = -EINVAL;
+ int ret = 0;
for (i = 0; i < sb->nr_devices; i++) {
struct bch_member *m = mi->members + i;
@@ -41,12 +41,12 @@ static int bch2_sb_disk_groups_validate(struct bch_sb *sb,
if (g >= nr_groups) {
prt_printf(err, "disk %u has invalid label %u (have %u)",
i, g, nr_groups);
- return -EINVAL;
+ return -BCH_ERR_invalid_sb_disk_groups;
}
if (BCH_GROUP_DELETED(&groups->entries[g])) {
prt_printf(err, "disk %u has deleted label %u", i, g);
- return -EINVAL;
+ return -BCH_ERR_invalid_sb_disk_groups;
}
}
@@ -62,7 +62,7 @@ static int bch2_sb_disk_groups_validate(struct bch_sb *sb,
len = strnlen(g->label, sizeof(g->label));
if (!len) {
prt_printf(err, "label %u empty", i);
- return -EINVAL;
+ return -BCH_ERR_invalid_sb_disk_groups;
}
}
@@ -79,13 +79,12 @@ static int bch2_sb_disk_groups_validate(struct bch_sb *sb,
prt_printf(err, "duplicate label %llu.%.*s",
BCH_GROUP_PARENT(g),
(int) sizeof(g->label), g->label);
+ ret = -BCH_ERR_invalid_sb_disk_groups;
goto err;
}
-
- ret = 0;
err:
kfree(sorted);
- return 0;
+ return ret;
}
static void bch2_sb_disk_groups_to_text(struct printbuf *out,