[PATCH 8/8] f2fs: check inline flag ahead for get_dnode_of_data
From: Shawn Lin
Date: Thu Mar 10 2016 - 22:37:35 EST
Check inline data flag ahead, so we can save some
cpu cycle.
Signed-off-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
---
fs/f2fs/node.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 771166d..69467bd 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -534,6 +534,11 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
int err = 0;
level = get_node_path(dn->inode, index, offset, noffset);
+ /* if inline_data is set, should not report any block indices */
+ if (f2fs_has_inline_data(dn->inode) && index) {
+ err = -ENOENT;
+ goto release_out;
+ }
nids[0] = dn->inode->i_ino;
npage[0] = dn->inode_page;
@@ -544,13 +549,6 @@ int get_dnode_of_data(struct dnode_of_data *dn, pgoff_t index, int mode)
return PTR_ERR(npage[0]);
}
- /* if inline_data is set, should not report any block indices */
- if (f2fs_has_inline_data(dn->inode) && index) {
- err = -ENOENT;
- f2fs_put_page(npage[0], 1);
- goto release_out;
- }
-
parent = npage[0];
if (level != 0)
nids[1] = get_nid(parent, offset[0], true);
--
2.3.7