]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
f2fs: fix to redirty page if fail to gc data page
authorChao Yu <yuchao0@huawei.com>
Sun, 3 Jul 2016 14:05:13 +0000 (22:05 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 8 Jul 2016 17:33:26 +0000 (10:33 -0700)
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>
fs/f2fs/gc.c

index c9602d0dc57ab05bf32f27305407eb68eb44e04a..c6121378591489c29685fb76c9ef382cdb01a109 100644 (file)
@@ -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: