diff options
author | Chao Yu <yuchao0@huawei.com> | 2016-07-03 22:05:13 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-07-08 10:33:26 -0700 |
commit | 72e1c797b57da42ce8f75c5636720f40c4f607a2 (patch) | |
tree | a40b43480bef62e66cfc7126235fb200b419384a /fs/f2fs | |
parent | 1563ac75e7e45adcdc1271e6bb55fe27a23d4e4e (diff) | |
download | linux-72e1c797b57da42ce8f75c5636720f40c4f607a2.tar.gz linux-72e1c797b57da42ce8f75c5636720f40c4f607a2.tar.bz2 linux-72e1c797b57da42ce8f75c5636720f40c4f607a2.zip |
f2fs: fix to redirty page if fail to gc data page
If we fail to move data page during foreground GC, we should give another
chance to writeback that page which was set dirty previously by writer.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/gc.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index c9602d0dc57a..c61213785914 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -653,12 +653,23 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type) .page = page, .encrypted_page = NULL, }; + bool is_dirty = PageDirty(page); + int err; + +retry: set_page_dirty(page); f2fs_wait_on_page_writeback(page, DATA, true); if (clear_page_dirty_for_io(page)) inode_dec_dirty_pages(inode); + set_cold_data(page); - do_write_data_page(&fio); + + err = do_write_data_page(&fio); + if (err == -ENOMEM && is_dirty) { + congestion_wait(BLK_RW_ASYNC, HZ/50); + goto retry; + } + clear_cold_data(page); } out: |