aboutsummaryrefslogtreecommitdiffstats
path: root/mm/fadvise.c
diff options
context:
space:
mode:
authorShawn Bohrer <sbohrer@rgmadvisors.com>2012-01-10 18:07:35 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-10 19:30:43 -0500
commitad8a1b558e6c76fb53901956d3c8f29b82a4ccfa (patch)
tree48eae18bf9392cf373adb296301ccf02301da3f1 /mm/fadvise.c
parentfc8d8620d39dbbaf412b1b9247d77d196d92adb9 (diff)
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>
Diffstat (limited to 'mm/fadvise.c')
-rw-r--r--mm/fadvise.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/fadvise.c b/mm/fadvise.c
index 8d723c9e8b75..469491e0af79 100644
--- a/mm/fadvise.c
+++ b/mm/fadvise.c
@@ -117,7 +117,8 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
117 break; 117 break;
118 case POSIX_FADV_DONTNEED: 118 case POSIX_FADV_DONTNEED:
119 if (!bdi_write_congested(mapping->backing_dev_info)) 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 /* First and last FULL page! */ 123 /* First and last FULL page! */
123 start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT; 124 start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT;