aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/checkpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/f2fs/checkpoint.c')
-rw-r--r--fs/f2fs/checkpoint.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 38f4a2245085..6b2106685b7a 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -82,13 +82,12 @@ static int f2fs_write_meta_page(struct page *page,
82 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 82 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
83 83
84 /* Should not write any meta pages, if any IO error was occurred */ 84 /* Should not write any meta pages, if any IO error was occurred */
85 if (wbc->for_reclaim || sbi->por_doing || 85 if (unlikely(sbi->por_doing ||
86 is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG)) { 86 is_set_ckpt_flags(F2FS_CKPT(sbi), CP_ERROR_FLAG)))
87 dec_page_count(sbi, F2FS_DIRTY_META); 87 goto redirty_out;
88 wbc->pages_skipped++; 88
89 set_page_dirty(page); 89 if (wbc->for_reclaim)
90 return AOP_WRITEPAGE_ACTIVATE; 90 goto redirty_out;
91 }
92 91
93 wait_on_page_writeback(page); 92 wait_on_page_writeback(page);
94 93
@@ -96,6 +95,12 @@ static int f2fs_write_meta_page(struct page *page,
96 dec_page_count(sbi, F2FS_DIRTY_META); 95 dec_page_count(sbi, F2FS_DIRTY_META);
97 unlock_page(page); 96 unlock_page(page);
98 return 0; 97 return 0;
98
99redirty_out:
100 dec_page_count(sbi, F2FS_DIRTY_META);
101 wbc->pages_skipped++;
102 set_page_dirty(page);
103 return AOP_WRITEPAGE_ACTIVATE;
99} 104}
100 105
101static int f2fs_write_meta_pages(struct address_space *mapping, 106static int f2fs_write_meta_pages(struct address_space *mapping,
@@ -137,7 +142,7 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
137 nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, 142 nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
138 PAGECACHE_TAG_DIRTY, 143 PAGECACHE_TAG_DIRTY,
139 min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1); 144 min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
140 if (nr_pages == 0) 145 if (unlikely(nr_pages == 0))
141 break; 146 break;
142 147
143 for (i = 0; i < nr_pages; i++) { 148 for (i = 0; i < nr_pages; i++) {
@@ -150,7 +155,8 @@ long sync_meta_pages(struct f2fs_sb_info *sbi, enum page_type type,
150 unlock_page(page); 155 unlock_page(page);
151 break; 156 break;
152 } 157 }
153 if (nwritten++ >= nr_to_write) 158 nwritten++;
159 if (unlikely(nwritten >= nr_to_write))
154 break; 160 break;
155 } 161 }
156 pagevec_release(&pvec); 162 pagevec_release(&pvec);
@@ -200,7 +206,7 @@ int acquire_orphan_inode(struct f2fs_sb_info *sbi)
200 max_orphans = (sbi->blocks_per_seg - 2 - NR_CURSEG_TYPE) 206 max_orphans = (sbi->blocks_per_seg - 2 - NR_CURSEG_TYPE)
201 * F2FS_ORPHANS_PER_BLOCK; 207 * F2FS_ORPHANS_PER_BLOCK;
202 mutex_lock(&sbi->orphan_inode_mutex); 208 mutex_lock(&sbi->orphan_inode_mutex);
203 if (sbi->n_orphans >= max_orphans) 209 if (unlikely(sbi->n_orphans >= max_orphans))
204 err = -ENOSPC; 210 err = -ENOSPC;
205 else 211 else
206 sbi->n_orphans++; 212 sbi->n_orphans++;