diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-27 02:18:16 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-01 17:47:38 +0100 |
commit | c259bd95d1df6a95d6a78b7f6ebc69c8d172126f (patch) | |
tree | abf7e98b5bafebe525581d93fc687a642ba8b4fd /fs/bcachefs/backpointers.c | |
parent | bcachefs: convert bch_fs_flags to x-macro (diff) | |
download | linux-c259bd95d1df6a95d6a78b7f6ebc69c8d172126f.tar.xz linux-c259bd95d1df6a95d6a78b7f6ebc69c8d172126f.zip |
bcachefs: No need to allocate keys for write buffer
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/backpointers.c')
-rw-r--r-- | fs/bcachefs/backpointers.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c index 69bd6c281d1a..2b6ab5ce95f2 100644 --- a/fs/bcachefs/backpointers.c +++ b/fs/bcachefs/backpointers.c @@ -136,15 +136,30 @@ static noinline int backpointer_mod_err(struct btree_trans *trans, } int bch2_bucket_backpointer_mod_nowritebuffer(struct btree_trans *trans, - struct bkey_i_backpointer *bp_k, + struct bpos bucket, struct bch_backpointer bp, struct bkey_s_c orig_k, bool insert) { struct btree_iter bp_iter; struct bkey_s_c k; + struct bkey_i_backpointer *bp_k; int ret; + bp_k = bch2_trans_kmalloc_nomemzero(trans, sizeof(struct bkey_i_backpointer)); + ret = PTR_ERR_OR_ZERO(bp_k); + if (ret) + return ret; + + bkey_backpointer_init(&bp_k->k_i); + bp_k->k.p = bucket_pos_to_bp(trans->c, bucket, bp.bucket_offset); + bp_k->v = bp; + + if (!insert) { + bp_k->k.type = KEY_TYPE_deleted; + set_bkey_val_u64s(&bp_k->k, 0); + } + k = bch2_bkey_get_iter(trans, &bp_iter, BTREE_ID_backpointers, bp_k->k.p, BTREE_ITER_INTENT| |