diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-19 22:39:08 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:48 -0400 |
commit | 78c0b75c34209c471616566b3978eac4c1c53e99 (patch) | |
tree | e5c64b4d5d643e6170f2acfff1f279333235b398 /fs/bcachefs/dirent.c | |
parent | 5f659376fc1b9ad23b00a35242179b8961e0bc2d (diff) | |
download | linux-78c0b75c34209c471616566b3978eac4c1c53e99.tar.gz linux-78c0b75c34209c471616566b3978eac4c1c53e99.tar.bz2 linux-78c0b75c34209c471616566b3978eac4c1c53e99.zip |
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/dirent.c')
-rw-r--r-- | fs/bcachefs/dirent.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c index c2126f39369b..f1838b7c45ee 100644 --- a/fs/bcachefs/dirent.c +++ b/fs/bcachefs/dirent.c @@ -92,46 +92,46 @@ int bch2_dirent_invalid(const struct bch_fs *c, struct bkey_s_c k, if (bkey_val_bytes(k.k) < sizeof(struct bch_dirent)) { prt_printf(err, "incorrect value size (%zu < %zu)", bkey_val_bytes(k.k), sizeof(*d.v)); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } len = bch2_dirent_name_bytes(d); if (!len) { prt_printf(err, "empty name"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (bkey_val_u64s(k.k) > dirent_val_u64s(len)) { prt_printf(err, "value too big (%zu > %u)", bkey_val_u64s(k.k), dirent_val_u64s(len)); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (len > BCH_NAME_MAX) { prt_printf(err, "dirent name too big (%u > %u)", len, BCH_NAME_MAX); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (len == 1 && !memcmp(d.v->d_name, ".", 1)) { prt_printf(err, "invalid name"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (len == 2 && !memcmp(d.v->d_name, "..", 2)) { prt_printf(err, "invalid name"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (memchr(d.v->d_name, '/', len)) { prt_printf(err, "invalid name"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (d.v->d_type != DT_SUBVOL && le64_to_cpu(d.v->d_inum) == d.k->p.inode) { prt_printf(err, "dirent points to own directory"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } return 0; |