diff options
author | Chao Yu <chao2.yu@samsung.com> | 2014-09-24 18:19:10 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2014-11-03 16:07:32 -0800 |
commit | 622f28ae9ba4fa89b4ff0f4a6cf75d153ea838ce (patch) | |
tree | b91404e9b6f9061fb0ab2b31cff1799bd71e7c52 /fs/f2fs/namei.c | |
parent | 201a05be9628ae58efe7638e0c7ae3937ec85273 (diff) |
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>
Diffstat (limited to 'fs/f2fs/namei.c')
-rw-r--r-- | fs/f2fs/namei.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 6e67f2b6fce1..c8290da8e941 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -54,6 +54,10 @@ static struct inode *f2fs_new_inode(struct inode *dir, umode_t mode) 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 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, 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 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) 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 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, 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 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, 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 @@ out_unlock: 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; |