diff options
Diffstat (limited to 'fs/f2fs/node.c')
-rw-r--r-- | fs/f2fs/node.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 8e331d5b9fcd..b527ed4c0225 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c | |||
@@ -1148,6 +1148,46 @@ continue_unlock: | |||
1148 | return nwritten; | 1148 | return nwritten; |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | int wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, nid_t ino) | ||
1152 | { | ||
1153 | struct address_space *mapping = sbi->node_inode->i_mapping; | ||
1154 | pgoff_t index = 0, end = LONG_MAX; | ||
1155 | struct pagevec pvec; | ||
1156 | int nr_pages; | ||
1157 | int ret2 = 0, ret = 0; | ||
1158 | |||
1159 | pagevec_init(&pvec, 0); | ||
1160 | while ((index <= end) && | ||
1161 | (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, | ||
1162 | PAGECACHE_TAG_WRITEBACK, | ||
1163 | min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1)) != 0) { | ||
1164 | unsigned i; | ||
1165 | |||
1166 | for (i = 0; i < nr_pages; i++) { | ||
1167 | struct page *page = pvec.pages[i]; | ||
1168 | |||
1169 | /* until radix tree lookup accepts end_index */ | ||
1170 | if (page->index > end) | ||
1171 | continue; | ||
1172 | |||
1173 | if (ino && ino_of_node(page) == ino) | ||
1174 | wait_on_page_writeback(page); | ||
1175 | if (TestClearPageError(page)) | ||
1176 | ret = -EIO; | ||
1177 | } | ||
1178 | pagevec_release(&pvec); | ||
1179 | cond_resched(); | ||
1180 | } | ||
1181 | |||
1182 | if (test_and_clear_bit(AS_ENOSPC, &mapping->flags)) | ||
1183 | ret2 = -ENOSPC; | ||
1184 | if (test_and_clear_bit(AS_EIO, &mapping->flags)) | ||
1185 | ret2 = -EIO; | ||
1186 | if (!ret) | ||
1187 | ret = ret2; | ||
1188 | return ret; | ||
1189 | } | ||
1190 | |||
1151 | static int f2fs_write_node_page(struct page *page, | 1191 | static int f2fs_write_node_page(struct page *page, |
1152 | struct writeback_control *wbc) | 1192 | struct writeback_control *wbc) |
1153 | { | 1193 | { |