From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 06/38] btrfs-progs: update read_node_slot to match the kernel definition
Date: Wed, 23 Aug 2023 10:32:32 -0400 [thread overview]
Message-ID: <49aa985e67a6ee803cbbfa1992b4ec03e9eb7c6d.1692800904.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1692800904.git.josef@toxicpanda.com>
In the kernel this is called btrfs_read_node_slot, and it doesn't take a
btrfs_fs_info. Update the btrfs-progs version to match the kernel and
update all of the callers.
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
cmds/restore.c | 5 ++---
kernel-shared/ctree.c | 32 +++++++++++++++-----------------
kernel-shared/ctree.h | 4 ++--
kernel-shared/print-tree.c | 2 +-
4 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/cmds/restore.c b/cmds/restore.c
index 7a360645..ba085f94 100644
--- a/cmds/restore.c
+++ b/cmds/restore.c
@@ -240,7 +240,6 @@ static int next_leaf(struct btrfs_root *root, struct btrfs_path *path)
int offset = 1;
struct extent_buffer *c;
struct extent_buffer *next = NULL;
- struct btrfs_fs_info *fs_info = root->fs_info;
again:
for (; level < BTRFS_MAX_LEVEL; level++) {
@@ -267,7 +266,7 @@ again:
continue;
}
- next = read_node_slot(fs_info, c, slot);
+ next = btrfs_read_node_slot(c, slot);
if (extent_buffer_uptodate(next))
break;
offset++;
@@ -281,7 +280,7 @@ again:
path->slots[level] = 0;
if (!level)
break;
- next = read_node_slot(fs_info, next, 0);
+ next = btrfs_read_node_slot(next, 0);
if (!extent_buffer_uptodate(next))
goto again;
}
diff --git a/kernel-shared/ctree.c b/kernel-shared/ctree.c
index a87a79b2..3b703f7c 100644
--- a/kernel-shared/ctree.c
+++ b/kernel-shared/ctree.c
@@ -833,9 +833,10 @@ int btrfs_bin_search(struct extent_buffer *eb, const struct btrfs_key *key,
slot);
}
-struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,
- struct extent_buffer *parent, int slot)
+struct extent_buffer *btrfs_read_node_slot(struct extent_buffer *parent,
+ int slot)
{
+ struct btrfs_fs_info *fs_info = parent->fs_info;
struct extent_buffer *ret;
int level = btrfs_header_level(parent);
@@ -909,7 +910,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
return 0;
/* promote the child to a root */
- child = read_node_slot(fs_info, mid, 0);
+ child = btrfs_read_node_slot(mid, 0);
BUG_ON(!extent_buffer_uptodate(child));
ret = btrfs_cow_block(trans, root, child, mid, 0, &child);
BUG_ON(ret);
@@ -933,7 +934,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
BTRFS_NODEPTRS_PER_BLOCK(fs_info) / 4)
return 0;
- left = read_node_slot(fs_info, parent, pslot - 1);
+ left = btrfs_read_node_slot(parent, pslot - 1);
if (extent_buffer_uptodate(left)) {
wret = btrfs_cow_block(trans, root, left,
parent, pslot - 1, &left);
@@ -942,7 +943,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
goto enospc;
}
}
- right = read_node_slot(fs_info, parent, pslot + 1);
+ right = btrfs_read_node_slot(parent, pslot + 1);
if (extent_buffer_uptodate(right)) {
wret = btrfs_cow_block(trans, root, right,
parent, pslot + 1, &right);
@@ -1097,7 +1098,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
if (!parent)
return 1;
- left = read_node_slot(fs_info, parent, pslot - 1);
+ left = btrfs_read_node_slot(parent, pslot - 1);
/* first, try to make some room in the middle buffer */
if (extent_buffer_uptodate(left)) {
@@ -1137,7 +1138,7 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
}
free_extent_buffer(left);
}
- right= read_node_slot(fs_info, parent, pslot + 1);
+ right= btrfs_read_node_slot(parent, pslot + 1);
/*
* then try to empty the right most buffer into the middle
@@ -1389,7 +1390,7 @@ again:
reada_for_search(fs_info, p, level, slot,
key->objectid);
- b = read_node_slot(fs_info, b, slot);
+ b = btrfs_read_node_slot(b, slot);
if (!extent_buffer_uptodate(b))
return -EIO;
} else {
@@ -1941,7 +1942,6 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
struct extent_buffer *right;
struct extent_buffer *upper;
struct btrfs_disk_key disk_key;
- struct btrfs_fs_info *fs_info = root->fs_info;
int slot;
u32 i;
int free_space;
@@ -1962,7 +1962,7 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
if (slot >= btrfs_header_nritems(upper) - 1)
return 1;
- right = read_node_slot(fs_info, upper, slot + 1);
+ right = btrfs_read_node_slot(upper, slot + 1);
if (!extent_buffer_uptodate(right)) {
if (IS_ERR(right))
return PTR_ERR(right);
@@ -2090,7 +2090,6 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
struct btrfs_disk_key disk_key;
struct extent_buffer *right = path->nodes[0];
struct extent_buffer *left;
- struct btrfs_fs_info *fs_info = root->fs_info;
int slot;
int i;
int free_space;
@@ -2114,7 +2113,7 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
return 1;
}
- left = read_node_slot(fs_info, path->nodes[1], slot - 1);
+ left = btrfs_read_node_slot(path->nodes[1], slot - 1);
free_space = btrfs_leaf_free_space(left);
if (free_space < data_size) {
free_extent_buffer(left);
@@ -3046,7 +3045,6 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
int level = 1;
struct extent_buffer *c;
struct extent_buffer *next = NULL;
- struct btrfs_fs_info *fs_info = root->fs_info;
while(level < BTRFS_MAX_LEVEL) {
if (!path->nodes[level])
@@ -3062,7 +3060,7 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
}
slot--;
- next = read_node_slot(fs_info, c, slot);
+ next = btrfs_read_node_slot(c, slot);
if (!extent_buffer_uptodate(next)) {
if (IS_ERR(next))
return PTR_ERR(next);
@@ -3082,7 +3080,7 @@ int btrfs_prev_leaf(struct btrfs_root *root, struct btrfs_path *path)
path->slots[level] = slot;
if (!level)
break;
- next = read_node_slot(fs_info, next, slot);
+ next = btrfs_read_node_slot(next, slot);
if (!extent_buffer_uptodate(next)) {
if (IS_ERR(next))
return PTR_ERR(next);
@@ -3125,7 +3123,7 @@ int btrfs_next_sibling_tree_block(struct btrfs_fs_info *fs_info,
if (path->reada)
reada_for_search(fs_info, path, level, slot, 0);
- next = read_node_slot(fs_info, c, slot);
+ next = btrfs_read_node_slot(c, slot);
if (!extent_buffer_uptodate(next))
return -EIO;
break;
@@ -3148,7 +3146,7 @@ int btrfs_next_sibling_tree_block(struct btrfs_fs_info *fs_info,
break;
if (path->reada)
reada_for_search(fs_info, path, level, 0, 0);
- next = read_node_slot(fs_info, next, 0);
+ next = btrfs_read_node_slot(next, 0);
if (!extent_buffer_uptodate(next))
return -EIO;
}
diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index 15ac310e..dc11b246 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -949,8 +949,8 @@ int btrfs_convert_one_bg(struct btrfs_trans_handle *trans, u64 bytenr);
int btrfs_comp_cpu_keys(const struct btrfs_key *k1, const struct btrfs_key *k2);
int btrfs_del_ptr(struct btrfs_root *root, struct btrfs_path *path,
int level, int slot);
-struct extent_buffer *read_node_slot(struct btrfs_fs_info *fs_info,
- struct extent_buffer *parent, int slot);
+struct extent_buffer *btrfs_read_node_slot(struct extent_buffer *parent,
+ int slot);
int btrfs_previous_item(struct btrfs_root *root,
struct btrfs_path *path, u64 min_objectid,
int type);
diff --git a/kernel-shared/print-tree.c b/kernel-shared/print-tree.c
index d7ffeccd..38524971 100644
--- a/kernel-shared/print-tree.c
+++ b/kernel-shared/print-tree.c
@@ -1494,7 +1494,7 @@ static int search_leftmost_tree_block(struct btrfs_fs_info *fs_info,
struct extent_buffer *eb;
path->slots[i] = 0;
- eb = read_node_slot(fs_info, path->nodes[i], 0);
+ eb = btrfs_read_node_slot(path->nodes[i], 0);
if (!extent_buffer_uptodate(eb)) {
ret = -EIO;
goto out;
--
2.41.0
next prev parent reply other threads:[~2023-08-23 14:33 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 14:32 [PATCH 00/38] btrfs-progs: sync ctree.c into btrfs-progs Josef Bacik
2023-08-23 14:32 ` [PATCH 01/38] btrfs-progs: stop using add_root_to_dirty_list in check Josef Bacik
2023-08-23 14:32 ` [PATCH 02/38] btrfs-progs: remove useless add_root_to_dirty_list call in mkfs Josef Bacik
2023-08-29 6:32 ` Qu Wenruo
2023-08-29 6:42 ` Qu Wenruo
2023-08-23 14:32 ` [PATCH 03/38] btrfs-progs: remove add_root_to_dirty_list call when creating free space tree Josef Bacik
2023-08-23 14:32 ` [PATCH 04/38] btrfs-progs: make add_root_to_dirty_list static and unexport it Josef Bacik
2023-08-23 14:32 ` [PATCH 05/38] btrfs-progs: pass btrfs_trans_handle through btrfs_clear_buffer_dirty Josef Bacik
2023-08-23 14:32 ` Josef Bacik [this message]
2023-08-23 14:32 ` [PATCH 07/38] btrfs-progs: update btrfs_bin_search to match the kernel definition Josef Bacik
2023-08-23 14:32 ` [PATCH 08/38] btrfs-progs: update btrfs_set_item_key_safe to match " Josef Bacik
2023-08-23 14:32 ` [PATCH 09/38] btrfs-progs: update btrfs_print_leaf to match the " Josef Bacik
2023-08-23 14:32 ` [PATCH 10/38] btrfs-progs: update btrfs_truncate_item " Josef Bacik
2023-08-23 14:32 ` [PATCH 11/38] btrfs-progs: update btrfs_extend_item " Josef Bacik
2023-08-23 14:32 ` [PATCH 12/38] btrfs-progs: sync memcpy_extent_buffer from the kernel Josef Bacik
2023-08-23 14:32 ` [PATCH 13/38] btrfs-progs: drop btrfs_init_path Josef Bacik
2023-08-23 17:25 ` David Sterba
2023-08-23 14:32 ` [PATCH 14/38] btrfs-progs: move btrfs_set_item_key_unsafe to check/ Josef Bacik
2023-08-23 14:32 ` [PATCH 15/38] btrfs-progs: move btrfs_record_file_extent and code into a new file Josef Bacik
2023-08-23 14:32 ` [PATCH 16/38] btrfs-progs: make a local copy of btrfs_next_sibling_block in print-tree.c Josef Bacik
2023-08-23 14:32 ` [PATCH 17/38] btrfs-progs: don't set the ->commit_root in btrfs_create_tree Josef Bacik
2023-08-23 14:32 ` [PATCH 18/38] btrfs-progs: remove btrfs_create_root Josef Bacik
2023-08-23 14:32 ` [PATCH 19/38] btrfs-progs: move btrfs_uuid_tree_add into mkfs/main.c Josef Bacik
2023-08-23 14:32 ` [PATCH 20/38] btrfs-progs: make btrfs_del_ptr a void Josef Bacik
2023-08-23 14:32 ` [PATCH 21/38] btrfs-progs: replace blocksize with parent argument for btrfs_alloc_tree_block Josef Bacik
2023-08-23 14:32 ` [PATCH 22/38] btrfs-progs: use path->search_for_extension Josef Bacik
2023-08-23 14:32 ` [PATCH 23/38] btrfs-progs: init new tree blocks in btrfs_alloc_tree_block Josef Bacik
2023-08-23 14:32 ` [PATCH 24/38] btrfs-progs: add dwarves to the package list for ci Josef Bacik
2023-08-23 14:32 ` [PATCH 25/38] btrfs-progs: add kerncompat helpers for ctree.c sync Josef Bacik
2023-08-23 14:32 ` [PATCH 26/38] btrfs-progs: add trans_lock to fs_info Josef Bacik
2023-08-23 14:32 ` [PATCH 27/38] btrfs-progs: add commit_root_sem to btrfs_fs_info Josef Bacik
2023-08-23 14:32 ` [PATCH 28/38] btrfs-progs: update btrfs_cow_block to match the in-kernel definition Josef Bacik
2023-08-23 14:32 ` [PATCH 29/38] btrfs-progs: update btrfs_insert_empty_items to match the kernel Josef Bacik
2023-08-23 14:32 ` [PATCH 30/38] btrfs-progs: update btrfs_insert_empty_item " Josef Bacik
2023-08-23 14:32 ` [PATCH 31/38] btrfs-progs: update btrfs_del_ptr " Josef Bacik
2023-08-23 14:32 ` [PATCH 32/38] btrfs-progs: update btrfs_insert_item " Josef Bacik
2023-08-23 14:32 ` [PATCH 33/38] btrfs-progs: update btrfs_leaf_free_space " Josef Bacik
2023-08-23 14:33 ` [PATCH 34/38] btrfs-progs: use btrfs_tree_parent_check for btrfs_read_extent_buffer Josef Bacik
2023-08-23 14:33 ` [PATCH 35/38] btrfs-progs: update read_tree_block to take a btrfs_parent_tree_check Josef Bacik
2023-08-23 14:33 ` [PATCH 36/38] btrfs-progs: inline btrfs_name_hash and btrfs_extref_hash Josef Bacik
2023-08-23 14:33 ` [PATCH 37/38] btrfs-progs: update btrfs_split_item to match the in-kernel definition Josef Bacik
2023-08-23 14:33 ` [PATCH 38/38] btrfs-progs: sync ctree.c from kernel Josef Bacik
2023-08-23 17:41 ` [PATCH 00/38] btrfs-progs: sync ctree.c into btrfs-progs David Sterba
2023-08-25 21:35 ` 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=49aa985e67a6ee803cbbfa1992b4ec03e9eb7c6d.1692800904.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).