Skip to content

Commit

Permalink
btrfs: add btrfs_trans_handle->fs_info pointer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff Mahoney authored and David Sterba committed Jul 26, 2016
1 parent 05f9a78 commit 64b6358
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -4589,7 +4589,7 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,
*/
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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/qgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ start_transaction(struct btrfs_root *root, unsigned int num_items,
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;
Expand Down
1 change: 1 addition & 0 deletions fs/btrfs/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 64b6358

Please sign in to comment.