summaryrefslogtreecommitdiff
path: root/fs/f2fs/namei.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2014-06-21 08:37:02 +0400
committerJaegeuk Kim <jaegeuk@kernel.org>2014-07-10 01:04:24 +0400
commitb97a9b5da891ab6aff5a6a19c569c9c4c5563d48 (patch)
treec8e3fe4ddbba29eed50b9bf461cb088b21a13d00 /fs/f2fs/namei.c
parent50732df02eefb39ab414ef655979c2c9b64ad21c (diff)
downloadlinux-b97a9b5da891ab6aff5a6a19c569c9c4c5563d48.tar.xz
f2fs: introduce f2fs_do_tmpfile for code consistency
This patch adds f2fs_do_tmpfile to eliminate the redundant init_inode_metadata flow. Throught this, we can provide the consistent lock usage, e.g., fi->i_sem, and this will enable better debugging stuffs. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/namei.c')
-rw-r--r--fs/f2fs/namei.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 5c08c546e4c8..1994d2e449d6 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -493,7 +493,6 @@ static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
struct super_block *sb = dir->i_sb;
struct f2fs_sb_info *sbi = F2FS_SB(sb);
struct inode *inode;
- struct page *page;
int err;
inode = f2fs_new_inode(dir, mode);
@@ -508,38 +507,25 @@ static int f2fs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
err = acquire_orphan_inode(sbi);
if (err)
goto out;
+
+ err = f2fs_do_tmpfile(inode, dir);
+ if (err)
+ goto release_out;
+
/*
* add this non-linked tmpfile to orphan list, in this way we could
* remove all unused data of tmpfile after abnormal power-off.
*/
add_orphan_inode(sbi, inode->i_ino);
-
- page = new_inode_page(inode, NULL);
- if (IS_ERR(page)) {
- err = PTR_ERR(page);
- goto remove_out;
- }
-
- err = f2fs_init_acl(inode, dir, page);
- if (err)
- goto unlock_out;
-
- err = f2fs_init_security(inode, dir, NULL, page);
- if (err)
- goto unlock_out;
-
- f2fs_put_page(page, 1);
f2fs_unlock_op(sbi);
alloc_nid_done(sbi, inode->i_ino);
- mark_inode_dirty(inode);
d_tmpfile(dentry, inode);
unlock_new_inode(inode);
return 0;
-unlock_out:
- f2fs_put_page(page, 1);
-remove_out:
- remove_orphan_inode(sbi, inode->i_ino);
+
+release_out:
+ release_orphan_inode(sbi);
out:
f2fs_unlock_op(sbi);
clear_nlink(inode);