From a059e3363ed79b9db9efeb9ca69f21c69dd7dcc0 Mon Sep 17 00:00:00 2001 From: Akira <76020594+AkiraNoSushi@users.noreply.github.com> Date: Sun, 12 Mar 2023 21:40:11 +0000 Subject: [PATCH] fs: erofs: use backported vmalloc implementation We already backported new vmalloc on commit 6d772712fa1724c3920ec7ed93cdd2579a3fa07b, 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. --- fs/erofs/staging.h | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/fs/erofs/staging.h b/fs/erofs/staging.h index 47c9708d295a..dbc8250c47f0 100644 --- a/fs/erofs/staging.h +++ b/fs/erofs/staging.h @@ -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)