btrfs: Make btrfs_record_unlink_dir take btrfs_inode
authorNikolay Borisov <n.borisov.lkml@gmail.com>
Tue, 17 Jan 2017 22:31:28 +0000 (00:31 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 14 Feb 2017 14:50:53 +0000 (15:50 +0100)
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c
fs/btrfs/tree-log.c
fs/btrfs/tree-log.h

index 7d8d6c1..0455ee2 100644 (file)
@@ -4127,7 +4127,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
        if (IS_ERR(trans))
                return PTR_ERR(trans);
 
-       btrfs_record_unlink_dir(trans, dir, d_inode(dentry), 0);
+       btrfs_record_unlink_dir(trans, BTRFS_I(dir), BTRFS_I(d_inode(dentry)), 0);
 
        ret = btrfs_unlink_inode(trans, root, dir, d_inode(dentry),
                                 dentry->d_name.name, dentry->d_name.len);
@@ -9587,8 +9587,8 @@ static int btrfs_rename_exchange(struct inode *old_dir,
        new_inode->i_ctime = ctime;
 
        if (old_dentry->d_parent != new_dentry->d_parent) {
-               btrfs_record_unlink_dir(trans, old_dir, old_inode, 1);
-               btrfs_record_unlink_dir(trans, new_dir, new_inode, 1);
+               btrfs_record_unlink_dir(trans, BTRFS_I(old_dir), BTRFS_I(old_inode), 1);
+               btrfs_record_unlink_dir(trans, BTRFS_I(new_dir), BTRFS_I(new_inode), 1);
        }
 
        /* src is a subvolume */
@@ -9867,7 +9867,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        old_inode->i_ctime = current_time(old_dir);
 
        if (old_dentry->d_parent != new_dentry->d_parent)
-               btrfs_record_unlink_dir(trans, old_dir, old_inode, 1);
+               btrfs_record_unlink_dir(trans, BTRFS_I(old_dir), BTRFS_I(old_inode), 1);
 
        if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) {
                root_objectid = BTRFS_I(old_inode)->root->root_key.objectid;
index a2a822a..6f9a3be 100644 (file)
@@ -5730,7 +5730,7 @@ error:
  * inodes, etc) are done.
  */
 void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
-                            struct inode *dir, struct inode *inode,
+                            struct btrfs_inode *dir, struct btrfs_inode *inode,
                             int for_rename)
 {
        /*
@@ -5743,23 +5743,23 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
         * into the file.  When the file is logged we check it and
         * don't log the parents if the file is fully on disk.
         */
-       mutex_lock(&BTRFS_I(inode)->log_mutex);
-       BTRFS_I(inode)->last_unlink_trans = trans->transid;
-       mutex_unlock(&BTRFS_I(inode)->log_mutex);
+       mutex_lock(&inode->log_mutex);
+       inode->last_unlink_trans = trans->transid;
+       mutex_unlock(&inode->log_mutex);
 
        /*
         * if this directory was already logged any new
         * names for this file/dir will get recorded
         */
        smp_mb();
-       if (BTRFS_I(dir)->logged_trans == trans->transid)
+       if (dir->logged_trans == trans->transid)
                return;
 
        /*
         * if the inode we're about to unlink was logged,
         * the log will be properly updated for any new names
         */
-       if (BTRFS_I(inode)->logged_trans == trans->transid)
+       if (inode->logged_trans == trans->transid)
                return;
 
        /*
@@ -5776,9 +5776,9 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
        return;
 
 record:
-       mutex_lock(&BTRFS_I(dir)->log_mutex);
-       BTRFS_I(dir)->last_unlink_trans = trans->transid;
-       mutex_unlock(&BTRFS_I(dir)->log_mutex);
+       mutex_lock(&dir->log_mutex);
+       dir->last_unlink_trans = trans->transid;
+       mutex_unlock(&dir->log_mutex);
 }
 
 /*
index 127eae0..7df0f75 100644 (file)
@@ -80,7 +80,7 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
 void btrfs_end_log_trans(struct btrfs_root *root);
 int btrfs_pin_log_trans(struct btrfs_root *root);
 void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
-                            struct inode *dir, struct inode *inode,
+                            struct btrfs_inode *dir, struct btrfs_inode *inode,
                             int for_rename);
 void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
                                   struct inode *dir);