namei.c (6e9041c6ddd6cbdc61d87bcaca8ca7bb17c28377) namei.c (2d4d9fb591fe83d9f0559afaa9736ebc8edad0aa)
1/*
2 * fs/f2fs/namei.c
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

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

144 ilock = mutex_lock_op(sbi);
145 err = f2fs_add_link(dentry, inode);
146 mutex_unlock_op(sbi, ilock);
147 if (err)
148 goto out;
149
150 alloc_nid_done(sbi, ino);
151
1/*
2 * fs/f2fs/namei.c
3 *
4 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * http://www.samsung.com/
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

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

144 ilock = mutex_lock_op(sbi);
145 err = f2fs_add_link(dentry, inode);
146 mutex_unlock_op(sbi, ilock);
147 if (err)
148 goto out;
149
150 alloc_nid_done(sbi, ino);
151
152 if (!sbi->por_doing)
153 d_instantiate(dentry, inode);
152 d_instantiate(dentry, inode);
154 unlock_new_inode(inode);
155 return 0;
156out:
157 clear_nlink(inode);
158 unlock_new_inode(inode);
159 make_bad_inode(inode);
160 iput(inode);
161 alloc_nid_failed(sbi, ino);

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

168 struct inode *inode = old_dentry->d_inode;
169 struct super_block *sb = dir->i_sb;
170 struct f2fs_sb_info *sbi = F2FS_SB(sb);
171 int err, ilock;
172
173 f2fs_balance_fs(sbi);
174
175 inode->i_ctime = CURRENT_TIME;
153 unlock_new_inode(inode);
154 return 0;
155out:
156 clear_nlink(inode);
157 unlock_new_inode(inode);
158 make_bad_inode(inode);
159 iput(inode);
160 alloc_nid_failed(sbi, ino);

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

167 struct inode *inode = old_dentry->d_inode;
168 struct super_block *sb = dir->i_sb;
169 struct f2fs_sb_info *sbi = F2FS_SB(sb);
170 int err, ilock;
171
172 f2fs_balance_fs(sbi);
173
174 inode->i_ctime = CURRENT_TIME;
176 atomic_inc(&inode->i_count);
175 ihold(inode);
177
178 set_inode_flag(F2FS_I(inode), FI_INC_LINK);
179 ilock = mutex_lock_op(sbi);
180 err = f2fs_add_link(dentry, inode);
181 mutex_unlock_op(sbi, ilock);
182 if (err)
183 goto out;
184
176
177 set_inode_flag(F2FS_I(inode), FI_INC_LINK);
178 ilock = mutex_lock_op(sbi);
179 err = f2fs_add_link(dentry, inode);
180 mutex_unlock_op(sbi, ilock);
181 if (err)
182 goto out;
183
185 /*
186 * This file should be checkpointed during fsync.
187 * We lost i_pino from now on.
188 */
189 set_cp_file(inode);
190
191 d_instantiate(dentry, inode);
192 return 0;
193out:
194 clear_inode_flag(F2FS_I(inode), FI_INC_LINK);
184 d_instantiate(dentry, inode);
185 return 0;
186out:
187 clear_inode_flag(F2FS_I(inode), FI_INC_LINK);
195 make_bad_inode(inode);
196 iput(inode);
197 return err;
198}
199
200struct dentry *f2fs_get_parent(struct dentry *child)
201{
202 struct qstr dotdot = QSTR_INIT("..", 2);
203 unsigned long ino = f2fs_inode_by_name(child->d_inode, &dotdot);

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

493 .lookup = f2fs_lookup,
494 .link = f2fs_link,
495 .unlink = f2fs_unlink,
496 .symlink = f2fs_symlink,
497 .mkdir = f2fs_mkdir,
498 .rmdir = f2fs_rmdir,
499 .mknod = f2fs_mknod,
500 .rename = f2fs_rename,
188 iput(inode);
189 return err;
190}
191
192struct dentry *f2fs_get_parent(struct dentry *child)
193{
194 struct qstr dotdot = QSTR_INIT("..", 2);
195 unsigned long ino = f2fs_inode_by_name(child->d_inode, &dotdot);

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

485 .lookup = f2fs_lookup,
486 .link = f2fs_link,
487 .unlink = f2fs_unlink,
488 .symlink = f2fs_symlink,
489 .mkdir = f2fs_mkdir,
490 .rmdir = f2fs_rmdir,
491 .mknod = f2fs_mknod,
492 .rename = f2fs_rename,
493 .getattr = f2fs_getattr,
501 .setattr = f2fs_setattr,
502 .get_acl = f2fs_get_acl,
503#ifdef CONFIG_F2FS_FS_XATTR
504 .setxattr = generic_setxattr,
505 .getxattr = generic_getxattr,
506 .listxattr = f2fs_listxattr,
507 .removexattr = generic_removexattr,
508#endif
509};
510
511const struct inode_operations f2fs_symlink_inode_operations = {
512 .readlink = generic_readlink,
513 .follow_link = page_follow_link_light,
514 .put_link = page_put_link,
494 .setattr = f2fs_setattr,
495 .get_acl = f2fs_get_acl,
496#ifdef CONFIG_F2FS_FS_XATTR
497 .setxattr = generic_setxattr,
498 .getxattr = generic_getxattr,
499 .listxattr = f2fs_listxattr,
500 .removexattr = generic_removexattr,
501#endif
502};
503
504const struct inode_operations f2fs_symlink_inode_operations = {
505 .readlink = generic_readlink,
506 .follow_link = page_follow_link_light,
507 .put_link = page_put_link,
508 .getattr = f2fs_getattr,
515 .setattr = f2fs_setattr,
516#ifdef CONFIG_F2FS_FS_XATTR
517 .setxattr = generic_setxattr,
518 .getxattr = generic_getxattr,
519 .listxattr = f2fs_listxattr,
520 .removexattr = generic_removexattr,
521#endif
522};
523
524const struct inode_operations f2fs_special_inode_operations = {
509 .setattr = f2fs_setattr,
510#ifdef CONFIG_F2FS_FS_XATTR
511 .setxattr = generic_setxattr,
512 .getxattr = generic_getxattr,
513 .listxattr = f2fs_listxattr,
514 .removexattr = generic_removexattr,
515#endif
516};
517
518const struct inode_operations f2fs_special_inode_operations = {
519 .getattr = f2fs_getattr,
525 .setattr = f2fs_setattr,
526 .get_acl = f2fs_get_acl,
527#ifdef CONFIG_F2FS_FS_XATTR
528 .setxattr = generic_setxattr,
529 .getxattr = generic_getxattr,
530 .listxattr = f2fs_listxattr,
531 .removexattr = generic_removexattr,
532#endif
533};
520 .setattr = f2fs_setattr,
521 .get_acl = f2fs_get_acl,
522#ifdef CONFIG_F2FS_FS_XATTR
523 .setxattr = generic_setxattr,
524 .getxattr = generic_getxattr,
525 .listxattr = f2fs_listxattr,
526 .removexattr = generic_removexattr,
527#endif
528};