OSDN Git Service

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, 16 Nov 2017 05:50:19 +0000 (21:50 -0800)
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 b41a4a2..505fb4e 100644 (file)
@@ -842,7 +842,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;