f2fs: enable inline dir handling
Add inline dir functions into normal dir ops' function to handle inline ops.
Besides, we enable inline dir mode when a new dir inode is created if
inline_data option is on.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 6e67f2b..c8290da 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -54,6 +54,10 @@
nid_free = true;
goto out;
}
+
+ if (test_opt(sbi, INLINE_DENTRY) && S_ISDIR(inode->i_mode))
+ set_inode_flag(F2FS_I(inode), FI_INLINE_DENTRY);
+
trace_f2fs_new_inode(inode, 0);
mark_inode_dirty(inode);
return inode;
@@ -187,7 +191,8 @@
de = f2fs_find_entry(dir, &dentry->d_name, &page);
if (de) {
nid_t ino = le32_to_cpu(de->ino);
- kunmap(page);
+ if (!f2fs_has_inline_dentry(dir))
+ kunmap(page);
f2fs_put_page(page, 0);
inode = f2fs_iget(dir->i_sb, ino);
@@ -219,7 +224,8 @@
err = acquire_orphan_inode(sbi);
if (err) {
f2fs_unlock_op(sbi);
- kunmap(page);
+ if (!f2fs_has_inline_dentry(dir))
+ kunmap(page);
f2fs_put_page(page, 0);
goto fail;
}
@@ -443,7 +449,8 @@
old_dir_page, new_dir);
update_inode_page(old_inode);
} else {
- kunmap(old_dir_page);
+ if (!f2fs_has_inline_dentry(old_inode))
+ kunmap(old_dir_page);
f2fs_put_page(old_dir_page, 0);
}
drop_nlink(old_dir);
@@ -456,15 +463,18 @@
put_out_dir:
f2fs_unlock_op(sbi);
- kunmap(new_page);
+ if (!f2fs_has_inline_dentry(new_dir))
+ kunmap(new_page);
f2fs_put_page(new_page, 0);
out_dir:
if (old_dir_entry) {
- kunmap(old_dir_page);
+ if (!f2fs_has_inline_dentry(old_inode))
+ kunmap(old_dir_page);
f2fs_put_page(old_dir_page, 0);
}
out_old:
- kunmap(old_page);
+ if (!f2fs_has_inline_dentry(old_dir))
+ kunmap(old_page);
f2fs_put_page(old_page, 0);
out:
return err;
@@ -596,19 +606,23 @@
f2fs_unlock_op(sbi);
out_new_dir:
if (new_dir_entry) {
- kunmap(new_dir_page);
+ if (!f2fs_has_inline_dentry(new_inode))
+ kunmap(new_dir_page);
f2fs_put_page(new_dir_page, 0);
}
out_old_dir:
if (old_dir_entry) {
- kunmap(old_dir_page);
+ if (!f2fs_has_inline_dentry(old_inode))
+ kunmap(old_dir_page);
f2fs_put_page(old_dir_page, 0);
}
out_new:
- kunmap(new_page);
+ if (!f2fs_has_inline_dentry(new_dir))
+ kunmap(new_page);
f2fs_put_page(new_page, 0);
out_old:
- kunmap(old_page);
+ if (!f2fs_has_inline_dentry(old_dir))
+ kunmap(old_page);
f2fs_put_page(old_page, 0);
out:
return err;