From 275c8426fb8fd475e9991b3aa1b20f66069e594f Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 3 Apr 2022 21:50:25 -0400 Subject: bcachefs: Add rw to .key_invalid() This adds a new parameter to .key_invalid() methods for whether the key is being read or written; the idea being that methods can do more aggressive checks when a key is newly created and being written, when we wouldn't want to delete the key because of those checks. Signed-off-by: Kent Overstreet --- fs/bcachefs/extents.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'fs/bcachefs/extents.c') diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c index e09636023882..c56925d94bfe 100644 --- a/fs/bcachefs/extents.c +++ b/fs/bcachefs/extents.c @@ -156,7 +156,7 @@ int bch2_bkey_pick_read_device(struct bch_fs *c, struct bkey_s_c k, /* KEY_TYPE_btree_ptr: */ int bch2_btree_ptr_invalid(const struct bch_fs *c, struct bkey_s_c k, - struct printbuf *err) + int rw, struct printbuf *err) { if (bkey_val_u64s(k.k) > BCH_REPLICAS_MAX) { pr_buf(err, "value too big (%zu > %u)", @@ -164,7 +164,7 @@ int bch2_btree_ptr_invalid(const struct bch_fs *c, struct bkey_s_c k, return -EINVAL; } - return bch2_bkey_ptrs_invalid(c, k, err); + return bch2_bkey_ptrs_invalid(c, k, rw, err); } void bch2_btree_ptr_to_text(struct printbuf *out, struct bch_fs *c, @@ -174,7 +174,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, - struct printbuf *err) + int rw, struct printbuf *err) { struct bkey_s_c_btree_ptr_v2 bp = bkey_s_c_to_btree_ptr_v2(k); @@ -197,11 +197,11 @@ int bch2_btree_ptr_v2_invalid(const struct bch_fs *c, struct bkey_s_c k, return -EINVAL; } - return bch2_bkey_ptrs_invalid(c, k, err); + return bch2_bkey_ptrs_invalid(c, k, rw, err); } void bch2_btree_ptr_v2_to_text(struct printbuf *out, struct bch_fs *c, - struct bkey_s_c k) + struct bkey_s_c k) { struct bkey_s_c_btree_ptr_v2 bp = bkey_s_c_to_btree_ptr_v2(k); @@ -366,7 +366,7 @@ bool bch2_extent_merge(struct bch_fs *c, struct bkey_s l, struct bkey_s_c r) /* KEY_TYPE_reservation: */ int bch2_reservation_invalid(const struct bch_fs *c, struct bkey_s_c k, - struct printbuf *err) + int rw, struct printbuf *err) { struct bkey_s_c_reservation r = bkey_s_c_to_reservation(k); @@ -1059,7 +1059,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, - struct printbuf *err) + int rw, struct printbuf *err) { struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); const union bch_extent_entry *entry; -- cgit v1.2.3