linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jeffm@suse.com
To: linux-btrfs@vger.kernel.org
Cc: Jeff Mahoney <jeffm@suse.com>
Subject: [PATCH 06/18] btrfs: struct reada_control.root -> reada_control.fs_info
Date: Fri,  2 Dec 2016 00:07:26 -0500	[thread overview]
Message-ID: <1480655258-15400-7-git-send-email-jeffm@suse.com> (raw)
In-Reply-To: <1480655258-15400-1-git-send-email-jeffm@suse.com>

From: Jeff Mahoney <jeffm@suse.com>

The root is never used.  We substitute extent_root in for the
reada_find_extent call, since it's only ever used to obtain the node
size.  This call site will be changed to use fs_info in a later patch.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/btrfs/ctree.h |  2 +-
 fs/btrfs/reada.c | 13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 74110c7..9a3ca79 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3652,7 +3652,7 @@ static inline void btrfs_bio_counter_dec(struct btrfs_fs_info *fs_info)
 
 /* reada.c */
 struct reada_control {
-	struct btrfs_root	*root;		/* tree to prefetch */
+	struct btrfs_fs_info	*fs_info;		/* tree to prefetch */
 	struct btrfs_key	key_start;
 	struct btrfs_key	key_end;	/* exclusive */
 	atomic_t		elems;
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index f0beb63..540e729 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -544,17 +544,18 @@ static void reada_control_release(struct kref *kref)
 static int reada_add_block(struct reada_control *rc, u64 logical,
 			   struct btrfs_key *top, u64 generation)
 {
-	struct btrfs_root *root = rc->root;
+	struct btrfs_fs_info *fs_info = rc->fs_info;
 	struct reada_extent *re;
 	struct reada_extctl *rec;
 
-	re = reada_find_extent(root, logical, top); /* takes one ref */
+	/* takes one ref */
+	re = reada_find_extent(fs_info->tree_root, logical, top);
 	if (!re)
 		return -1;
 
 	rec = kzalloc(sizeof(*rec), GFP_KERNEL);
 	if (!rec) {
-		reada_extent_put(root->fs_info, re);
+		reada_extent_put(fs_info, re);
 		return -ENOMEM;
 	}
 
@@ -914,7 +915,7 @@ struct reada_control *btrfs_reada_add(struct btrfs_root *root,
 	if (!rc)
 		return ERR_PTR(-ENOMEM);
 
-	rc->root = root;
+	rc->fs_info = root->fs_info;
 	rc->key_start = *key_start;
 	rc->key_end = *key_end;
 	atomic_set(&rc->elems, 0);
@@ -942,7 +943,7 @@ struct reada_control *btrfs_reada_add(struct btrfs_root *root,
 int btrfs_reada_wait(void *handle)
 {
 	struct reada_control *rc = handle;
-	struct btrfs_fs_info *fs_info = rc->root->fs_info;
+	struct btrfs_fs_info *fs_info = rc->fs_info;
 
 	while (atomic_read(&rc->elems)) {
 		if (!atomic_read(&fs_info->reada_works_cnt))
@@ -963,7 +964,7 @@ int btrfs_reada_wait(void *handle)
 int btrfs_reada_wait(void *handle)
 {
 	struct reada_control *rc = handle;
-	struct btrfs_fs_info *fs_info = rc->root->fs_info;
+	struct btrfs_fs_info *fs_info = rc->fs_info;
 
 	while (atomic_read(&rc->elems)) {
 		if (!atomic_read(&fs_info->reada_works_cnt))
-- 
2.7.1


  parent reply	other threads:[~2016-12-02  5:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02  5:07 [PATCH 00/18] misc-4.10: root->fs_info patchset jeffm
2016-12-02  5:07 ` [PATCH 01/18] btrfs: call functions that overwrite their root parameter with fs_info jeffm
2016-12-02 22:32   ` Omar Sandoval
2016-12-04  2:03     ` Jeff Mahoney
2016-12-02  5:07 ` [PATCH 02/18] btrfs: call functions that always use the same root with fs_info instead jeffm
2016-12-02  5:07 ` [PATCH 03/18] btrfs: btrfs_init_new_device should use fs_info->dev_root jeffm
2016-12-02  5:07 ` [PATCH 04/18] btrfs: alloc_reserved_file_extent trace point should use extent_root jeffm
2016-12-02  5:07 ` [PATCH 05/18] btrfs: struct btrfsic_state->root should be an fs_info jeffm
2016-12-02  5:07 ` jeffm [this message]
2016-12-02  5:07 ` [PATCH 07/18] btrfs: root->fs_info cleanup, use fs_info->dev_root everywhere jeffm
2016-12-02  5:07 ` [PATCH 08/18] btrfs: root->fs_info cleanup, io_ctl_init jeffm
2016-12-02  5:07 ` [PATCH 10/18] btrfs: root->fs_info cleanup, btrfs_calc_{trans,trunc}_metadata_size jeffm
2016-12-05 15:29   ` David Sterba
2016-12-05 15:50     ` Jeff Mahoney
2016-12-06 14:54       ` David Sterba
2016-12-02  5:07 ` [PATCH 11/18] btrfs: root->fs_info cleanup, lock/unlock_chunks jeffm
2016-12-02  5:07 ` [PATCH 12/18] btrfs: root->fs_info cleanup, update_block_group{,flags} jeffm
2016-12-02  5:07 ` [PATCH 14/18] btrfs: root->fs_info cleanup, access fs_info->delayed_root directly jeffm
2016-12-02  5:07 ` [PATCH 15/18] btrfs: convert extent-tree tracepoints to use fs_info jeffm
2016-12-02  5:07 ` [PATCH 16/18] btrfs: simplify btrfs_wait_cache_io prototype jeffm
2016-12-02  5:07 ` [PATCH 18/18] btrfs: split btrfs_wait_marked_extents into normal and tree log functions jeffm

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=1480655258-15400-7-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).