f2fs: write only the pages in range during defragment
authorFan Li <fanofcode.li@samsung.com>
Mon, 14 Dec 2015 05:34:00 +0000 (13:34 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 14 Dec 2015 18:17:54 +0000 (10:17 -0800)
@lend of filemap_write_and_wait_range is supposed to be a "offset
in bytes where the range ends (inclusive)". Subtract 1 to avoid
writing an extra page.

Signed-off-by: Fan li <fanofcode.li@samsung.com>
Reviewed-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 294e71576cec973ffed0c28ca3760e58df121504..5fac4f259965167f1344ec2ba4e2ca8f1c556630 100644 (file)
@@ -1686,7 +1686,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
 
        /* writeback all dirty pages in the range */
        err = filemap_write_and_wait_range(inode->i_mapping, range->start,
-                                               range->start + range->len);
+                                               range->start + range->len - 1);
        if (err)
                goto out;