summaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-02-25 19:54:48 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2015-04-10 15:08:27 -0700
commitb7f204cca4b7155f47e64555614b1f534a53737e (patch)
tree060c9f91afe8d29702ae2c485916ab497a8623b6 /fs/f2fs
parent2bca1e2388a8a9e8a3db0daf54fcc124516a3e83 (diff)
downloadop-kernel-dev-b7f204cca4b7155f47e64555614b1f534a53737e.zip
op-kernel-dev-b7f204cca4b7155f47e64555614b1f534a53737e.tar.gz
f2fs: check its block allocation to avoid producing wrong dirty pages
If a page is cached but its block was deallocated, we don't need to make the page dirty again by gc and truncate_partial_data_page. In that case, it needs to check its block allocation all the time instead of giving up-to-date page. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/data.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 62e31b2..389fda7 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -813,11 +813,19 @@ struct page *find_data_page(struct inode *inode, pgoff_t index, bool sync)
.rw = sync ? READ_SYNC : READA,
};
+ /*
+ * If sync is false, it needs to check its block allocation.
+ * This is need and triggered by two flows:
+ * gc and truncate_partial_data_page.
+ */
+ if (!sync)
+ goto search;
+
page = find_get_page(mapping, index);
if (page && PageUptodate(page))
return page;
f2fs_put_page(page, 0);
-
+search:
if (f2fs_lookup_extent_cache(inode, index, &ei)) {
dn.data_blkaddr = ei.blk + index - ei.fofs;
goto got_it;
OpenPOWER on IntegriCloud