-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Page cache: avoid invoking fs_read closure when not necessary
When pagecache pages are created as a result of a node length being increased when writing to a file beyond its current length, there is no need to invoke the fs_read closure when doing a RMW of partially written pages, because the initial page content is always zero. This change amends the pagecache_write_sg() function so that the node length is updated only after creating the needed pages, while touch_or_fill_page_nodelocked() only invokes the fs_read closure for block ranges corresponding to the current node length (and zeroes out the rest of the page buffers). As a result of this change, it is possible for a page state to go directly from ALLOC to NEW, thus the assert() that checks for the intermediate READING state is being removed. In addition, when reading from a file whose length is not aligned to a page boundary, only the block range corresponding to the file length is submitted for input, while the rest is zeroed out in the pagecache code. With this change, a filesystem implementation is no longer required to handle read requests for block ranges beyond a file length.
- Loading branch information
1 parent
c5ff09a
commit 132a832
Showing
1 changed file
with
39 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters