f2fs: write node pages if checkpoint is not doing
authorJaegeuk Kim <jaegeuk@kernel.org>
Fri, 7 Nov 2014 01:21:24 +0000 (17:21 -0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Mon, 10 Nov 2014 14:51:28 +0000 (06:51 -0800)
It needs to write node pages if checkpoint is not doing in order to avoid
memory pressure.

Reviewed-by: Changman Lee <cm224.lee@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/node.c

index 4ea2c4728156a3986e04c040134884bce50b2e77..6f514fb5fd9610dd95abd7d9647985c0bac39901 100644 (file)
@@ -1314,10 +1314,12 @@ static int f2fs_write_node_page(struct page *page,
                return 0;
        }
 
-       if (wbc->for_reclaim)
-               goto redirty_out;
-
-       down_read(&sbi->node_write);
+       if (wbc->for_reclaim) {
+               if (!down_read_trylock(&sbi->node_write))
+                       goto redirty_out;
+       } else {
+               down_read(&sbi->node_write);
+       }
        set_page_writeback(page);
        write_node_page(sbi, page, &fio, nid, ni.blk_addr, &new_addr);
        set_node_addr(sbi, &ni, new_addr, is_fsync_dnode(page));