diff options
| author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-12-20 05:20:01 -0500 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-01-09 23:38:41 -0500 |
| commit | 45414083913f68cb7586924767a3fb2cc7710352 (patch) | |
| tree | 14dd72e9c987132e8a250eac8e79ba124d659d47 /fs/bcachefs/util.h | |
| parent | bcachefs: Fix assert for online fsck (diff) | |
| download | linux-45414083913f68cb7586924767a3fb2cc7710352.tar.gz linux-45414083913f68cb7586924767a3fb2cc7710352.zip | |
bcachefs: bch2_kvmalloc()
Add a version of kvmalloc() that doesn't have the INT_MAX limit; large
filesystems do hit this.
We'll want to get rid of the in-memory bucket gens array, but we're not
there quite yet.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/util.h')
| -rw-r--r-- | fs/bcachefs/util.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index c292b9ce8240..1a1720116071 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h @@ -55,6 +55,16 @@ static inline size_t buf_pages(void *p, size_t len) PAGE_SIZE); } +static inline void *bch2_kvmalloc(size_t n, gfp_t flags) +{ + void *p = unlikely(n >= INT_MAX) + ? vmalloc(n) + : kvmalloc(n, flags & ~__GFP_ZERO); + if (p && (flags & __GFP_ZERO)) + memset(p, 0, n); + return p; +} + #define init_heap(heap, _size, gfp) \ ({ \ (heap)->nr = 0; \ |
