From: Brian Behlendorf Date: Tue, 16 Dec 2014 23:24:28 +0000 (-0800) Subject: LU-6038 osd-zfs: Avoid redefining KM_SLEEP X-Git-Tag: 2.7.51~80 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=5a758a40de3b6b4e0aeb082195f61d86536233d2;p=fs%2Flustre-release.git LU-6038 osd-zfs: Avoid redefining KM_SLEEP Due to some long overdue memory management cleanup in the ZoL kmem implementation the definition of KM_SLEEP has changed. This change was expected to be transparent to consumers but it causes issues for Lustre because it explicitly redefines KM_SLEEP. This was originally done to avoid overriding the Linux slab interfaces. This change implements a more portable fix. Instead of preventing the inclusion of the kmem.h header by setting the guard. The kmem_cache_* preprocessor macros are explictly undefined to make the Linux interface available. The related ZoL pull requests are as follows: https://github.com/zfsonlinux/spl/pull/414 https://github.com/zfsonlinux/zfs/pull/2918 Signed-off-by: Brian Behlendorf Change-Id: Id1d19d7b4c440808b8b3fd042f687b10c1b869f3 Reviewed-on: http://review.whamcloud.com/13096 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Isaac Huang Reviewed-by: Nathaniel Clark Reviewed-by: Oleg Drokin --- diff --git a/lustre/osd-zfs/osd_internal.h b/lustre/osd-zfs/osd_internal.h index c6166f2..988ccb5 100644 --- a/lustre/osd-zfs/osd_internal.h +++ b/lustre/osd-zfs/osd_internal.h @@ -47,23 +47,35 @@ #include #include #include - -#define _SPL_KMEM_H -/* SPL redefines this but to the same value: ~0UL vs -1, but GCC complains. - * fixed in SPL master 52479ecf58fa89190e384edcf838fecccc786af5 */ +#ifdef SHRINK_STOP #undef SHRINK_STOP -#include -#define kmem_zalloc(a, b) kzalloc(a, b) -#define kmem_free(ptr, sz) ((void)(sz), kfree(ptr)) -#ifndef KM_SLEEP -#define KM_SLEEP GFP_KERNEL #endif - #include #include #include #include +/** + * By design including kmem.h overrides the Linux slab interfaces to provide + * the Illumos kmem cache interfaces. To override this and gain access to + * the Linux interfaces these preprocessor macros must be undefined. + */ +#ifdef kmem_cache_destroy +#undef kmem_cache_destroy +#endif + +#ifdef kmem_cache_create +#undef kmem_cache_create +#endif + +#ifdef kmem_cache_alloc +#undef kmem_cache_alloc +#endif + +#ifdef kmem_cache_free +#undef kmem_cache_free +#endif + #define LUSTRE_ROOT_FID_SEQ 0 #define DMU_OSD_SVNAME "svname" #define DMU_OSD_OI_NAME_BASE "oi"