aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7cd8ab0ef04d..fc966472e3ad 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6985,7 +6985,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
6985 struct btrfs_trans_handle *trans; 6985 struct btrfs_trans_handle *trans;
6986 struct btrfs_root *root = BTRFS_I(old_dir)->root; 6986 struct btrfs_root *root = BTRFS_I(old_dir)->root;
6987 struct btrfs_root *dest = BTRFS_I(new_dir)->root; 6987 struct btrfs_root *dest = BTRFS_I(new_dir)->root;
6988 struct inode *new_inode = new_dentry->d_inode; 6988 struct inode *newinode = new_dentry->d_inode;
6989 struct inode *old_inode = old_dentry->d_inode; 6989 struct inode *old_inode = old_dentry->d_inode;
6990 struct timespec ctime = CURRENT_TIME; 6990 struct timespec ctime = CURRENT_TIME;
6991 u64 index = 0; 6991 u64 index = 0;
@@ -7000,18 +7000,18 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7000 return -EXDEV; 7000 return -EXDEV;
7001 7001
7002 if (old_inode->i_ino == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID || 7002 if (old_inode->i_ino == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID ||
7003 (new_inode && new_inode->i_ino == BTRFS_FIRST_FREE_OBJECTID)) 7003 (newinode && newinode->i_ino == BTRFS_FIRST_FREE_OBJECTID))
7004 return -ENOTEMPTY; 7004 return -ENOTEMPTY;
7005 7005
7006 if (S_ISDIR(old_inode->i_mode) && new_inode && 7006 if (S_ISDIR(old_inode->i_mode) && newinode &&
7007 new_inode->i_size > BTRFS_EMPTY_DIR_SIZE) 7007 newinode->i_size > BTRFS_EMPTY_DIR_SIZE)
7008 return -ENOTEMPTY; 7008 return -ENOTEMPTY;
7009 /* 7009 /*
7010 * we're using rename to replace one file with another. 7010 * we're using rename to replace one file with another.
7011 * and the replacement file is large. Start IO on it now so 7011 * and the replacement file is large. Start IO on it now so
7012 * we don't add too much work to the end of the transaction 7012 * we don't add too much work to the end of the transaction
7013 */ 7013 */
7014 if (new_inode && S_ISREG(old_inode->i_mode) && new_inode->i_size && 7014 if (newinode && S_ISREG(old_inode->i_mode) && newinode->i_size &&
7015 old_inode->i_size > BTRFS_ORDERED_OPERATIONS_FLUSH_LIMIT) 7015 old_inode->i_size > BTRFS_ORDERED_OPERATIONS_FLUSH_LIMIT)
7016 filemap_flush(old_inode->i_mapping); 7016 filemap_flush(old_inode->i_mapping);
7017 7017
@@ -7065,7 +7065,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7065 * make sure the inode gets flushed if it is replacing 7065 * make sure the inode gets flushed if it is replacing
7066 * something. 7066 * something.
7067 */ 7067 */
7068 if (new_inode && new_inode->i_size && 7068 if (newinode && newinode->i_size &&
7069 old_inode && S_ISREG(old_inode->i_mode)) { 7069 old_inode && S_ISREG(old_inode->i_mode)) {
7070 btrfs_add_ordered_operation(trans, root, old_inode); 7070 btrfs_add_ordered_operation(trans, root, old_inode);
7071 } 7071 }
@@ -7092,16 +7092,16 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7092 } 7092 }
7093 BUG_ON(ret); 7093 BUG_ON(ret);
7094 7094
7095 if (new_inode) { 7095 if (newinode) {
7096 new_inode->i_ctime = CURRENT_TIME; 7096 newinode->i_ctime = CURRENT_TIME;
7097 if (unlikely(new_inode->i_ino == 7097 if (unlikely(newinode->i_ino ==
7098 BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) { 7098 BTRFS_EMPTY_SUBVOL_DIR_OBJECTID)) {
7099 root_objectid = BTRFS_I(new_inode)->location.objectid; 7099 root_objectid = BTRFS_I(newinode)->location.objectid;
7100 ret = btrfs_unlink_subvol(trans, dest, new_dir, 7100 ret = btrfs_unlink_subvol(trans, dest, new_dir,
7101 root_objectid, 7101 root_objectid,
7102 new_dentry->d_name.name, 7102 new_dentry->d_name.name,
7103 new_dentry->d_name.len); 7103 new_dentry->d_name.len);
7104 BUG_ON(new_inode->i_nlink == 0); 7104 BUG_ON(newinode->i_nlink == 0);
7105 } else { 7105 } else {
7106 ret = btrfs_unlink_inode(trans, dest, new_dir, 7106 ret = btrfs_unlink_inode(trans, dest, new_dir,
7107 new_dentry->d_inode, 7107 new_dentry->d_inode,
@@ -7109,7 +7109,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
7109 new_dentry->d_name.len); 7109 new_dentry->d_name.len);
7110 } 7110 }
7111 BUG_ON(ret); 7111 BUG_ON(ret);
7112 if (new_inode->i_nlink == 0) { 7112 if (newinode->i_nlink == 0) {
7113 ret = btrfs_orphan_add(trans, new_dentry->d_inode); 7113 ret = btrfs_orphan_add(trans, new_dentry->d_inode);
7114 BUG_ON(ret); 7114 BUG_ON(ret);
7115 } 7115 }