diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-20 06:39:08 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:48 +0300 |
commit | 78c0b75c34209c471616566b3978eac4c1c53e99 (patch) | |
tree | e5c64b4d5d643e6170f2acfff1f279333235b398 /fs/bcachefs/inode.c | |
parent | 5f659376fc1b9ad23b00a35242179b8961e0bc2d (diff) | |
download | linux-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/inode.c')
-rw-r--r-- | fs/bcachefs/inode.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c index 4ca70c6c3a4f..cf453edcb5ab 100644 --- a/fs/bcachefs/inode.c +++ b/fs/bcachefs/inode.c @@ -306,40 +306,40 @@ static int __bch2_inode_invalid(struct bkey_s_c k, struct printbuf *err) if (k.k->p.inode) { prt_printf(err, "nonzero k.p.inode"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (k.k->p.offset < BLOCKDEV_INODE_MAX) { prt_printf(err, "fs inode in blockdev range"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (bch2_inode_unpack(k, &unpacked)) { prt_printf(err, "invalid variable length fields"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (unpacked.bi_data_checksum >= BCH_CSUM_OPT_NR + 1) { prt_printf(err, "invalid data checksum type (%u >= %u", unpacked.bi_data_checksum, BCH_CSUM_OPT_NR + 1); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (unpacked.bi_compression >= BCH_COMPRESSION_OPT_NR + 1) { prt_printf(err, "invalid data checksum type (%u >= %u)", unpacked.bi_compression, BCH_COMPRESSION_OPT_NR + 1); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if ((unpacked.bi_flags & BCH_INODE_UNLINKED) && unpacked.bi_nlink != 0) { prt_printf(err, "flagged as unlinked but bi_nlink != 0"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (unpacked.bi_subvol && !S_ISDIR(unpacked.bi_mode)) { prt_printf(err, "subvolume root but not a directory"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } return 0; @@ -353,13 +353,13 @@ int bch2_inode_invalid(const struct bch_fs *c, struct bkey_s_c k, if (bkey_val_bytes(k.k) < sizeof(*inode.v)) { prt_printf(err, "incorrect value size (%zu < %zu)", bkey_val_bytes(k.k), sizeof(*inode.v)); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (INODE_STR_HASH(inode.v) >= BCH_STR_HASH_NR) { prt_printf(err, "invalid str hash type (%llu >= %u)", INODE_STR_HASH(inode.v), BCH_STR_HASH_NR); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } return __bch2_inode_invalid(k, err); @@ -373,13 +373,13 @@ int bch2_inode_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, if (bkey_val_bytes(k.k) < sizeof(*inode.v)) { prt_printf(err, "incorrect value size (%zu < %zu)", bkey_val_bytes(k.k), sizeof(*inode.v)); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (INODEv2_STR_HASH(inode.v) >= BCH_STR_HASH_NR) { prt_printf(err, "invalid str hash type (%llu >= %u)", INODEv2_STR_HASH(inode.v), BCH_STR_HASH_NR); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } return __bch2_inode_invalid(k, err); @@ -421,13 +421,13 @@ int bch2_inode_generation_invalid(const struct bch_fs *c, struct bkey_s_c k, { if (k.k->p.inode) { prt_printf(err, "nonzero k.p.inode"); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } if (bkey_val_bytes(k.k) != sizeof(struct bch_inode_generation)) { prt_printf(err, "incorrect value size (%zu != %zu)", bkey_val_bytes(k.k), sizeof(struct bch_inode_generation)); - return -EINVAL; + return -BCH_ERR_invalid_bkey; } return 0; |