[2.1] linux/spl/kmem_cache: undefine kmem_cache_alloc
before defining it
#15143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
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 an 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.
I will send the PR for 2.2 too (on master).
Description
Undefining the macro
kmem_cache_alloc
before its redefinition to ensure we have "the right one".How Has This Been Tested?
I have been running a NixOS system with a bcachefs rootfs and various ZFS external disks with it for more than 2 weeks now.
I did not run specific tests beyond workstation-class usage.
See NixOS/nixpkgs#243075 the downstream PR.
Types of changes
Checklist:
Signed-off-by
.