f2fs: fix to unlock node page when it was truncated
authorJaegeuk Kim <jaegeuk.kim@samsung.com>
Wed, 13 Mar 2013 08:45:15 +0000 (17:45 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 18 Mar 2013 12:00:09 +0000 (21:00 +0900)
If the node page was truncated, its block address became zero.
This means that we don't need to write the node page, but have to unlock
NODE_WRITE, decrease the number of dirty node pages, and then unlock_page
before returning the f2fs_write_node_page with zero.

Reviewed-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/node.c

index e275218904ed964126aaae36598d7f13433f77c3..3dc63f4cf2b1566c5bf0ceb9c7b989bbb547b5f1 100644 (file)
@@ -1106,15 +1106,15 @@ static int f2fs_write_node_page(struct page *page,
 
        /* This page is already truncated */
        if (ni.blk_addr == NULL_ADDR)
-               return 0;
+               goto out;
 
        set_page_writeback(page);
 
        /* insert node offset */
        write_node_page(sbi, page, nid, ni.blk_addr, &new_addr);
        set_node_addr(sbi, &ni, new_addr);
+out:
        dec_page_count(sbi, F2FS_DIRTY_NODES);
-
        mutex_unlock_op(sbi, NODE_WRITE);
        unlock_page(page);
        return 0;