[Linux 5.18+] Fix detection of filemap_range_has_page #16034
Merged
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
While testing #16031, I noted that
HAVE_FILEMAP_RANGE_HAS_PAGE
is not being defined for Linux 6.5 or 6.6.Turns out the symbol moved in v5.18 from
fs.h
topagemap.h
, and the fallback path has been in use for all versions of Linux since then.For the history of the symbol, run from linux git repo:
I also verified this by compiling the test src at all major releases from v5.18 ... v6.8 and v6.9-rc1
In the fallback path, ZFS calls
mappedread
andupdate_pages
for every read or write (respectively) after the first mmap call to the file. This is unnecessary for unmapped ranges and has a slight performance cost.Edit: The cost maybe isn't so slight. The fallback code within
mappedread
only reads in page-sized increments which is somewhat unfortunate. See #16031 (comment)Description
In v5.18
filemap_range_has_page
moved topagemap.h
pagemap.h
has been around since 3.10 so just include bothHow Has This Been Tested?
Local ZTS passes (linux.run, common.run, and sanity.run) on 6.6.8-200.fc39.x86_64 w/ debug build
This is not without risk since the non-fallback path has been disabled for a long while
I don't have a test setup that can build against older kernels.
Types of changes
Checklist:
Signed-off-by
.