btrfs: add btrfs_trans_handle->fs_info pointer
authorJeff Mahoney <jeffm@suse.com>
Mon, 20 Jun 2016 21:23:41 +0000 (17:23 -0400)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Jul 2016 11:54:26 +0000 (13:54 +0200)
btrfs_trans_handle->root is documented as for use for confirming
that the root passed in to start the transaction is the same as the
one ending it.  It's used in several places when an fs_info pointer
is needed, so let's just add an fs_info pointer directly.  Eventually,
the root pointer can be removed.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c
fs/btrfs/qgroup.c
fs/btrfs/transaction.c
fs/btrfs/transaction.h

index 44549d706dcd1ea20466d1f4b7805fd3dbd2640e..c6c505e2478f15bcb5b61394e8e314b064142ac0 100644 (file)
@@ -4589,7 +4589,7 @@ out:
         */
        if (trans->can_flush_pending_bgs &&
            trans->chunk_bytes_reserved >= (u64)SZ_2M) {
-               btrfs_create_pending_block_groups(trans, trans->root);
+               btrfs_create_pending_block_groups(trans, extent_root);
                btrfs_trans_release_chunk_metadata(trans);
        }
        return ret;
@@ -5730,7 +5730,7 @@ void btrfs_trans_release_metadata(struct btrfs_trans_handle *trans,
  */
 void btrfs_trans_release_chunk_metadata(struct btrfs_trans_handle *trans)
 {
-       struct btrfs_fs_info *fs_info = trans->root->fs_info;
+       struct btrfs_fs_info *fs_info = trans->fs_info;
 
        if (!trans->chunk_bytes_reserved)
                return;
@@ -8543,7 +8543,7 @@ static int record_one_subtree_extent(struct btrfs_trans_handle *trans,
 
        delayed_refs = &trans->transaction->delayed_refs;
        spin_lock(&delayed_refs->lock);
-       if (btrfs_qgroup_insert_dirty_extent(trans->root->fs_info,
+       if (btrfs_qgroup_insert_dirty_extent(trans->fs_info,
                                             delayed_refs, qrecord))
                kfree(qrecord);
        spin_unlock(&delayed_refs->lock);
index 3a83631c117606bdb44129c67dcf10ab81fcad1f..93ee1c18ef9d4c2e1677fc3ad437b3044c84f68e 100644 (file)
@@ -2196,7 +2196,7 @@ void assert_qgroups_uptodate(struct btrfs_trans_handle *trans)
 {
        if (list_empty(&trans->qgroup_ref_list) && !trans->delayed_ref_elem.seq)
                return;
-       btrfs_err(trans->root->fs_info,
+       btrfs_err(trans->fs_info,
                "qgroups not uptodate in trans handle %p:  list is%s empty, "
                "seq is %#x.%x",
                trans, list_empty(&trans->qgroup_ref_list) ? "" : " not",
index d986447d19a4ac540dd3700c67311478edbc7263..41e14c632c3fd384a32b10c09c9d77eac422af46 100644 (file)
@@ -561,6 +561,7 @@ again:
        h->transaction = cur_trans;
        h->root = root;
        h->use_count = 1;
+       h->fs_info = root->fs_info;
 
        h->type = type;
        h->can_flush_pending_bgs = true;
index c5abee4f01add54f811c78fac76170f8b5c02bb3..efb1226433800b12c83af38fad763eddbbab5cbb 100644 (file)
@@ -128,6 +128,7 @@ struct btrfs_trans_handle {
         * Subvolume quota depends on this
         */
        struct btrfs_root *root;
+       struct btrfs_fs_info *fs_info;
        struct seq_list delayed_ref_elem;
        struct list_head qgroup_ref_list;
        struct list_head new_bgs;