From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH v3 04/15] btrfs: push lookup_info into walk_control
Date: Tue, 7 May 2024 14:12:05 -0400 [thread overview]
Message-ID: <b992b63c3a90a2234f7ea77feb66c663137d4747.1715105406.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1715105406.git.josef@toxicpanda.com>
Instead of using a flag we're passing around everywhere, add a field to
walk_control that we're already passing around everywhere and use that
instead.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
fs/btrfs/extent-tree.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index fa59a0b5bc2d..1d59764f58b4 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -5220,6 +5220,7 @@ struct walk_control {
int reada_slot;
int reada_count;
int restarted;
+ int lookup_info;
};
#define DROP_REFERENCE 1
@@ -5316,7 +5317,7 @@ static noinline void reada_walk_down(struct btrfs_trans_handle *trans,
static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
- struct walk_control *wc, int lookup_info)
+ struct walk_control *wc)
{
struct btrfs_fs_info *fs_info = root->fs_info;
int level = wc->level;
@@ -5331,7 +5332,7 @@ static noinline int walk_down_proc(struct btrfs_trans_handle *trans,
* when reference count of tree block is 1, it won't increase
* again. once full backref flag is set, we never clear it.
*/
- if (lookup_info &&
+ if (wc->lookup_info &&
((wc->stage == DROP_REFERENCE && wc->refs[level] != 1) ||
(wc->stage == UPDATE_BACKREF && !(wc->flags[level] & flag)))) {
BUG_ON(!path->locks[level]);
@@ -5423,7 +5424,7 @@ static int check_ref_exists(struct btrfs_trans_handle *trans,
static noinline int do_walk_down(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
- struct walk_control *wc, int *lookup_info)
+ struct walk_control *wc)
{
struct btrfs_fs_info *fs_info = root->fs_info;
u64 bytenr;
@@ -5445,7 +5446,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
*/
if (wc->stage == UPDATE_BACKREF &&
generation <= root->root_key.offset) {
- *lookup_info = 1;
+ wc->lookup_info = 1;
return 1;
}
@@ -5477,7 +5478,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
ret = -EIO;
goto out_unlock;
}
- *lookup_info = 0;
+ wc->lookup_info = 0;
if (wc->stage == DROP_REFERENCE) {
if (wc->refs[level - 1] > 1) {
@@ -5515,7 +5516,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
return ret;
}
btrfs_tree_lock(next);
- *lookup_info = 1;
+ wc->lookup_info = 1;
}
level--;
@@ -5604,7 +5605,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
goto out_unlock;
}
no_delete:
- *lookup_info = 1;
+ wc->lookup_info = 1;
ret = 1;
out_unlock:
@@ -5738,11 +5739,11 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
struct walk_control *wc)
{
int level = wc->level;
- int lookup_info = 1;
int ret = 0;
+ wc->lookup_info = 1;
while (level >= 0) {
- ret = walk_down_proc(trans, root, path, wc, lookup_info);
+ ret = walk_down_proc(trans, root, path, wc);
if (ret)
break;
@@ -5753,7 +5754,7 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
btrfs_header_nritems(path->nodes[level]))
break;
- ret = do_walk_down(trans, root, path, wc, &lookup_info);
+ ret = do_walk_down(trans, root, path, wc);
if (ret > 0) {
path->slots[level]++;
continue;
--
2.43.0
next prev parent reply other threads:[~2024-05-07 18:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-07 18:12 [PATCH v3 00/15] btrfs: snapshot delete cleanups Josef Bacik
2024-05-07 18:12 ` [PATCH v3 01/15] btrfs: don't do find_extent_buffer in do_walk_down Josef Bacik
2024-05-07 18:12 ` [PATCH v3 02/15] btrfs: remove all extra btrfs_check_eb_owner() calls Josef Bacik
2024-05-07 20:39 ` Qu Wenruo
2024-05-07 18:12 ` [PATCH v3 03/15] btrfs: use btrfs_read_extent_buffer in do_walk_down Josef Bacik
2024-05-07 18:12 ` Josef Bacik [this message]
2024-05-07 18:12 ` [PATCH v3 05/15] btrfs: move the eb uptodate code into it's own helper Josef Bacik
2024-05-07 18:12 ` [PATCH v3 06/15] btrfs: remove need_account in do_walk_down Josef Bacik
2024-05-07 18:12 ` [PATCH v3 07/15] btrfs: unify logic to decide if we need to walk down into a node Josef Bacik
2024-05-07 18:12 ` [PATCH v3 08/15] btrfs: extract the reference dropping code into it's own helper Josef Bacik
2024-05-07 18:12 ` [PATCH v3 09/15] btrfs: don't BUG_ON ENOMEM in walk_down_proc Josef Bacik
2024-05-07 18:12 ` [PATCH v3 10/15] btrfs: handle errors from ref mods during UPDATE_BACKREF Josef Bacik
2024-05-07 18:12 ` [PATCH v3 11/15] btrfs: replace BUG_ON with ASSERT in walk_down_proc Josef Bacik
2024-05-07 18:12 ` [PATCH v3 12/15] btrfs: clean up our handling of refs == 0 in snapshot delete Josef Bacik
2024-05-07 18:12 ` [PATCH v3 13/15] btrfs: convert correctness BUG_ON()'s to ASSERT()'s in walk_up_proc Josef Bacik
2024-05-07 18:12 ` [PATCH v3 14/15] btrfs: handle errors from btrfs_dec_ref properly Josef Bacik
2024-05-07 18:12 ` [PATCH v3 15/15] btrfs: add documentation around snapshot delete Josef Bacik
2024-05-15 18:18 ` [PATCH v3 00/15] btrfs: snapshot delete cleanups 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=b992b63c3a90a2234f7ea77feb66c663137d4747.1715105406.git.josef@toxicpanda.com \
--to=josef@toxicpanda.com \
--cc=kernel-team@fb.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).