-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] linux 4.11 compat: avoid refcount_t name conflict #5842
Conversation
a186ade
to
f1b730a
Compare
Linux 4.11 introduces a new type, refcount_t, which conflicts with the type of the same name defined within ZFS. Rename the ZFS type zfs_refcount_t. Within the ZFS code, use a macro to cause references to refcount_t to be changed to zfs_refcount_t at compile time. This reduces conflicts when later landing OpenZFS patches. Fixes openzfs#5823 Signed-off-by: Olaf Faaland <[email protected]>
f1b730a
to
8a4fe52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I agree a minimal fix is best here to avoid potential future conflicts.
To be honest, I don't like this kind of macro game very much. If you're not careful about the include order, it's very easy to accidentally modify the kernel header and cause some strange thing. We did this kind of thing with kmem_cache thing, but kmem_cache object and function are rarely used inside kernel header files so it's arguably not a big deal. However, you can't say the same thing for refcount_t, it's definitely going to be used in a lot of header files. |
The long term plan discussed at the OpenZFS dev summit would be to add a prefix, maybe |
Linux 4.11 introduces a new type, refcount_t, which conflicts with the type of the same name defined within ZFS. Rename the ZFS type zfs_refcount_t. Within the ZFS code, use a macro to cause references to refcount_t to be changed to zfs_refcount_t at compile time. This reduces conflicts when later landing OpenZFS patches. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Olaf Faaland <[email protected]> Closes openzfs#5823 Closes openzfs#5842
Linux 4.11 introduces a new type, refcount_t, which conflicts with the type of the same name defined within ZFS. Rename the ZFS type zfs_refcount_t. Within the ZFS code, use a macro to cause references to refcount_t to be changed to zfs_refcount_t at compile time. This reduces conflicts when later landing OpenZFS patches. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Olaf Faaland <[email protected]> Closes openzfs#5823 Closes openzfs#5842
Linux 4.11 introduces a new type, refcount_t, which conflicts with the type of the same name defined within ZFS. Rename the ZFS type zfs_refcount_t. Within the ZFS code, use a macro to cause references to refcount_t to be changed to zfs_refcount_t at compile time. This reduces conflicts when later landing OpenZFS patches. Reviewed-by: George Melikov <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Olaf Faaland <[email protected]> Closes #5823 Closes #5842
Description
Rename the ZFS type refcount_t to zfs_refcount_t.
Rather than touching all the ZFS code that uses refcount_t, use a preprocessor
macro to rename the type at compile time to zfs_refcount_t. The ZFS code
never refers to the linux type with the conflicting name so this does not break
anything.
Similarly rename refcount_add() which also conflicts.
Motivation and Context
Linux 4.11 introduces a new type, refcount_t, which conflicts with the
type of the same name defined within ZFS. The build fails when building
against that kernel or later.
Issue #5823
How Has This Been Tested?
Built and ran ztest on my desktop.
Types of changes
Checklist: