linux/spl/kmem_cache: undefine `kmem_cache_alloc` before defining it
When compiling a kernel with bcachefs and zfs, the two macros will collide, making it impossible to have both filesystems. It is sufficient to just undefine the macro before calling it. On why this should be in ZFS rather than bcachefs, currently, bcachefs is not a in-tree filesystem, but, it has a reasonably high chance of getting included soon. This avoids the breakage in ZFS early, this patch may be distributed downstream in NixOS and is already used there. Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Lahfa <ryan@lahfa.xyz> Closes #15144
This commit is contained in:
parent
6c94e64963
commit
fdb8fff916
|
@ -198,6 +198,14 @@ extern uint64_t spl_kmem_cache_entry_size(kmem_cache_t *cache);
|
||||||
spl_kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl)
|
spl_kmem_cache_create(name, size, align, ctor, dtor, rclm, priv, vmp, fl)
|
||||||
#define kmem_cache_set_move(skc, move) spl_kmem_cache_set_move(skc, move)
|
#define kmem_cache_set_move(skc, move) spl_kmem_cache_set_move(skc, move)
|
||||||
#define kmem_cache_destroy(skc) spl_kmem_cache_destroy(skc)
|
#define kmem_cache_destroy(skc) spl_kmem_cache_destroy(skc)
|
||||||
|
/*
|
||||||
|
* This is necessary to be compatible with other kernel modules
|
||||||
|
* or in-tree filesystem that may define kmem_cache_alloc,
|
||||||
|
* like bcachefs does it now.
|
||||||
|
*/
|
||||||
|
#ifdef kmem_cache_alloc
|
||||||
|
#undef kmem_cache_alloc
|
||||||
|
#endif
|
||||||
#define kmem_cache_alloc(skc, flags) spl_kmem_cache_alloc(skc, flags)
|
#define kmem_cache_alloc(skc, flags) spl_kmem_cache_alloc(skc, flags)
|
||||||
#define kmem_cache_free(skc, obj) spl_kmem_cache_free(skc, obj)
|
#define kmem_cache_free(skc, obj) spl_kmem_cache_free(skc, obj)
|
||||||
#define kmem_cache_reap_now(skc) spl_kmem_cache_reap_now(skc)
|
#define kmem_cache_reap_now(skc) spl_kmem_cache_reap_now(skc)
|
||||||
|
|
Loading…
Reference in New Issue