From 32f26eaa70fe9e8aea79311123879f885f674d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Niew=C3=B6hner?= Date: Tue, 9 Jun 2020 01:33:46 +0200 Subject: [PATCH] Move GFP flags kernel compatibility code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the GFP flags kernel compat code from c file to kmem header. Reviewed-by: Brian Behlendorf Signed-off-by: Michael Niewöhner Closes #10424 --- include/os/linux/spl/sys/kmem.h | 12 ++++++++++++ module/os/linux/spl/spl-kmem.c | 9 --------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/os/linux/spl/sys/kmem.h b/include/os/linux/spl/sys/kmem.h index 176858dc2..c09c40fa3 100644 --- a/include/os/linux/spl/sys/kmem.h +++ b/include/os/linux/spl/sys/kmem.h @@ -144,6 +144,18 @@ __spl_pf_fstrans_check(void) return (current->flags & __SPL_PF_FSTRANS); } +/* + * Kernel compatibility for GFP flags + */ +/* < 4.13 */ +#ifndef __GFP_RETRY_MAYFAIL +#define __GFP_RETRY_MAYFAIL __GFP_REPEAT +#endif +/* < 4.4 */ +#ifndef __GFP_RECLAIM +#define __GFP_RECLAIM __GFP_WAIT +#endif + #ifdef HAVE_ATOMIC64_T #define kmem_alloc_used_add(size) atomic64_add(size, &kmem_alloc_used) #define kmem_alloc_used_sub(size) atomic64_sub(size, &kmem_alloc_used) diff --git a/module/os/linux/spl/spl-kmem.c b/module/os/linux/spl/spl-kmem.c index 0bb82ac7a..f19421cfc 100644 --- a/module/os/linux/spl/spl-kmem.c +++ b/module/os/linux/spl/spl-kmem.c @@ -132,15 +132,6 @@ kmem_strfree(char *str) } EXPORT_SYMBOL(kmem_strfree); -/* Kernel compatibility for <4.13 */ -#ifndef __GFP_RETRY_MAYFAIL -#define __GFP_RETRY_MAYFAIL __GFP_REPEAT -#endif -/* Kernel compatibility for <4.4 */ -#ifndef __GFP_RECLAIM -#define __GFP_RECLAIM __GFP_WAIT -#endif - void * spl_kvmalloc(size_t size, gfp_t lflags) {