aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2013-10-16 02:09:26 -0400
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-10-17 20:44:14 -0400
commit87a9bd265678ec3cc8431b14bcb14c68d0f94032 (patch)
tree8e9b83647295f111ca19be91d154f673fea10331 /fs
parente234088758fca3a669ebb1a02d8bf7bf60f0e4ff (diff)
f2fs: avoid to write during the recovery
This patch enhances the recovery routine not to write any data/node/meta until its completion. If any writes are sent to the disk, it could contaminate the written history that will be used for further recovery. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/checkpoint.c2
-rw-r--r--fs/f2fs/node.c17
2 files changed, 12 insertions, 7 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 2a5999d865b2..8d16071a3b23 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -81,7 +81,7 @@ static int f2fs_write_meta_page(struct page *page,
81 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 81 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
82 82
83 /* Should not write any meta pages, if any IO error was occurred */ 83 /* Should not write any meta pages, if any IO error was occurred */
84 if (wbc->for_reclaim || 84 if (wbc->for_reclaim || sbi->por_doing ||
85 is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG)) { 85 is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG)) {
86 dec_page_count(sbi, F2FS_DIRTY_META); 86 dec_page_count(sbi, F2FS_DIRTY_META);
87 wbc->pages_skipped++; 87 wbc->pages_skipped++;
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 51ef27894433..ef80f791b02b 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1156,6 +1156,9 @@ static int f2fs_write_node_page(struct page *page,
1156 block_t new_addr; 1156 block_t new_addr;
1157 struct node_info ni; 1157 struct node_info ni;
1158 1158
1159 if (sbi->por_doing)
1160 goto redirty_out;
1161
1159 wait_on_page_writeback(page); 1162 wait_on_page_writeback(page);
1160 1163
1161 /* get old block addr of this node page */ 1164 /* get old block addr of this node page */
@@ -1171,12 +1174,8 @@ static int f2fs_write_node_page(struct page *page,
1171 return 0; 1174 return 0;
1172 } 1175 }
1173 1176
1174 if (wbc->for_reclaim) { 1177 if (wbc->for_reclaim)
1175 dec_page_count(sbi, F2FS_DIRTY_NODES); 1178 goto redirty_out;
1176 wbc->pages_skipped++;
1177 set_page_dirty(page);
1178 return AOP_WRITEPAGE_ACTIVATE;
1179 }
1180 1179
1181 mutex_lock(&sbi->node_write); 1180 mutex_lock(&sbi->node_write);
1182 set_page_writeback(page); 1181 set_page_writeback(page);
@@ -1186,6 +1185,12 @@ static int f2fs_write_node_page(struct page *page,
1186 mutex_unlock(&sbi->node_write); 1185 mutex_unlock(&sbi->node_write);
1187 unlock_page(page); 1186 unlock_page(page);
1188 return 0; 1187 return 0;
1188
1189redirty_out:
1190 dec_page_count(sbi, F2FS_DIRTY_NODES);
1191 wbc->pages_skipped++;
1192 set_page_dirty(page);
1193 return AOP_WRITEPAGE_ACTIVATE;
1189} 1194}
1190 1195
1191/* 1196/*