mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
bcachefs: Use proper errcodes for inode unpack errors
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
c5022a702e
commit
5cd80c5f33
@ -196,6 +196,8 @@
|
||||
x(EINVAL, remove_with_metadata_missing_unimplemented)\
|
||||
x(EINVAL, remove_would_lose_data) \
|
||||
x(EINVAL, no_resize_with_buckets_nouse) \
|
||||
x(EINVAL, inode_unpack_error) \
|
||||
x(EINVAL, varint_decode_error) \
|
||||
x(EROFS, erofs_trans_commit) \
|
||||
x(EROFS, erofs_no_writes) \
|
||||
x(EROFS, erofs_journal_err) \
|
||||
@ -313,6 +315,7 @@ static inline long bch2_err_class(long err)
|
||||
|
||||
#define BLK_STS_REMOVED ((__force blk_status_t)128)
|
||||
|
||||
#include <linux/blk_types.h>
|
||||
const char *bch2_blk_status_to_str(blk_status_t);
|
||||
|
||||
#endif /* _BCACHFES_ERRCODE_H */
|
||||
|
@ -48,10 +48,10 @@ static int inode_decode_field(const u8 *in, const u8 *end,
|
||||
u8 *p;
|
||||
|
||||
if (in >= end)
|
||||
return -1;
|
||||
return -BCH_ERR_inode_unpack_error;
|
||||
|
||||
if (!*in)
|
||||
return -1;
|
||||
return -BCH_ERR_inode_unpack_error;
|
||||
|
||||
/*
|
||||
* position of highest set bit indicates number of bytes:
|
||||
@ -61,7 +61,7 @@ static int inode_decode_field(const u8 *in, const u8 *end,
|
||||
bytes = byte_table[shift - 1];
|
||||
|
||||
if (in + bytes > end)
|
||||
return -1;
|
||||
return -BCH_ERR_inode_unpack_error;
|
||||
|
||||
p = (u8 *) be + 16 - bytes;
|
||||
memcpy(p, in, bytes);
|
||||
@ -177,7 +177,7 @@ static noinline int bch2_inode_unpack_v1(struct bkey_s_c_inode inode,
|
||||
return ret; \
|
||||
\
|
||||
if (field_bits > sizeof(unpacked->_name) * 8) \
|
||||
return -1; \
|
||||
return -BCH_ERR_inode_unpack_error; \
|
||||
\
|
||||
unpacked->_name = field[1]; \
|
||||
in += ret;
|
||||
@ -218,7 +218,7 @@ static int bch2_inode_unpack_v2(struct bch_inode_unpacked *unpacked,
|
||||
\
|
||||
unpacked->_name = v[0]; \
|
||||
if (v[1] || v[0] != unpacked->_name) \
|
||||
return -1; \
|
||||
return -BCH_ERR_inode_unpack_error; \
|
||||
fieldnr++;
|
||||
|
||||
BCH_INODE_FIELDS_v2()
|
||||
@ -269,7 +269,7 @@ static int bch2_inode_unpack_v3(struct bkey_s_c k,
|
||||
\
|
||||
unpacked->_name = v[0]; \
|
||||
if (v[1] || v[0] != unpacked->_name) \
|
||||
return -1; \
|
||||
return -BCH_ERR_inode_unpack_error; \
|
||||
fieldnr++;
|
||||
|
||||
BCH_INODE_FIELDS_v3()
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <valgrind/memcheck.h>
|
||||
#endif
|
||||
|
||||
#include "errcode.h"
|
||||
#include "varint.h"
|
||||
|
||||
/**
|
||||
@ -53,7 +54,7 @@ int bch2_varint_decode(const u8 *in, const u8 *end, u64 *out)
|
||||
u64 v;
|
||||
|
||||
if (unlikely(in + bytes > end))
|
||||
return -1;
|
||||
return -BCH_ERR_varint_decode_error;
|
||||
|
||||
if (likely(bytes < 9)) {
|
||||
__le64 v_le = 0;
|
||||
@ -115,7 +116,7 @@ int bch2_varint_decode_fast(const u8 *in, const u8 *end, u64 *out)
|
||||
unsigned bytes = ffz(*in) + 1;
|
||||
|
||||
if (unlikely(in + bytes > end))
|
||||
return -1;
|
||||
return -BCH_ERR_varint_decode_error;
|
||||
|
||||
if (likely(bytes < 9)) {
|
||||
v >>= bytes;
|
||||
|
Loading…
Reference in New Issue
Block a user