summaryrefslogtreecommitdiff
path: root/libbcachefs/btree_key_cache.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-05-02 18:39:16 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-05-02 18:42:06 -0400
commit6f5afc0c12bbf56ffdabe5b2c5297aef255c4baa (patch)
treef5da49a340ab5d14835d37d69d5126f0e955833c /libbcachefs/btree_key_cache.c
parent88b27bd794e2fce01453f1b8c482fe1c2470c8d0 (diff)
Update bcachefs sources to bdf6d7c135 fixup! bcachefs: Kill journal buf bloom filter
Diffstat (limited to 'libbcachefs/btree_key_cache.c')
-rw-r--r--libbcachefs/btree_key_cache.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libbcachefs/btree_key_cache.c b/libbcachefs/btree_key_cache.c
index ab394c2d..a575189f 100644
--- a/libbcachefs/btree_key_cache.c
+++ b/libbcachefs/btree_key_cache.c
@@ -236,6 +236,13 @@ static int btree_key_cache_fill(struct btree_trans *trans,
*/
new_u64s = k.k->u64s + 1;
+ /*
+ * Allocate some extra space so that the transaction commit path is less
+ * likely to have to reallocate, since that requires a transaction
+ * restart:
+ */
+ new_u64s = min(256U, (new_u64s * 3) / 2);
+
if (new_u64s > ck->u64s) {
new_u64s = roundup_pow_of_two(new_u64s);
new_k = kmalloc(new_u64s * sizeof(u64), GFP_NOFS);