Commit facafdcb authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Change bkey_invalid() rw param to flags

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 83f33d68
...@@ -222,7 +222,7 @@ static unsigned bch_alloc_v1_val_u64s(const struct bch_alloc *a) ...@@ -222,7 +222,7 @@ static unsigned bch_alloc_v1_val_u64s(const struct bch_alloc *a)
} }
int bch2_alloc_v1_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_alloc_v1_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_alloc a = bkey_s_c_to_alloc(k); struct bkey_s_c_alloc a = bkey_s_c_to_alloc(k);
...@@ -237,7 +237,7 @@ int bch2_alloc_v1_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -237,7 +237,7 @@ int bch2_alloc_v1_invalid(const struct bch_fs *c, struct bkey_s_c k,
} }
int bch2_alloc_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_alloc_v2_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_alloc_unpacked u; struct bkey_alloc_unpacked u;
...@@ -250,7 +250,7 @@ int bch2_alloc_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -250,7 +250,7 @@ int bch2_alloc_v2_invalid(const struct bch_fs *c, struct bkey_s_c k,
} }
int bch2_alloc_v3_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_alloc_v3_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_alloc_unpacked u; struct bkey_alloc_unpacked u;
...@@ -263,9 +263,10 @@ int bch2_alloc_v3_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -263,9 +263,10 @@ int bch2_alloc_v3_invalid(const struct bch_fs *c, struct bkey_s_c k,
} }
int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_alloc_v4 a = bkey_s_c_to_alloc_v4(k); struct bkey_s_c_alloc_v4 a = bkey_s_c_to_alloc_v4(k);
int rw = flags & WRITE;
if (alloc_v4_u64s(a.v) != bkey_val_u64s(k.k)) { if (alloc_v4_u64s(a.v) != bkey_val_u64s(k.k)) {
prt_printf(err, "bad val size (%lu != %u)", prt_printf(err, "bad val size (%lu != %u)",
...@@ -620,7 +621,7 @@ static unsigned alloc_gen(struct bkey_s_c k, unsigned offset) ...@@ -620,7 +621,7 @@ static unsigned alloc_gen(struct bkey_s_c k, unsigned offset)
} }
int bch2_bucket_gens_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_bucket_gens_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (bkey_val_bytes(k.k) != sizeof(struct bch_bucket_gens)) { if (bkey_val_bytes(k.k) != sizeof(struct bch_bucket_gens)) {
prt_printf(err, "bad val size (%lu != %zu)", prt_printf(err, "bad val size (%lu != %zu)",
......
...@@ -122,10 +122,10 @@ struct bkey_i_alloc_v4 *bch2_alloc_to_v4_mut(struct btree_trans *, struct bkey_s ...@@ -122,10 +122,10 @@ struct bkey_i_alloc_v4 *bch2_alloc_to_v4_mut(struct btree_trans *, struct bkey_s
int bch2_bucket_io_time_reset(struct btree_trans *, unsigned, size_t, int); int bch2_bucket_io_time_reset(struct btree_trans *, unsigned, size_t, int);
int bch2_alloc_v1_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_alloc_v1_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
int bch2_alloc_v2_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_alloc_v2_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
int bch2_alloc_v3_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_alloc_v3_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
int bch2_alloc_v4_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_alloc_v4_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
void bch2_alloc_v4_swab(struct bkey_s); void bch2_alloc_v4_swab(struct bkey_s);
void bch2_alloc_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_alloc_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
...@@ -158,7 +158,7 @@ void bch2_alloc_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); ...@@ -158,7 +158,7 @@ void bch2_alloc_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
.atomic_trigger = bch2_mark_alloc, \ .atomic_trigger = bch2_mark_alloc, \
}) })
int bch2_bucket_gens_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_bucket_gens_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
void bch2_bucket_gens_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_bucket_gens_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
#define bch2_bkey_ops_bucket_gens ((struct bkey_ops) { \ #define bch2_bkey_ops_bucket_gens ((struct bkey_ops) { \
......
...@@ -38,7 +38,7 @@ static bool extent_matches_bp(struct bch_fs *c, ...@@ -38,7 +38,7 @@ static bool extent_matches_bp(struct bch_fs *c,
} }
int bch2_backpointer_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_backpointer_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_backpointer bp = bkey_s_c_to_backpointer(k); struct bkey_s_c_backpointer bp = bkey_s_c_to_backpointer(k);
struct bpos bucket = bp_pos_to_bucket(c, bp.k->p); struct bpos bucket = bp_pos_to_bucket(c, bp.k->p);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "super.h" #include "super.h"
int bch2_backpointer_invalid(const struct bch_fs *, struct bkey_s_c k, int bch2_backpointer_invalid(const struct bch_fs *, struct bkey_s_c k,
int, struct printbuf *); unsigned, struct printbuf *);
void bch2_backpointer_to_text(struct printbuf *, const struct bch_backpointer *); void bch2_backpointer_to_text(struct printbuf *, const struct bch_backpointer *);
void bch2_backpointer_k_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_backpointer_k_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
void bch2_backpointer_swab(struct bkey_s); void bch2_backpointer_swab(struct bkey_s);
......
...@@ -24,7 +24,7 @@ const char * const bch2_bkey_types[] = { ...@@ -24,7 +24,7 @@ const char * const bch2_bkey_types[] = {
}; };
static int deleted_key_invalid(const struct bch_fs *c, struct bkey_s_c k, static int deleted_key_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
return 0; return 0;
} }
...@@ -38,7 +38,7 @@ static int deleted_key_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -38,7 +38,7 @@ static int deleted_key_invalid(const struct bch_fs *c, struct bkey_s_c k,
}) })
static int empty_val_key_invalid(const struct bch_fs *c, struct bkey_s_c k, static int empty_val_key_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (bkey_val_bytes(k.k)) { if (bkey_val_bytes(k.k)) {
prt_printf(err, "incorrect value size (%zu != 0)", prt_printf(err, "incorrect value size (%zu != 0)",
...@@ -54,7 +54,7 @@ static int empty_val_key_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -54,7 +54,7 @@ static int empty_val_key_invalid(const struct bch_fs *c, struct bkey_s_c k,
}) })
static int key_type_cookie_invalid(const struct bch_fs *c, struct bkey_s_c k, static int key_type_cookie_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (bkey_val_bytes(k.k) != sizeof(struct bch_cookie)) { if (bkey_val_bytes(k.k) != sizeof(struct bch_cookie)) {
prt_printf(err, "incorrect value size (%zu != %zu)", prt_printf(err, "incorrect value size (%zu != %zu)",
...@@ -74,7 +74,7 @@ static int key_type_cookie_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -74,7 +74,7 @@ static int key_type_cookie_invalid(const struct bch_fs *c, struct bkey_s_c k,
}) })
static int key_type_inline_data_invalid(const struct bch_fs *c, struct bkey_s_c k, static int key_type_inline_data_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
return 0; return 0;
} }
...@@ -95,7 +95,7 @@ static void key_type_inline_data_to_text(struct printbuf *out, struct bch_fs *c, ...@@ -95,7 +95,7 @@ static void key_type_inline_data_to_text(struct printbuf *out, struct bch_fs *c,
}) })
static int key_type_set_invalid(const struct bch_fs *c, struct bkey_s_c k, static int key_type_set_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (bkey_val_bytes(k.k)) { if (bkey_val_bytes(k.k)) {
prt_printf(err, "incorrect value size (%zu != %zu)", prt_printf(err, "incorrect value size (%zu != %zu)",
...@@ -124,14 +124,14 @@ const struct bkey_ops bch2_bkey_ops[] = { ...@@ -124,14 +124,14 @@ const struct bkey_ops bch2_bkey_ops[] = {
}; };
int bch2_bkey_val_invalid(struct bch_fs *c, struct bkey_s_c k, int bch2_bkey_val_invalid(struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (k.k->type >= KEY_TYPE_MAX) { if (k.k->type >= KEY_TYPE_MAX) {
prt_printf(err, "invalid type (%u >= %u)", k.k->type, KEY_TYPE_MAX); prt_printf(err, "invalid type (%u >= %u)", k.k->type, KEY_TYPE_MAX);
return -BCH_ERR_invalid_bkey; return -BCH_ERR_invalid_bkey;
} }
return bch2_bkey_ops[k.k->type].key_invalid(c, k, rw, err); return bch2_bkey_ops[k.k->type].key_invalid(c, k, flags, err);
} }
static unsigned bch2_key_types_allowed[] = { static unsigned bch2_key_types_allowed[] = {
...@@ -207,7 +207,7 @@ static unsigned bch2_key_types_allowed[] = { ...@@ -207,7 +207,7 @@ static unsigned bch2_key_types_allowed[] = {
int __bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k, int __bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k,
enum btree_node_type type, enum btree_node_type type,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (k.k->u64s < BKEY_U64s) { if (k.k->u64s < BKEY_U64s) {
prt_printf(err, "u64s too small (%u < %zu)", k.k->u64s, BKEY_U64s); prt_printf(err, "u64s too small (%u < %zu)", k.k->u64s, BKEY_U64s);
...@@ -263,10 +263,10 @@ int __bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k, ...@@ -263,10 +263,10 @@ int __bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k,
int bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k, int bch2_bkey_invalid(struct bch_fs *c, struct bkey_s_c k,
enum btree_node_type type, enum btree_node_type type,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
return __bch2_bkey_invalid(c, k, type, rw, err) ?: return __bch2_bkey_invalid(c, k, type, flags, err) ?:
bch2_bkey_val_invalid(c, k, rw, err); bch2_bkey_val_invalid(c, k, flags, err);
} }
int bch2_bkey_in_btree_node(struct btree *b, struct bkey_s_c k, int bch2_bkey_in_btree_node(struct btree *b, struct bkey_s_c k,
......
...@@ -21,7 +21,7 @@ extern const char * const bch2_bkey_types[]; ...@@ -21,7 +21,7 @@ extern const char * const bch2_bkey_types[];
*/ */
struct bkey_ops { struct bkey_ops {
int (*key_invalid)(const struct bch_fs *c, struct bkey_s_c k, int (*key_invalid)(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err); unsigned flags, struct printbuf *err);
void (*val_to_text)(struct printbuf *, struct bch_fs *, void (*val_to_text)(struct printbuf *, struct bch_fs *,
struct bkey_s_c); struct bkey_s_c);
void (*swab)(struct bkey_s); void (*swab)(struct bkey_s);
...@@ -38,11 +38,11 @@ struct bkey_ops { ...@@ -38,11 +38,11 @@ struct bkey_ops {
extern const struct bkey_ops bch2_bkey_ops[]; extern const struct bkey_ops bch2_bkey_ops[];
int bch2_bkey_val_invalid(struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_bkey_val_invalid(struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
int __bch2_bkey_invalid(struct bch_fs *, struct bkey_s_c, int __bch2_bkey_invalid(struct bch_fs *, struct bkey_s_c,
enum btree_node_type, int, struct printbuf *); enum btree_node_type, unsigned, struct printbuf *);
int bch2_bkey_invalid(struct bch_fs *, struct bkey_s_c, int bch2_bkey_invalid(struct bch_fs *, struct bkey_s_c,
enum btree_node_type, int, struct printbuf *); enum btree_node_type, unsigned, struct printbuf *);
int bch2_bkey_in_btree_node(struct btree *, struct bkey_s_c, struct printbuf *); int bch2_bkey_in_btree_node(struct btree *, struct bkey_s_c, struct printbuf *);
void bch2_bpos_to_text(struct printbuf *, struct bpos); void bch2_bpos_to_text(struct printbuf *, struct bpos);
......
...@@ -84,7 +84,7 @@ const struct bch_hash_desc bch2_dirent_hash_desc = { ...@@ -84,7 +84,7 @@ const struct bch_hash_desc bch2_dirent_hash_desc = {
}; };
int bch2_dirent_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_dirent_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_dirent d = bkey_s_c_to_dirent(k); struct bkey_s_c_dirent d = bkey_s_c_to_dirent(k);
unsigned len; unsigned len;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
extern const struct bch_hash_desc bch2_dirent_hash_desc; extern const struct bch_hash_desc bch2_dirent_hash_desc;
int bch2_dirent_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_dirent_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
void bch2_dirent_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_dirent_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
#define bch2_bkey_ops_dirent ((struct bkey_ops) { \ #define bch2_bkey_ops_dirent ((struct bkey_ops) { \
......
...@@ -105,7 +105,7 @@ struct ec_bio { ...@@ -105,7 +105,7 @@ struct ec_bio {
/* Stripes btree keys: */ /* Stripes btree keys: */
int bch2_stripe_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_stripe_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
const struct bch_stripe *s = bkey_s_c_to_stripe(k).v; const struct bch_stripe *s = bkey_s_c_to_stripe(k).v;
...@@ -131,7 +131,7 @@ int bch2_stripe_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -131,7 +131,7 @@ int bch2_stripe_invalid(const struct bch_fs *c, struct bkey_s_c k,
return -BCH_ERR_invalid_bkey; return -BCH_ERR_invalid_bkey;
} }
return bch2_bkey_ptrs_invalid(c, k, rw, err); return bch2_bkey_ptrs_invalid(c, k, flags, err);
} }
void bch2_stripe_to_text(struct printbuf *out, struct bch_fs *c, void bch2_stripe_to_text(struct printbuf *out, struct bch_fs *c,
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "extents_types.h" #include "extents_types.h"
int bch2_stripe_invalid(const struct bch_fs *, struct bkey_s_c, int bch2_stripe_invalid(const struct bch_fs *, struct bkey_s_c,
int rw, struct printbuf *); unsigned, struct printbuf *);
void bch2_stripe_to_text(struct printbuf *, struct bch_fs *, void bch2_stripe_to_text(struct printbuf *, struct bch_fs *,
struct bkey_s_c); struct bkey_s_c);
......
...@@ -165,7 +165,7 @@ int bch2_bkey_pick_read_device(struct bch_fs *c, struct bkey_s_c k, ...@@ -165,7 +165,7 @@ int bch2_bkey_pick_read_device(struct bch_fs *c, struct bkey_s_c k,
/* KEY_TYPE_btree_ptr: */ /* KEY_TYPE_btree_ptr: */
int bch2_btree_ptr_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_btree_ptr_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (bkey_val_u64s(k.k) > BCH_REPLICAS_MAX) { if (bkey_val_u64s(k.k) > BCH_REPLICAS_MAX) {
prt_printf(err, "value too big (%zu > %u)", prt_printf(err, "value too big (%zu > %u)",
...@@ -173,7 +173,7 @@ int bch2_btree_ptr_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -173,7 +173,7 @@ int bch2_btree_ptr_invalid(const struct bch_fs *c, struct bkey_s_c k,
return -BCH_ERR_invalid_bkey; return -BCH_ERR_invalid_bkey;
} }
return bch2_bkey_ptrs_invalid(c, k, rw, err); return bch2_bkey_ptrs_invalid(c, k, flags, err);
} }
void bch2_btree_ptr_to_text(struct printbuf *out, struct bch_fs *c, void bch2_btree_ptr_to_text(struct printbuf *out, struct bch_fs *c,
...@@ -183,7 +183,7 @@ void bch2_btree_ptr_to_text(struct printbuf *out, struct bch_fs *c, ...@@ -183,7 +183,7 @@ void bch2_btree_ptr_to_text(struct printbuf *out, struct bch_fs *c,
} }
int bch2_btree_ptr_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_btree_ptr_v2_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_btree_ptr_v2 bp = bkey_s_c_to_btree_ptr_v2(k); struct bkey_s_c_btree_ptr_v2 bp = bkey_s_c_to_btree_ptr_v2(k);
...@@ -206,7 +206,7 @@ int bch2_btree_ptr_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -206,7 +206,7 @@ int bch2_btree_ptr_v2_invalid(const struct bch_fs *c, struct bkey_s_c k,
return -BCH_ERR_invalid_bkey; return -BCH_ERR_invalid_bkey;
} }
return bch2_bkey_ptrs_invalid(c, k, rw, err); return bch2_bkey_ptrs_invalid(c, k, flags, err);
} }
void bch2_btree_ptr_v2_to_text(struct printbuf *out, struct bch_fs *c, void bch2_btree_ptr_v2_to_text(struct printbuf *out, struct bch_fs *c,
...@@ -388,7 +388,7 @@ bool bch2_extent_merge(struct bch_fs *c, struct bkey_s l, struct bkey_s_c r) ...@@ -388,7 +388,7 @@ bool bch2_extent_merge(struct bch_fs *c, struct bkey_s l, struct bkey_s_c r)
/* KEY_TYPE_reservation: */ /* KEY_TYPE_reservation: */
int bch2_reservation_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_reservation_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_reservation r = bkey_s_c_to_reservation(k); struct bkey_s_c_reservation r = bkey_s_c_to_reservation(k);
...@@ -1085,7 +1085,7 @@ static int extent_ptr_invalid(const struct bch_fs *c, ...@@ -1085,7 +1085,7 @@ static int extent_ptr_invalid(const struct bch_fs *c,
} }
int bch2_bkey_ptrs_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_bkey_ptrs_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
const union bch_extent_entry *entry; const union bch_extent_entry *entry;
......
...@@ -371,11 +371,11 @@ int bch2_bkey_pick_read_device(struct bch_fs *, struct bkey_s_c, ...@@ -371,11 +371,11 @@ int bch2_bkey_pick_read_device(struct bch_fs *, struct bkey_s_c,
/* KEY_TYPE_btree_ptr: */ /* KEY_TYPE_btree_ptr: */
int bch2_btree_ptr_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_btree_ptr_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
void bch2_btree_ptr_to_text(struct printbuf *, struct bch_fs *, void bch2_btree_ptr_to_text(struct printbuf *, struct bch_fs *,
struct bkey_s_c); struct bkey_s_c);
int bch2_btree_ptr_v2_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_btree_ptr_v2_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
void bch2_btree_ptr_v2_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_btree_ptr_v2_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
void bch2_btree_ptr_v2_compat(enum btree_id, unsigned, unsigned, void bch2_btree_ptr_v2_compat(enum btree_id, unsigned, unsigned,
int, struct bkey_s); int, struct bkey_s);
...@@ -414,7 +414,7 @@ bool bch2_extent_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c); ...@@ -414,7 +414,7 @@ bool bch2_extent_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c);
/* KEY_TYPE_reservation: */ /* KEY_TYPE_reservation: */
int bch2_reservation_invalid(const struct bch_fs *, struct bkey_s_c, int bch2_reservation_invalid(const struct bch_fs *, struct bkey_s_c,
int, struct printbuf *); unsigned, struct printbuf *);
void bch2_reservation_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_reservation_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
bool bch2_reservation_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c); bool bch2_reservation_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c);
...@@ -659,7 +659,7 @@ bool bch2_extent_normalize(struct bch_fs *, struct bkey_s); ...@@ -659,7 +659,7 @@ bool bch2_extent_normalize(struct bch_fs *, struct bkey_s);
void bch2_bkey_ptrs_to_text(struct printbuf *, struct bch_fs *, void bch2_bkey_ptrs_to_text(struct printbuf *, struct bch_fs *,
struct bkey_s_c); struct bkey_s_c);
int bch2_bkey_ptrs_invalid(const struct bch_fs *, struct bkey_s_c, int bch2_bkey_ptrs_invalid(const struct bch_fs *, struct bkey_s_c,
int, struct printbuf *); unsigned, struct printbuf *);
void bch2_ptr_swab(struct bkey_s); void bch2_ptr_swab(struct bkey_s);
......
...@@ -433,7 +433,7 @@ static int __bch2_inode_invalid(struct bkey_s_c k, struct printbuf *err) ...@@ -433,7 +433,7 @@ static int __bch2_inode_invalid(struct bkey_s_c k, struct printbuf *err)
} }
int bch2_inode_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_inode_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_inode inode = bkey_s_c_to_inode(k); struct bkey_s_c_inode inode = bkey_s_c_to_inode(k);
...@@ -453,7 +453,7 @@ int bch2_inode_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -453,7 +453,7 @@ int bch2_inode_invalid(const struct bch_fs *c, struct bkey_s_c k,
} }
int bch2_inode_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_inode_v2_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_inode_v2 inode = bkey_s_c_to_inode_v2(k); struct bkey_s_c_inode_v2 inode = bkey_s_c_to_inode_v2(k);
...@@ -473,7 +473,7 @@ int bch2_inode_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -473,7 +473,7 @@ int bch2_inode_v2_invalid(const struct bch_fs *c, struct bkey_s_c k,
} }
int bch2_inode_v3_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_inode_v3_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_inode_v3 inode = bkey_s_c_to_inode_v3(k); struct bkey_s_c_inode_v3 inode = bkey_s_c_to_inode_v3(k);
...@@ -536,7 +536,7 @@ void bch2_inode_to_text(struct printbuf *out, struct bch_fs *c, struct bkey_s_c ...@@ -536,7 +536,7 @@ void bch2_inode_to_text(struct printbuf *out, struct bch_fs *c, struct bkey_s_c
} }
int bch2_inode_generation_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_inode_generation_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (k.k->p.inode) { if (k.k->p.inode) {
prt_printf(err, "nonzero k.p.inode"); prt_printf(err, "nonzero k.p.inode");
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
extern const char * const bch2_inode_opts[]; extern const char * const bch2_inode_opts[];
int bch2_inode_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_inode_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
int bch2_inode_v2_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_inode_v2_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
int bch2_inode_v3_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_inode_v3_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
void bch2_inode_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_inode_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
#define bch2_bkey_ops_inode ((struct bkey_ops) { \ #define bch2_bkey_ops_inode ((struct bkey_ops) { \
...@@ -41,7 +41,7 @@ static inline bool bkey_is_inode(const struct bkey *k) ...@@ -41,7 +41,7 @@ static inline bool bkey_is_inode(const struct bkey *k)
} }
int bch2_inode_generation_invalid(const struct bch_fs *, struct bkey_s_c, int bch2_inode_generation_invalid(const struct bch_fs *, struct bkey_s_c,
int, struct printbuf *); unsigned, struct printbuf *);
void bch2_inode_generation_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_inode_generation_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
#define bch2_bkey_ops_inode_generation ((struct bkey_ops) { \ #define bch2_bkey_ops_inode_generation ((struct bkey_ops) { \
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
/* KEY_TYPE_lru is obsolete: */ /* KEY_TYPE_lru is obsolete: */
int bch2_lru_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_lru_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
const struct bch_lru *lru = bkey_s_c_to_lru(k).v; const struct bch_lru *lru = bkey_s_c_to_lru(k).v;
......
...@@ -22,7 +22,7 @@ static inline u64 lru_pos_time(struct bpos pos) ...@@ -22,7 +22,7 @@ static inline u64 lru_pos_time(struct bpos pos)
return pos.inode & ~(~0ULL << LRU_TIME_BITS); return pos.inode & ~(~0ULL << LRU_TIME_BITS);
} }
int bch2_lru_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_lru_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
void bch2_lru_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_lru_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
#define bch2_bkey_ops_lru ((struct bkey_ops) { \ #define bch2_bkey_ops_lru ((struct bkey_ops) { \
......
...@@ -59,7 +59,7 @@ const struct bch_sb_field_ops bch_sb_field_ops_quota = { ...@@ -59,7 +59,7 @@ const struct bch_sb_field_ops bch_sb_field_ops_quota = {
}; };
int bch2_quota_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_quota_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (k.k->p.inode >= QTYP_NR) { if (k.k->p.inode >= QTYP_NR) {
prt_printf(err, "invalid quota type (%llu >= %u)", prt_printf(err, "invalid quota type (%llu >= %u)",
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
extern const struct bch_sb_field_ops bch_sb_field_ops_quota; extern const struct bch_sb_field_ops bch_sb_field_ops_quota;
int bch2_quota_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_quota_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
void bch2_quota_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_quota_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
#define bch2_bkey_ops_quota ((struct bkey_ops) { \ #define bch2_bkey_ops_quota ((struct bkey_ops) { \
......
...@@ -26,7 +26,7 @@ static inline unsigned bkey_type_to_indirect(const struct bkey *k) ...@@ -26,7 +26,7 @@ static inline unsigned bkey_type_to_indirect(const struct bkey *k)
/* reflink pointers */ /* reflink pointers */
int bch2_reflink_p_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_reflink_p_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_reflink_p p = bkey_s_c_to_reflink_p(k); struct bkey_s_c_reflink_p p = bkey_s_c_to_reflink_p(k);
...@@ -78,7 +78,7 @@ bool bch2_reflink_p_merge(struct bch_fs *c, struct bkey_s _l, struct bkey_s_c _r ...@@ -78,7 +78,7 @@ bool bch2_reflink_p_merge(struct bch_fs *c, struct bkey_s _l, struct bkey_s_c _r
/* indirect extents */ /* indirect extents */
int bch2_reflink_v_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_reflink_v_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_reflink_v r = bkey_s_c_to_reflink_v(k); struct bkey_s_c_reflink_v r = bkey_s_c_to_reflink_v(k);
...@@ -88,7 +88,7 @@ int bch2_reflink_v_invalid(const struct bch_fs *c, struct bkey_s_c k, ...@@ -88,7 +88,7 @@ int bch2_reflink_v_invalid(const struct bch_fs *c, struct bkey_s_c k,
return -BCH_ERR_invalid_bkey; return -BCH_ERR_invalid_bkey;
} }
return bch2_bkey_ptrs_invalid(c, k, rw, err); return bch2_bkey_ptrs_invalid(c, k, flags, err);
} }
void bch2_reflink_v_to_text(struct printbuf *out, struct bch_fs *c, void bch2_reflink_v_to_text(struct printbuf *out, struct bch_fs *c,
...@@ -131,7 +131,7 @@ int bch2_trans_mark_reflink_v(struct btree_trans *trans, ...@@ -131,7 +131,7 @@ int bch2_trans_mark_reflink_v(struct btree_trans *trans,
/* indirect inline data */ /* indirect inline data */
int bch2_indirect_inline_data_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_indirect_inline_data_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (bkey_val_bytes(k.k) < sizeof(struct bch_indirect_inline_data)) { if (bkey_val_bytes(k.k) < sizeof(struct bch_indirect_inline_data)) {
prt_printf(err, "incorrect value size (%zu < %zu)", prt_printf(err, "incorrect value size (%zu < %zu)",
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#define _BCACHEFS_REFLINK_H #define _BCACHEFS_REFLINK_H
int bch2_reflink_p_invalid(const struct bch_fs *, struct bkey_s_c, int bch2_reflink_p_invalid(const struct bch_fs *, struct bkey_s_c,
int, struct printbuf *); unsigned, struct printbuf *);
void bch2_reflink_p_to_text(struct printbuf *, struct bch_fs *, void bch2_reflink_p_to_text(struct printbuf *, struct bch_fs *,
struct bkey_s_c); struct bkey_s_c);
bool bch2_reflink_p_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c); bool bch2_reflink_p_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c);
...@@ -17,7 +17,7 @@ bool bch2_reflink_p_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c); ...@@ -17,7 +17,7 @@ bool bch2_reflink_p_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c);
}) })
int bch2_reflink_v_invalid(const struct bch_fs *, struct bkey_s_c, int bch2_reflink_v_invalid(const struct bch_fs *, struct bkey_s_c,
int, struct printbuf *); unsigned, struct printbuf *);
void bch2_reflink_v_to_text(struct printbuf *, struct bch_fs *, void bch2_reflink_v_to_text(struct printbuf *, struct bch_fs *,
struct bkey_s_c); struct bkey_s_c);
int bch2_trans_mark_reflink_v(struct btree_trans *, enum btree_id, unsigned, int bch2_trans_mark_reflink_v(struct btree_trans *, enum btree_id, unsigned,
...@@ -32,7 +32,7 @@ int bch2_trans_mark_reflink_v(struct btree_trans *, enum btree_id, unsigned, ...@@ -32,7 +32,7 @@ int bch2_trans_mark_reflink_v(struct btree_trans *, enum btree_id, unsigned,
}) })
int bch2_indirect_inline_data_invalid(const struct bch_fs *, struct bkey_s_c, int bch2_indirect_inline_data_invalid(const struct bch_fs *, struct bkey_s_c,
int, struct printbuf *); unsigned, struct printbuf *);
void bch2_indirect_inline_data_to_text(struct printbuf *, void bch2_indirect_inline_data_to_text(struct printbuf *,
struct bch_fs *, struct bkey_s_c); struct bch_fs *, struct bkey_s_c);
int bch2_trans_mark_indirect_inline_data(struct btree_trans *, int bch2_trans_mark_indirect_inline_data(struct btree_trans *,
......
...@@ -25,7 +25,7 @@ void bch2_snapshot_to_text(struct printbuf *out, struct bch_fs *c, ...@@ -25,7 +25,7 @@ void bch2_snapshot_to_text(struct printbuf *out, struct bch_fs *c,
} }
int bch2_snapshot_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_snapshot_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
struct bkey_s_c_snapshot s; struct bkey_s_c_snapshot s;
u32 i, id; u32 i, id;
...@@ -733,7 +733,7 @@ static int bch2_delete_dead_snapshots_hook(struct btree_trans *trans, ...@@ -733,7 +733,7 @@ static int bch2_delete_dead_snapshots_hook(struct btree_trans *trans,
/* Subvolumes: */ /* Subvolumes: */
int bch2_subvolume_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_subvolume_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
if (bkey_lt(k.k->p, SUBVOL_POS_MIN) || if (bkey_lt(k.k->p, SUBVOL_POS_MIN) ||
bkey_gt(k.k->p, SUBVOL_POS_MAX)) { bkey_gt(k.k->p, SUBVOL_POS_MAX)) {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
void bch2_snapshot_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_snapshot_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
int bch2_snapshot_invalid(const struct bch_fs *, struct bkey_s_c, int bch2_snapshot_invalid(const struct bch_fs *, struct bkey_s_c,
int rw, struct printbuf *); unsigned, struct printbuf *);
#define bch2_bkey_ops_snapshot ((struct bkey_ops) { \ #define bch2_bkey_ops_snapshot ((struct bkey_ops) { \
.key_invalid = bch2_snapshot_invalid, \ .key_invalid = bch2_snapshot_invalid, \
...@@ -106,7 +106,7 @@ void bch2_fs_snapshots_exit(struct bch_fs *); ...@@ -106,7 +106,7 @@ void bch2_fs_snapshots_exit(struct bch_fs *);
int bch2_fs_snapshots_start(struct bch_fs *); int bch2_fs_snapshots_start(struct bch_fs *);
int bch2_subvolume_invalid(const struct bch_fs *, struct bkey_s_c, int bch2_subvolume_invalid(const struct bch_fs *, struct bkey_s_c,
int rw, struct printbuf *); unsigned, struct printbuf *);
void bch2_subvolume_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_subvolume_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
#define bch2_bkey_ops_subvolume ((struct bkey_ops) { \ #define bch2_bkey_ops_subvolume ((struct bkey_ops) { \
......
...@@ -70,7 +70,7 @@ const struct bch_hash_desc bch2_xattr_hash_desc = { ...@@ -70,7 +70,7 @@ const struct bch_hash_desc bch2_xattr_hash_desc = {
}; };
int bch2_xattr_invalid(const struct bch_fs *c, struct bkey_s_c k, int bch2_xattr_invalid(const struct bch_fs *c, struct bkey_s_c k,
int rw, struct printbuf *err) unsigned flags, struct printbuf *err)
{ {
const struct xattr_handler *handler; const struct xattr_handler *handler;
struct bkey_s_c_xattr xattr = bkey_s_c_to_xattr(k); struct bkey_s_c_xattr xattr = bkey_s_c_to_xattr(k);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
extern const struct bch_hash_desc bch2_xattr_hash_desc; extern const struct bch_hash_desc bch2_xattr_hash_desc;
int bch2_xattr_invalid(const struct bch_fs *, struct bkey_s_c, int, struct printbuf *); int bch2_xattr_invalid(const struct bch_fs *, struct bkey_s_c, unsigned, struct printbuf *);
void bch2_xattr_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c); void bch2_xattr_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
#define bch2_bkey_ops_xattr ((struct bkey_ops) { \ #define bch2_bkey_ops_xattr ((struct bkey_ops) { \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment