Commit ad8a1b558e6c76fb53901956d3c8f29b82a4ccfa
Committed by
Linus Torvalds
1 parent
fc8d8620d3
Exists in
master
and in
6 other branches
fadvise: only initiate writeback for specified range with FADV_DONTNEED
Previously POSIX_FADV_DONTNEED would start writeback for the entire file when the bdi was not write congested. This negatively impacts performance if the file contains dirty pages outside of the requested range. This change uses __filemap_fdatawrite_range() to only initiate writeback for the requested range. Signed-off-by: Shawn Bohrer <sbohrer@rgmadvisors.com> Acked-by: Johannes Weiner <jweiner@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff
mm/fadvise.c
... | ... | @@ -117,7 +117,8 @@ |
117 | 117 | break; |
118 | 118 | case POSIX_FADV_DONTNEED: |
119 | 119 | if (!bdi_write_congested(mapping->backing_dev_info)) |
120 | - filemap_flush(mapping); | |
120 | + __filemap_fdatawrite_range(mapping, offset, endbyte, | |
121 | + WB_SYNC_NONE); | |
121 | 122 | |
122 | 123 | /* First and last FULL page! */ |
123 | 124 | start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT; |