mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-03-10 00:00:04 +03:00
commit
bae7a9ae8d
@ -20,12 +20,14 @@ static inline void *kmalloc(size_t size, gfp_t flags)
|
|||||||
|
|
||||||
run_shrinkers();
|
run_shrinkers();
|
||||||
|
|
||||||
size_t alignment = min(rounddown_pow_of_two(size),
|
if (size) {
|
||||||
(size_t)PAGE_SIZE);
|
size_t alignment = min(rounddown_pow_of_two(size), (size_t)PAGE_SIZE);
|
||||||
size = roundup(size, alignment);
|
alignment = max(sizeof(void *), alignment);
|
||||||
p = size
|
if (posix_memalign(&p, alignment, size))
|
||||||
? aligned_alloc(alignment, size)
|
p = NULL;
|
||||||
: malloc(0);
|
} else {
|
||||||
|
p = malloc(0);
|
||||||
|
}
|
||||||
if (p && (flags & __GFP_ZERO))
|
if (p && (flags & __GFP_ZERO))
|
||||||
memset(p, 0, size);
|
memset(p, 0, size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user