]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fadvise: only initiate writeback for specified range with FADV_DONTNEED
authorShawn Bohrer <sbohrer@rgmadvisors.com>
Wed, 30 Nov 2011 04:11:30 +0000 (15:11 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 30 Nov 2011 04:13:49 +0000 (15:13 +1100)
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 contians 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>
mm/fadvise.c

index 8d723c9e8b75b316041ea564f5e243b79a94e2b7..469491e0af79fed994d48fd4ada817f8e50c6d6a 100644 (file)
@@ -117,7 +117,8 @@ SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice)
                break;
        case POSIX_FADV_DONTNEED:
                if (!bdi_write_congested(mapping->backing_dev_info))
-                       filemap_flush(mapping);
+                       __filemap_fdatawrite_range(mapping, offset, endbyte,
+                                                  WB_SYNC_NONE);
 
                /* First and last FULL page! */
                start_index = (offset+(PAGE_CACHE_SIZE-1)) >> PAGE_CACHE_SHIFT;