f2fs: check the level before calling get_nid function
authorChangman Lee <cm224.lee@samsung.com>
Tue, 19 Feb 2013 22:47:06 +0000 (07:47 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Mon, 18 Mar 2013 12:00:34 +0000 (21:00 +0900)
The caller of get_nid should be careful not to put lower value than
NODE_DIR1_BLOCK in case of level is zero.

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

index 65ec2ea..d408e69 100644 (file)
@@ -403,7 +403,8 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
                return PTR_ERR(npage[0]);
 
        parent = npage[0];
-       nids[1] = get_nid(parent, offset[0], true);
+       if (level != 0)
+               nids[1] = get_nid(parent, offset[0], true);
        dn->inode_page = npage[0];
        dn->inode_page_locked = true;