Commit a58a6a58 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Switch darray to kvmalloc()

We sometimes use darrays for quite large buffers - the btree write
buffer in particular needs large buffers, since it must be sized to hold
all the write buffer keys outstanding in the journal.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 73ab9e03
......@@ -9,10 +9,12 @@ int __bch2_darray_resize(darray_void *d, size_t element_size, size_t new_size, g
if (new_size > d->size) {
new_size = roundup_pow_of_two(new_size);
void *data = krealloc_array(d->data, new_size, element_size, gfp);
void *data = kvmalloc_array(new_size, element_size, gfp);
if (!data)
return -ENOMEM;
memcpy(data, d->data, d->size * element_size);
kvfree(d->data);
d->data = data;
d->size = new_size;
}
......
......@@ -92,7 +92,7 @@ do { \
#define darray_exit(_d) \
do { \
kfree((_d)->data); \
kvfree((_d)->data); \
darray_init(_d); \
} while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment