bcachefs: Use kvzalloc() when dynamically allocating btree paths
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 12 Feb 2024 20:17:14 +0000 (15:17 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 14 Mar 2024 01:22:24 +0000 (21:22 -0400)
THis silences a mm/page_alloc.c warning about allocating more than a
page with GFP_NOFAIL - and there's no reason for this to not have a
vmalloc fallback anyways.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_iter.c

index f7eec6d398f84f42b35bb1ce08dd996130286946..51bcdc6c6d1cda83be21b43b54d0d11f320a0471 100644 (file)
@@ -1520,7 +1520,7 @@ static noinline void btree_paths_realloc(struct btree_trans *trans)
 {
        unsigned nr = trans->nr_paths * 2;
 
-       void *p = kzalloc(BITS_TO_LONGS(nr) * sizeof(unsigned long) +
+       void *p = kvzalloc(BITS_TO_LONGS(nr) * sizeof(unsigned long) +
                          sizeof(struct btree_trans_paths) +
                          nr * sizeof(struct btree_path) +
                          nr * sizeof(btree_path_idx_t) + 8 +
@@ -3091,7 +3091,7 @@ void bch2_trans_put(struct btree_trans *trans)
        trans->paths            = NULL;
 
        if (paths_allocated != trans->_paths_allocated)
-               kfree_rcu_mightsleep(paths_allocated);
+               kvfree_rcu_mightsleep(paths_allocated);
 
        if (trans->mem_bytes == BTREE_TRANS_MEM_MAX)
                mempool_free(trans->mem, &c->btree_trans_mem_pool);