summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_background.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/alloc_background.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/alloc_background.c')
-rw-r--r--fs/bcachefs/alloc_background.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index a0b9fa30260a..cef5de13a6e4 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -302,7 +302,7 @@ int bch2_alloc_v1_invalid(const struct bch_fs *c, struct bkey_s_c k,
if (bkey_val_u64s(a.k) < bch_alloc_v1_val_u64s(a.v)) {
prt_printf(err, "incorrect value size (%zu < %u)",
bkey_val_u64s(a.k), bch_alloc_v1_val_u64s(a.v));
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
return 0;
@@ -315,7 +315,7 @@ int bch2_alloc_v2_invalid(const struct bch_fs *c, struct bkey_s_c k,
if (bch2_alloc_unpack_v2(&u, k)) {
prt_printf(err, "unpack error");
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
return 0;
@@ -328,7 +328,7 @@ int bch2_alloc_v3_invalid(const struct bch_fs *c, struct bkey_s_c k,
if (bch2_alloc_unpack_v3(&u, k)) {
prt_printf(err, "unpack error");
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
return 0;
@@ -342,14 +342,14 @@ int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k,
if (bkey_val_bytes(k.k) != sizeof(struct bch_alloc_v4)) {
prt_printf(err, "bad val size (%zu != %zu)",
bkey_val_bytes(k.k), sizeof(struct bch_alloc_v4));
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
if (rw == WRITE) {
if (alloc_data_type(*a.v, a.v->data_type) != a.v->data_type) {
prt_printf(err, "invalid data type (got %u should be %u)",
a.v->data_type, alloc_data_type(*a.v, a.v->data_type));
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
switch (a.v->data_type) {
@@ -360,7 +360,7 @@ int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k,
a.v->cached_sectors ||
a.v->stripe) {
prt_printf(err, "empty data type free but have data");
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
break;
case BCH_DATA_sb:
@@ -371,7 +371,7 @@ int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k,
if (!a.v->dirty_sectors) {
prt_printf(err, "data_type %s but dirty_sectors==0",
bch2_data_types[a.v->data_type]);
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
break;
case BCH_DATA_cached:
@@ -379,20 +379,20 @@ int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k,
a.v->dirty_sectors ||
a.v->stripe) {
prt_printf(err, "data type inconsistency");
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
if (!a.v->io_time[READ] &&
test_bit(BCH_FS_CHECK_ALLOC_TO_LRU_REFS_DONE, &c->flags)) {
prt_printf(err, "cached bucket with read_time == 0");
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
break;
case BCH_DATA_stripe:
if (!a.v->stripe) {
prt_printf(err, "data_type %s but stripe==0",
bch2_data_types[a.v->data_type]);
- return -EINVAL;
+ return -BCH_ERR_invalid_bkey;
}
break;
}