Skip to content

Commit 32f26ea

Browse files
authored
Move GFP flags kernel compatibility code
Move the GFP flags kernel compat code from c file to kmem header. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Michael Niewöhner <[email protected]> Closes #10424
1 parent 080102a commit 32f26ea

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

include/os/linux/spl/sys/kmem.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ __spl_pf_fstrans_check(void)
144144
return (current->flags & __SPL_PF_FSTRANS);
145145
}
146146

147+
/*
148+
* Kernel compatibility for GFP flags
149+
*/
150+
/* < 4.13 */
151+
#ifndef __GFP_RETRY_MAYFAIL
152+
#define __GFP_RETRY_MAYFAIL __GFP_REPEAT
153+
#endif
154+
/* < 4.4 */
155+
#ifndef __GFP_RECLAIM
156+
#define __GFP_RECLAIM __GFP_WAIT
157+
#endif
158+
147159
#ifdef HAVE_ATOMIC64_T
148160
#define kmem_alloc_used_add(size) atomic64_add(size, &kmem_alloc_used)
149161
#define kmem_alloc_used_sub(size) atomic64_sub(size, &kmem_alloc_used)

module/os/linux/spl/spl-kmem.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,6 @@ kmem_strfree(char *str)
132132
}
133133
EXPORT_SYMBOL(kmem_strfree);
134134

135-
/* Kernel compatibility for <4.13 */
136-
#ifndef __GFP_RETRY_MAYFAIL
137-
#define __GFP_RETRY_MAYFAIL __GFP_REPEAT
138-
#endif
139-
/* Kernel compatibility for <4.4 */
140-
#ifndef __GFP_RECLAIM
141-
#define __GFP_RECLAIM __GFP_WAIT
142-
#endif
143-
144135
void *
145136
spl_kvmalloc(size_t size, gfp_t lflags)
146137
{

0 commit comments

Comments
 (0)