f2fs: skip searching non-exist range in truncate_hole
authorWeichao Guo <guoweichao@huawei.com>
Sat, 14 Oct 2017 00:13:32 +0000 (08:13 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 26 Oct 2017 08:44:16 +0000 (10:44 +0200)
Let's skip entire non-exist area to speed up truncate_hole by
using get_next_page_offset.

Signed-off-by: Weichao Guo <guoweichao@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 8fe95f8..56232a7 100644 (file)
@@ -857,7 +857,7 @@ int truncate_hole(struct inode *inode, pgoff_t pg_start, pgoff_t pg_end)
                err = get_dnode_of_data(&dn, pg_start, LOOKUP_NODE);
                if (err) {
                        if (err == -ENOENT) {
-                               pg_start++;
+                               pg_start = get_next_page_offset(&dn, pg_start);
                                continue;
                        }
                        return err;