summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/dir.c
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2014-06-19 10:23:19 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2014-07-09 23:04:24 +0200
commit50732df02eefb39ab414ef655979c2c9b64ad21c (patch)
treee8cb6cb0be5951f112ced0406d5bd0c6721aa60e /fs/f2fs/dir.c
parentf2fs: avoid to truncate non-updated page partially (diff)
downloadlinux-50732df02eefb39ab414ef655979c2c9b64ad21c.tar.xz
linux-50732df02eefb39ab414ef655979c2c9b64ad21c.zip
f2fs: support ->tmpfile()
Add function f2fs_tmpfile() to support O_TMPFILE file creation, and modify logic of init_inode_metadata to enable linkat temp file. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/dir.c')
-rw-r--r--fs/f2fs/dir.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index a4addd72ebbd..3677f4124541 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -333,10 +333,12 @@ static int make_empty_dir(struct inode *inode,
static struct page *init_inode_metadata(struct inode *inode,
struct inode *dir, const struct qstr *name)
{
+ struct f2fs_sb_info *sbi = F2FS_SB(dir->i_sb);
struct page *page;
int err;
- if (is_inode_flag_set(F2FS_I(inode), FI_NEW_INODE)) {
+ if (is_inode_flag_set(F2FS_I(inode), FI_NEW_INODE) &&
+ inode->i_nlink) {
page = new_inode_page(inode, name);
if (IS_ERR(page))
return page;
@@ -370,6 +372,12 @@ static struct page *init_inode_metadata(struct inode *inode,
*/
if (is_inode_flag_set(F2FS_I(inode), FI_INC_LINK)) {
file_lost_pino(inode);
+ /*
+ * If link the tmpfile to alias through linkat path,
+ * we should remove this inode from orphan list.
+ */
+ if (inode->i_nlink == 0)
+ remove_orphan_inode(sbi, inode->i_ino);
inc_nlink(inode);
}
return page;