-
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
Linux 5.2 compat: Define wait_on_page_writeback() if GPL-only exported #8794
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8794 +/- ##
==========================================
+ Coverage 78.72% 78.74% +0.01%
==========================================
Files 382 382
Lines 117809 117810 +1
==========================================
+ Hits 92747 92771 +24
+ Misses 25062 25039 -23
Continue to review full report at Codecov.
|
include/linux/page_compat.h
Outdated
@@ -75,4 +77,18 @@ | |||
|
|||
#endif /* ZFS_GLOBAL_ZONE_PAGE_STATE */ | |||
|
|||
/* Linux 5.2 made wait_on_page_writeback() GPL only */ | |||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) |
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.
We're going to need to add an configure check for this, see the ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY
check in config/kernel-bio_set_dev.m4
for an example.
Although, what might be simpler in this particular case is to update zfs_putpage
to directly call wait_on_page_bit()
since it's the only caller. Then we don't need any compatibility code.
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.
We're going to need to add an configure check for this, see the
ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY
check inconfig/kernel-bio_set_dev.m4
for an example.
Added.
Although, what might be simpler in this particular case is to update
zfs_putpage
to directly callwait_on_page_bit()
since it's the only caller. Then we don't need any compatibility code.
It now only has wait_on_page_writeback()
in module/zfs/zfs_vnops.c
for GPL export case.
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.
Actually, that's not quite what I was suggesting, but after re-reading my comment I see why it was confusing. We could absolutely go with your updated patch. However, since there's only this one caller I was thinking we could do away with the configure check entirely and do something much simpler, like this:
@@ -4526,8 +4526,10 @@ zfs_putpage(struct inode *ip, struct page *pp, struct wri
unlock_page(pp);
rangelock_exit(lr);
- if (wbc->sync_mode != WB_SYNC_NONE)
- wait_on_page_writeback(pp);
+ if (wbc->sync_mode != WB_SYNC_NONE) {
+ if (PageWriteback(pp))
+ wait_on_page_bit(pp, PG_writeback);
+ }
ZFS_EXIT(zfsvfs);
return (0);
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.
Oh.
I could change to do like that, but it would start to be more complex if there are >1 consumers of it.
Well, maybe not, it's just two lines of code in the end...
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.
This code actually hasn't changed in quite a while, and offhand I can't think of any pending work where we'd need to add another caller. So why don't we keep it simple for now and avoid the wrapper entirely. As you said, it's only two lines after all.
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.
Updated.
include/linux/page_compat.h
Outdated
@@ -1,6 +1,8 @@ | |||
#ifndef _ZFS_PAGE_COMPAT_H | |||
#define _ZFS_PAGE_COMPAT_H | |||
|
|||
#include <linux/version.h> |
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.
Should be dropped when refreshed to include the configure check
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.
Dropped accordingly.
wait_on_page_writeback() was made GPL only in torvalds/linux@19343b5bdd. Directly call wait_on_page_bit() without using wait_on_page_writeback() interface, given zfs_putpage() is the only caller for now. Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com>
wait_on_page_writeback() was made GPL only in torvalds/linux@19343b5bdd. Directly call wait_on_page_bit() without using wait_on_page_writeback() interface, given zfs_putpage() is the only caller for now. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: loli10K <ezomori.nozomu@gmail.com> Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com> Closes #8794
wait_on_page_writeback() was made GPL only in torvalds/linux@19343b5bdd. Directly call wait_on_page_bit() without using wait_on_page_writeback() interface, given zfs_putpage() is the only caller for now. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: loli10K <ezomori.nozomu@gmail.com> Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com> Closes openzfs#8794
wait_on_page_writeback() was made GPL only in torvalds/linux@19343b5bdd. Directly call wait_on_page_bit() without using wait_on_page_writeback() interface, given zfs_putpage() is the only caller for now. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: loli10K <ezomori.nozomu@gmail.com> Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@osnexus.com> Closes openzfs#8794
Motivation and Context
Fixes #8775.
Description
wait_on_page_writeback()
was made GPL only in torvalds/linux@19343b5bdd.Define one if it's GPL only.
How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by
.