Skip to contentSkip to conversation

f2fs: check the level before calling get_nid function

PATCH In review Changman Lee 2 participants 2 messages Feb 19, 2013 – Feb 25, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs: check the level before calling get_nid function

The caller of get_nid should be careful not to put lower value than NODE_DIR1_BLOCK in case of level is zero.

---
 fs/f2fs/node.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/node.c +2 -1
index e275218..764c1d8 100644
@@ -403,7 +403,8 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int ro)
 		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;
 
Signature · 1 line
1.7.10.4