namei.c (31d1b7710262fba12282b24083f20dc76e0efc93) namei.c (5222595d093ebe80329d38d255d14316257afb3e)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/namei.c
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#include <linux/fs.h>

--- 47 unchanged lines hidden (view full) ---

56 F2FS_I(inode)->i_current_depth = 1;
57
58 err = insert_inode_locked(inode);
59 if (err) {
60 err = -EINVAL;
61 goto fail;
62 }
63
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * fs/f2fs/namei.c
4 *
5 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
6 * http://www.samsung.com/
7 */
8#include <linux/fs.h>

--- 47 unchanged lines hidden (view full) ---

56 F2FS_I(inode)->i_current_depth = 1;
57
58 err = insert_inode_locked(inode);
59 if (err) {
60 err = -EINVAL;
61 goto fail;
62 }
63
64 if (f2fs_sb_has_project_quota(sbi->sb) &&
64 if (f2fs_sb_has_project_quota(sbi) &&
65 (F2FS_I(dir)->i_flags & F2FS_PROJINHERIT_FL))
66 F2FS_I(inode)->i_projid = F2FS_I(dir)->i_projid;
67 else
68 F2FS_I(inode)->i_projid = make_kprojid(&init_user_ns,
69 F2FS_DEF_PROJID);
70
71 err = dquot_initialize(inode);
72 if (err)
73 goto fail_drop;
74
75 set_inode_flag(inode, FI_NEW_INODE);
76
77 /* If the directory encrypted, then we should encrypt the inode. */
78 if ((f2fs_encrypted_inode(dir) || DUMMY_ENCRYPTION_ENABLED(sbi)) &&
79 f2fs_may_encrypt(inode))
80 f2fs_set_encrypted_inode(inode);
81
65 (F2FS_I(dir)->i_flags & F2FS_PROJINHERIT_FL))
66 F2FS_I(inode)->i_projid = F2FS_I(dir)->i_projid;
67 else
68 F2FS_I(inode)->i_projid = make_kprojid(&init_user_ns,
69 F2FS_DEF_PROJID);
70
71 err = dquot_initialize(inode);
72 if (err)
73 goto fail_drop;
74
75 set_inode_flag(inode, FI_NEW_INODE);
76
77 /* If the directory encrypted, then we should encrypt the inode. */
78 if ((f2fs_encrypted_inode(dir) || DUMMY_ENCRYPTION_ENABLED(sbi)) &&
79 f2fs_may_encrypt(inode))
80 f2fs_set_encrypted_inode(inode);
81
82 if (f2fs_sb_has_extra_attr(sbi->sb)) {
82 if (f2fs_sb_has_extra_attr(sbi)) {
83 set_inode_flag(inode, FI_EXTRA_ATTR);
84 F2FS_I(inode)->i_extra_isize = F2FS_TOTAL_EXTRA_ATTR_SIZE;
85 }
86
87 if (test_opt(sbi, INLINE_XATTR))
88 set_inode_flag(inode, FI_INLINE_XATTR);
89
90 if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode))
91 set_inode_flag(inode, FI_INLINE_DATA);
92 if (f2fs_may_inline_dentry(inode))
93 set_inode_flag(inode, FI_INLINE_DENTRY);
94
83 set_inode_flag(inode, FI_EXTRA_ATTR);
84 F2FS_I(inode)->i_extra_isize = F2FS_TOTAL_EXTRA_ATTR_SIZE;
85 }
86
87 if (test_opt(sbi, INLINE_XATTR))
88 set_inode_flag(inode, FI_INLINE_XATTR);
89
90 if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode))
91 set_inode_flag(inode, FI_INLINE_DATA);
92 if (f2fs_may_inline_dentry(inode))
93 set_inode_flag(inode, FI_INLINE_DENTRY);
94
95 if (f2fs_sb_has_flexible_inline_xattr(sbi->sb)) {
95 if (f2fs_sb_has_flexible_inline_xattr(sbi)) {
96 f2fs_bug_on(sbi, !f2fs_has_extra_attr(inode));
97 if (f2fs_has_inline_xattr(inode))
98 xattr_size = F2FS_OPTION(sbi).inline_xattr_size;
99 /* Otherwise, will be 0 */
100 } else if (f2fs_has_inline_xattr(inode) ||
101 f2fs_has_inline_dentry(inode)) {
102 xattr_size = DEFAULT_INLINE_XATTR_ADDRS;
103 }

--- 526 unchanged lines hidden (view full) ---

630
631 f2fs_balance_fs(sbi, true);
632 goto out_free_encrypted_link;
633
634out_f2fs_handle_failed_inode:
635 f2fs_handle_failed_inode(inode);
636out_free_encrypted_link:
637 if (disk_link.name != (unsigned char *)symname)
96 f2fs_bug_on(sbi, !f2fs_has_extra_attr(inode));
97 if (f2fs_has_inline_xattr(inode))
98 xattr_size = F2FS_OPTION(sbi).inline_xattr_size;
99 /* Otherwise, will be 0 */
100 } else if (f2fs_has_inline_xattr(inode) ||
101 f2fs_has_inline_dentry(inode)) {
102 xattr_size = DEFAULT_INLINE_XATTR_ADDRS;
103 }

--- 526 unchanged lines hidden (view full) ---

630
631 f2fs_balance_fs(sbi, true);
632 goto out_free_encrypted_link;
633
634out_f2fs_handle_failed_inode:
635 f2fs_handle_failed_inode(inode);
636out_free_encrypted_link:
637 if (disk_link.name != (unsigned char *)symname)
638 kfree(disk_link.name);
638 kvfree(disk_link.name);
639 return err;
640}
641
642static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
643{
644 struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
645 struct inode *inode;
646 int err;

--- 624 unchanged lines hidden ---
639 return err;
640}
641
642static int f2fs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
643{
644 struct f2fs_sb_info *sbi = F2FS_I_SB(dir);
645 struct inode *inode;
646 int err;

--- 624 unchanged lines hidden ---