1 // SPDX-License-Identifier: GPL-2.0
3 * (C) 2022-2024 Kent Overstreet <kent.overstreet@linux.dev>
6 #include <linux/darray.h>
7 #include <linux/log2.h>
8 #include <linux/slab.h>
10 int __darray_resize_slowpath(darray_char *d, size_t element_size, size_t new_size, gfp_t gfp)
12 if (new_size > d->size) {
13 new_size = roundup_pow_of_two(new_size);
15 void *data = kvmalloc_array(new_size, element_size, gfp);
19 memcpy(data, d->data, d->size * element_size);
20 if (d->data != d->preallocated)