Skip to content

Commit

Permalink
fs: erofs: use backported vmalloc implementation
Browse files Browse the repository at this point in the history
We already backported new vmalloc on commit 6d77271, so this isn't needed.

Fixes the following errors:
In file included from ../fs/erofs/data.c:13:
In file included from ../fs/erofs/internal.h:27:
../fs/erofs/staging.h:90:21: error: redefinition of 'kvmalloc'
static inline void *kvmalloc(size_t size, gfp_t flags)
                    ^
../include/linux/mm.h:572:21: note: previous definition is here
static inline void *kvmalloc(size_t size, gfp_t flags)
                    ^
In file included from ../fs/erofs/data.c:13:
In file included from ../fs/erofs/internal.h:27:
../fs/erofs/staging.h:109:21: error: redefinition of 'kvzalloc'
static inline void *kvzalloc(size_t size, gfp_t flags)
                    ^
../include/linux/mm.h:580:21: note: previous definition is here
static inline void *kvzalloc(size_t size, gfp_t flags)
                    ^
2 errors generated.
AkiraNoSushi committed Mar 12, 2023
1 parent 947866a commit a059e33
Showing 1 changed file with 0 additions and 24 deletions.
24 changes: 0 additions & 24 deletions fs/erofs/staging.h
Original file line number Diff line number Diff line change
@@ -87,30 +87,6 @@ static inline bool sb_rdonly(const struct super_block *sb) {

#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0))

static inline void *kvmalloc(size_t size, gfp_t flags)
{
void *buffer = NULL;

if (size == 0)
return NULL;

/* do not attempt kmalloc if we need more than 16 pages at once */
if (size <= (16 * PAGE_SIZE))
buffer = kmalloc(size, flags);
if (!buffer) {
if (flags & __GFP_ZERO)
buffer = vzalloc(size);
else
buffer = vmalloc(size);
}
return buffer;
}

static inline void *kvzalloc(size_t size, gfp_t flags)
{
return kvmalloc(size, flags | __GFP_ZERO);
}

static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags)
{
if (size != 0 && n > SIZE_MAX / size)

0 comments on commit a059e33

Please sign in to comment.