f2fs: don't drop dentry pages after fs shutdown
PATCH 1/2 f2fs: don't drop dentry pages after fs shutdown
As description in commit "f2fs: don't drop any page on f2fs_cp_error() case":
"We still provide readdir() after shtudown, so we should keep pages to avoid additional IOs."
In order to provider lastest directory structure, let's keep dentry pages in cache after fs shutdown.
Signed-off-by Chao Yu <[email protected]>
--- fs/f2fs/data.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/f2fs/data.c +6 -0
@@ -1801,6 +1801,12 @@ static int __write_data_page(struct page *page, bool *submitted,/* we should bypass data pages to proceed the kworkder jobs */ if (unlikely (f2fs_cp_error (sbi))) {mapping_set_error (page->mapping, -EIO ); +/* +* don't drop any dirty dentry pages for keeping lastest +* directory structure. +*/ +if (S_ISDIR (inode->i_mode)) + goto redirty_out; goto out; }
Signature · 1 line
2.17.0.391.g1f1cddd558b5
PATCH 2/2 f2fs: fix error path of move_data_page
This patch fixes error path of move_data_page:
- clear cold data flag if it fails to write page.
- redirty page for non-ENOMEM case.
Signed-off-by Chao Yu <[email protected]>
--- fs/f2fs/gc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/f2fs/gc.c +8 -3
@@ -780,9 +780,14 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type,set_cold_data (page); err =do_write_data_page (&fio); -if (err == -ENOMEM && is_dirty) { -congestion_wait (BLK_RW_ASYNC ,HZ /50 ); - goto retry; +if (err) { +clear_cold_data (page); +if (err == -ENOMEM ) { +congestion_wait (BLK_RW_ASYNC ,HZ /50 ); + goto retry; + } +if (is_dirty) +set_page_dirty (page); } } out:
Signature · 1 line
2.17.0.391.g1f1cddd558b5