summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_update.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-11-26 20:18:16 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-01 11:47:38 -0500
commitc259bd95d1df6a95d6a78b7f6ebc69c8d172126f (patch)
treeabf7e98b5bafebe525581d93fc687a642ba8b4fd /fs/bcachefs/btree_update.c
parent3c471b65889aa22d6ba4f8e3d2e5006bb70fdb58 (diff)
downloadlwn-c259bd95d1df6a95d6a78b7f6ebc69c8d172126f.tar.gz
lwn-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/btree_update.c')
-rw-r--r--fs/bcachefs/btree_update.c30
1 files changed, 5 insertions, 25 deletions
diff --git a/fs/bcachefs/btree_update.c b/fs/bcachefs/btree_update.c
index 0d6830ec73c4..3642e2629716 100644
--- a/fs/bcachefs/btree_update.c
+++ b/fs/bcachefs/btree_update.c
@@ -710,20 +710,6 @@ int bch2_btree_delete_at(struct btree_trans *trans,
return bch2_btree_delete_extent_at(trans, iter, 0, update_flags);
}
-int bch2_btree_delete_at_buffered(struct btree_trans *trans,
- enum btree_id btree, struct bpos pos)
-{
- struct bkey_i *k;
-
- k = bch2_trans_kmalloc(trans, sizeof(*k));
- if (IS_ERR(k))
- return PTR_ERR(k);
-
- bkey_init(&k->k);
- k->k.p = pos;
- return bch2_trans_update_buffered(trans, btree, k);
-}
-
int bch2_btree_delete(struct btree_trans *trans,
enum btree_id btree, struct bpos pos,
unsigned update_flags)
@@ -828,19 +814,13 @@ int bch2_btree_delete_range(struct bch_fs *c, enum btree_id id,
int bch2_btree_bit_mod(struct btree_trans *trans, enum btree_id btree,
struct bpos pos, bool set)
{
- struct bkey_i *k;
- int ret = 0;
+ struct bkey_i k;
- k = bch2_trans_kmalloc_nomemzero(trans, sizeof(*k));
- ret = PTR_ERR_OR_ZERO(k);
- if (unlikely(ret))
- return ret;
-
- bkey_init(&k->k);
- k->k.type = set ? KEY_TYPE_set : KEY_TYPE_deleted;
- k->k.p = pos;
+ bkey_init(&k.k);
+ k.k.type = set ? KEY_TYPE_set : KEY_TYPE_deleted;
+ k.k.p = pos;
- return bch2_trans_update_buffered(trans, btree, k);
+ return bch2_trans_update_buffered(trans, btree, &k);
}
__printf(2, 0)