btrfs: get fs_info from trans in btrfs_set_log_full_commit
authorDavid Sterba <dsterba@suse.com>
Wed, 20 Mar 2019 12:28:05 +0000 (13:28 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 29 Apr 2019 17:02:41 +0000 (19:02 +0200)
We can read fs_info from the transaction and can drop it from the
parameters.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c
fs/btrfs/inode.c
fs/btrfs/tree-log.c
fs/btrfs/tree-log.h

index 3dcb53c322268e399f25b91ac68e0da39eb0c43c..174f4f0311dacb49836cb919e60e1aa65fc98050 100644 (file)
@@ -10640,7 +10640,7 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used,
        struct btrfs_block_group_cache *cache;
        int ret;
 
-       btrfs_set_log_full_commit(fs_info, trans);
+       btrfs_set_log_full_commit(trans);
 
        cache = btrfs_create_block_group_cache(fs_info, chunk_offset, size);
        if (!cache)
index baa80d8088064212bd2e4c3aa16cea9b7d4667d4..b998e288366abc0848908f72012b69ba16fbcaa9 100644 (file)
@@ -9454,7 +9454,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
        /* Reference for the source. */
        if (old_ino == BTRFS_FIRST_FREE_OBJECTID) {
                /* force full log commit if subvolume involved. */
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
        } else {
                btrfs_pin_log_trans(root);
                root_log_pinned = true;
@@ -9471,7 +9471,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
        /* And now for the dest. */
        if (new_ino == BTRFS_FIRST_FREE_OBJECTID) {
                /* force full log commit if subvolume involved. */
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
        } else {
                btrfs_pin_log_trans(dest);
                dest_log_pinned = true;
@@ -9607,7 +9607,7 @@ out_fail:
                    btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) ||
                    (new_inode &&
                     btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation)))
-                       btrfs_set_log_full_commit(fs_info, trans);
+                       btrfs_set_log_full_commit(trans);
 
                if (root_log_pinned) {
                        btrfs_end_log_trans(root);
@@ -9793,7 +9793,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        BTRFS_I(old_inode)->dir_index = 0ULL;
        if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) {
                /* force full log commit if subvolume involved. */
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
        } else {
                btrfs_pin_log_trans(root);
                log_pinned = true;
@@ -9914,7 +9914,7 @@ out_fail:
                    btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) ||
                    (new_inode &&
                     btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation)))
-                       btrfs_set_log_full_commit(fs_info, trans);
+                       btrfs_set_log_full_commit(trans);
 
                btrfs_end_log_trans(root);
                log_pinned = false;
index dc030f620be1435fc1d7784b33d0415ad3e74cdd..75a8e3c78fdb69a63670aa2804f8d52bf841cd9d 100644 (file)
@@ -3096,7 +3096,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
        if (ret) {
                blk_finish_plug(&plug);
                btrfs_abort_transaction(trans, ret);
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
                mutex_unlock(&root->log_mutex);
                goto out;
        }
@@ -3138,7 +3138,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
                        list_del_init(&root_log_ctx.list);
 
                blk_finish_plug(&plug);
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
 
                if (ret != -ENOSPC) {
                        btrfs_abort_transaction(trans, ret);
@@ -3197,7 +3197,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
                                         EXTENT_DIRTY | EXTENT_NEW);
        blk_finish_plug(&plug);
        if (ret) {
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
                btrfs_abort_transaction(trans, ret);
                mutex_unlock(&log_root_tree->log_mutex);
                goto out_wake_log_root;
@@ -3207,7 +3207,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
                ret = btrfs_wait_tree_log_extents(log_root_tree,
                                                  EXTENT_NEW | EXTENT_DIRTY);
        if (ret) {
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
                mutex_unlock(&log_root_tree->log_mutex);
                goto out_wake_log_root;
        }
@@ -3229,7 +3229,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
         */
        ret = write_all_supers(fs_info, 1);
        if (ret) {
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
                btrfs_abort_transaction(trans, ret);
                goto out_wake_log_root;
        }
@@ -3433,7 +3433,7 @@ fail:
 out_unlock:
        mutex_unlock(&dir->log_mutex);
        if (ret == -ENOSPC) {
-               btrfs_set_log_full_commit(root->fs_info, trans);
+               btrfs_set_log_full_commit(trans);
                ret = 0;
        } else if (ret < 0)
                btrfs_abort_transaction(trans, ret);
@@ -3449,7 +3449,6 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
                               const char *name, int name_len,
                               struct btrfs_inode *inode, u64 dirid)
 {
-       struct btrfs_fs_info *fs_info = root->fs_info;
        struct btrfs_root *log;
        u64 index;
        int ret;
@@ -3467,7 +3466,7 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
                                  dirid, &index);
        mutex_unlock(&inode->log_mutex);
        if (ret == -ENOSPC) {
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
                ret = 0;
        } else if (ret < 0 && ret != -ENOENT)
                btrfs_abort_transaction(trans, ret);
@@ -5453,7 +5452,7 @@ static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans,
                 * Make sure any commits to the log are forced to be full
                 * commits.
                 */
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
                ret = true;
        }
        mutex_unlock(&inode->log_mutex);
@@ -6006,7 +6005,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
 end_trans:
        dput(old_parent);
        if (ret < 0) {
-               btrfs_set_log_full_commit(fs_info, trans);
+               btrfs_set_log_full_commit(trans);
                ret = 1;
        }
 
index bdf63d0c4128c1e02b70a42ad661eba9c433cecf..132e43d29034eb1d4e61a6bd30edc45554d7682a 100644 (file)
@@ -30,10 +30,9 @@ static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx,
        INIT_LIST_HEAD(&ctx->list);
 }
 
-static inline void btrfs_set_log_full_commit(struct btrfs_fs_info *fs_info,
-                                            struct btrfs_trans_handle *trans)
+static inline void btrfs_set_log_full_commit(struct btrfs_trans_handle *trans)
 {
-       WRITE_ONCE(fs_info->last_trans_log_full_commit, trans->transid);
+       WRITE_ONCE(trans->fs_info->last_trans_log_full_commit, trans->transid);
 }
 
 static inline int btrfs_need_log_full_commit(struct btrfs_trans_handle *trans)