diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-02-01 14:35:46 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-14 01:39:12 +0300 |
commit | cb6fc943b650c4f0ca2ba753531c0803c8afbb5c (patch) | |
tree | fc28749688b6c65bc1ecf5b136eda6b322543ee2 /fs/bcachefs/util.h | |
parent | 0225bdfafd818f895fa4a4512f124a1614e011e2 (diff) | |
download | linux-cb6fc943b650c4f0ca2ba753531c0803c8afbb5c.tar.xz |
bcachefs: kill kvpmalloc()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/util.h')
-rw-r--r-- | fs/bcachefs/util.h | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index b414736d59a5..7fed75c44cd5 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h @@ -53,38 +53,6 @@ static inline size_t buf_pages(void *p, size_t len) PAGE_SIZE); } -static inline void vpfree(void *p, size_t size) -{ - if (is_vmalloc_addr(p)) - vfree(p); - else - free_pages((unsigned long) p, get_order(size)); -} - -static inline void *vpmalloc(size_t size, gfp_t gfp_mask) -{ - return (void *) __get_free_pages(gfp_mask|__GFP_NOWARN, - get_order(size)) ?: - __vmalloc(size, gfp_mask); -} - -static inline void kvpfree(void *p, size_t size) -{ - if (size < PAGE_SIZE) - kfree(p); - else - vpfree(p, size); -} - -static inline void *kvpmalloc(size_t size, gfp_t gfp_mask) -{ - return size < PAGE_SIZE - ? kmalloc(size, gfp_mask) - : vpmalloc(size, gfp_mask); -} - -int mempool_init_kvpmalloc_pool(mempool_t *, int, size_t); - #define HEAP(type) \ struct { \ size_t size, used; \ @@ -97,13 +65,13 @@ struct { \ ({ \ (heap)->used = 0; \ (heap)->size = (_size); \ - (heap)->data = kvpmalloc((heap)->size * sizeof((heap)->data[0]),\ + (heap)->data = kvmalloc((heap)->size * sizeof((heap)->data[0]),\ (gfp)); \ }) #define free_heap(heap) \ do { \ - kvpfree((heap)->data, (heap)->size * sizeof((heap)->data[0])); \ + kvfree((heap)->data); \ (heap)->data = NULL; \ } while (0) |