All of lore.kernel.org
 help / color / mirror / Atom feed
From: jeffm@suse.com
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 13/31] btrfs: add btrfs_trans_handle->fs_info pointer
Date: Fri, 24 Jun 2016 18:15:06 -0400	[thread overview]
Message-ID: <1466806524-27508-14-git-send-email-jeffm@suse.com> (raw)
In-Reply-To: <1466806524-27508-1-git-send-email-jeffm@suse.com>

From: Jeff Mahoney <jeffm@suse.com>

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>
---
 fs/btrfs/extent-tree.c | 6 +++---
 fs/btrfs/qgroup.c      | 2 +-
 fs/btrfs/transaction.c | 1 +
 fs/btrfs/transaction.h | 1 +
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index e4af375..2081ed4 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4562,7 +4562,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;
@@ -5527,7 +5527,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;
@@ -8318,7 +8318,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);
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
index 3a83631..93ee1c1 100644
--- a/fs/btrfs/qgroup.c
+++ b/fs/btrfs/qgroup.c
@@ -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",
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index db26eff..db0eb1f 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -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;
diff --git a/fs/btrfs/transaction.h b/fs/btrfs/transaction.h
index c5abee4..efb1226 100644
--- a/fs/btrfs/transaction.h
+++ b/fs/btrfs/transaction.h
@@ -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;
-- 
2.7.1


  parent reply	other threads:[~2016-06-24 22:15 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24 22:14 [PATCH 00/31] btrfs: simplify use of struct btrfs_root pointers jeffm
2016-06-24 22:14 ` [PATCH 01/31] btrfs: plumb fs_info into btrfs_work jeffm
2016-06-24 22:14 ` [PATCH 02/31] btrfs: prefix fsid to all trace events jeffm
2016-06-27  1:50   ` Qu Wenruo
2016-06-24 22:14 ` [PATCH 03/31] btrfs: btrfs_test_opt and friends should take a btrfs_fs_info jeffm
2016-06-27  2:14   ` Qu Wenruo
2016-06-27  2:21     ` Jeff Mahoney
2016-06-27  2:24       ` Qu Wenruo
2016-06-24 22:14 ` [PATCH 04/31] btrfs: tests, move initialization into tests/ jeffm
2016-06-27  2:17   ` Qu Wenruo
2016-06-27  2:28     ` Jeff Mahoney
2016-06-24 22:14 ` [PATCH 05/31] btrfs: tests, require fs_info for root jeffm
2016-07-08  1:32   ` Jeff Mahoney
2016-07-08 11:20     ` David Sterba
2016-06-24 22:14 ` [PATCH 06/31] btrfs: tests, use BTRFS_FS_STATE_DUMMY_FS_INFO instead of dummy root jeffm
2016-06-24 22:15 ` [PATCH 07/31] btrfs: simpilify btrfs_subvol_inherit_props jeffm
2016-06-24 22:15 ` [PATCH 08/31] btrfs: copy_to_sk drop unused root parameter jeffm
2016-06-24 22:15 ` [PATCH 09/31] btrfs: cleanup, remove prototype for btrfs_find_root_ref jeffm
2016-06-24 22:15 ` [PATCH 10/31] btrfs: introduce BTRFS_MAX_ITEM_SIZE jeffm
2016-06-24 22:15 ` [PATCH 11/31] btrfs: convert nodesize macros to static inlines jeffm
2016-06-24 22:15 ` [PATCH 12/31] btrfs: btrfs_relocate_chunk pass extent_root to btrfs_end_transaction jeffm
2016-06-24 22:15 ` jeffm [this message]
2016-06-24 22:15 ` [PATCH 14/31] btrfs: btrfs_abort_transaction, drop root parameter jeffm
2016-06-24 22:15 ` [PATCH 15/31] btrfs: call functions that overwrite their root parameter with fs_info jeffm
2016-09-06 17:40   ` David Sterba
2016-06-24 22:15 ` [PATCH 16/31] btrfs: call functions that always use the same root with fs_info instead jeffm
2016-06-24 22:15 ` [PATCH 17/31] btrfs: btrfs_init_new_device should use fs_info->dev_root jeffm
2016-06-24 22:15 ` [PATCH 18/31] btrfs: alloc_reserved_file_extent trace point should use extent_root jeffm
2016-06-24 22:15 ` [PATCH 19/31] btrfs: struct btrfsic_state->root should be an fs_info jeffm
2016-06-24 22:15 ` [PATCH 20/31] btrfs: struct reada_control.root -> reada_control.fs_info jeffm
2016-06-24 22:15 ` [PATCH 21/31] btrfs: root->fs_info cleanup, use fs_info->dev_root everywhere jeffm
2016-06-24 22:15 ` [PATCH 22/31] btrfs: root->fs_info cleanup, io_ctl_init jeffm
2016-06-24 22:15 ` [PATCH 24/31] btrfs: root->fs_info cleanup, btrfs_calc_{trans,trunc}_metadata_size jeffm
2016-06-24 22:15 ` [PATCH 25/31] btrfs: root->fs_info cleanup, lock/unlock_chunks jeffm
2016-06-24 22:15 ` [PATCH 26/31] btrfs: root->fs_info cleanup, update_block_group{,flags} jeffm
2016-06-24 22:15 ` [PATCH 28/31] btrfs: root->fs_info cleanup, access fs_info->delayed_root directly jeffm
2016-06-24 22:15 ` [PATCH 30/31] btrfs: root->fs_info cleanup, btrfs_commit_transaction already has root jeffm
2016-06-24 22:15 ` [PATCH 31/31] btrfs: root->fs_info cleanup, btrfs_end_transaction{,_throttle} use trans->fs_info instead of parameter jeffm
2016-06-26 13:50 ` [PATCH 00/31] btrfs: simplify use of struct btrfs_root pointers Jeff Mahoney
2016-06-27  1:34 ` Qu Wenruo
2016-07-07 14:07 ` David Sterba
2016-07-08  1:48 ` Jeff Mahoney
2016-07-08  2:19   ` Jeff Mahoney
2016-07-08 12:50     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1466806524-27508-14-git-send-email-jeffm@suse.com \
    --to=jeffm@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.