summaryrefslogtreecommitdiff
path: root/fs/f2fs/node.c
diff options
context:
space:
mode:
authorWeichao Guo <guoweichao@huawei.com>2018-03-09 23:10:21 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-07-27 18:03:59 +0900
commit54c55c4e4fc7ec35f96a3b6a626314b0b7256137 (patch)
treef32b8aa53f4fc9fc633cbc6ffcee1b54e03c8ec8 /fs/f2fs/node.c
parent4e423832a675af671eab9d8a3d96636aa63faa9e (diff)
downloadlwn-54c55c4e4fc7ec35f96a3b6a626314b0b7256137.tar.gz
lwn-54c55c4e4fc7ec35f96a3b6a626314b0b7256137.zip
f2fs: support in-memory inode checksum when checking consistency
Enable in-memory inode checksum to protect metadata blocks from in-memory scribbles when checking consistency, which has no performance requirements. Signed-off-by: Weichao Guo <guoweichao@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r--fs/f2fs/node.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 1061dd18b09c..3d1240949d87 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1141,8 +1141,12 @@ static int read_node_page(struct page *page, int op_flags)
.encrypted_page = NULL,
};
- if (PageUptodate(page))
+ if (PageUptodate(page)) {
+#ifdef CONFIG_F2FS_CHECK_FS
+ f2fs_bug_on(sbi, !f2fs_inode_chksum_verify(sbi, page));
+#endif
return LOCKED_PAGE;
+ }
f2fs_get_node_info(sbi, page->index, &ni);
@@ -1775,6 +1779,10 @@ static int f2fs_set_node_page_dirty(struct page *page)
if (!PageUptodate(page))
SetPageUptodate(page);
+#ifdef CONFIG_F2FS_CHECK_FS
+ if (IS_INODE(page))
+ f2fs_inode_chksum_set(F2FS_P_SB(page), page);
+#endif
if (!PageDirty(page)) {
__set_page_dirty_nobuffers(page);
inc_page_count(F2FS_P_SB(page), F2FS_DIRTY_NODES);