linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: [PATCH 11/38] btrfs-progs: update btrfs_extend_item to match the kernel definition
Date: Wed, 23 Aug 2023 10:32:37 -0400	[thread overview]
Message-ID: <0d67f505513af33ba9d49bb3242cc0884b89a370.1692800904.git.josef@toxicpanda.com> (raw)
In-Reply-To: <cover.1692800904.git.josef@toxicpanda.com>

Similar to btrfs_truncate_item(), this is void in the kernel as the
failure case is simply BUG_ON().  Additionally there is no root
parameter as it's not used in the function at all.  Make these changes
and update the callers.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 kernel-shared/ctree.c       | 8 ++------
 kernel-shared/ctree.h       | 3 +--
 kernel-shared/dir-item.c    | 4 ++--
 kernel-shared/extent-tree.c | 4 +---
 kernel-shared/file-item.c   | 3 +--
 kernel-shared/inode-item.c  | 5 ++---
 6 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/kernel-shared/ctree.c b/kernel-shared/ctree.c
index b5d3d12e..ed8a7002 100644
--- a/kernel-shared/ctree.c
+++ b/kernel-shared/ctree.c
@@ -2661,10 +2661,8 @@ void btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end)
 	}
 }
 
-int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
-		      u32 data_size)
+void btrfs_extend_item(struct btrfs_path *path, u32 data_size)
 {
-	int ret = 0;
 	int slot;
 	struct extent_buffer *leaf;
 	u32 nritems;
@@ -2712,12 +2710,10 @@ int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
 	btrfs_set_item_size(leaf, slot, old_size + data_size);
 	btrfs_mark_buffer_dirty(leaf);
 
-	ret = 0;
 	if (btrfs_leaf_free_space(leaf) < 0) {
 		btrfs_print_leaf(leaf);
 		BUG();
 	}
-	return ret;
 }
 
 /*
@@ -3366,7 +3362,7 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
 		 * ret == -EEXIST case, An item with that type already exists.
 		 * Extend the item and store the new subvol_id at the end.
 		 */
-		btrfs_extend_item(uuid_root, path, sizeof(subvol_id_le));
+		btrfs_extend_item(path, sizeof(subvol_id_le));
 		eb = path->nodes[0];
 		slot = path->slots[0];
 		offset = btrfs_item_ptr_offset(eb, slot);
diff --git a/kernel-shared/ctree.h b/kernel-shared/ctree.h
index 81d71d36..c7321a40 100644
--- a/kernel-shared/ctree.h
+++ b/kernel-shared/ctree.h
@@ -968,8 +968,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
 		      struct extent_buffer **cow_ret, u64 new_root_objectid);
 int btrfs_create_root(struct btrfs_trans_handle *trans,
 		      struct btrfs_fs_info *fs_info, u64 objectid);
-int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
-		u32 data_size);
+void btrfs_extend_item(struct btrfs_path *path, u32 data_size);
 void btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end);
 int btrfs_split_item(struct btrfs_trans_handle *trans,
 		     struct btrfs_root *root,
diff --git a/kernel-shared/dir-item.c b/kernel-shared/dir-item.c
index abf7d047..cb70d7c8 100644
--- a/kernel-shared/dir-item.c
+++ b/kernel-shared/dir-item.c
@@ -48,8 +48,8 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
 		di = btrfs_match_dir_item_name(root, path, name, name_len);
 		if (di)
 			return ERR_PTR(-EEXIST);
-		ret = btrfs_extend_item(root, path, data_size);
-		WARN_ON(ret > 0);
+		btrfs_extend_item(path, data_size);
+		ret = 0;
 	}
 	if (ret < 0)
 		return ERR_PTR(ret);
diff --git a/kernel-shared/extent-tree.c b/kernel-shared/extent-tree.c
index 001cffd1..543a9952 100644
--- a/kernel-shared/extent-tree.c
+++ b/kernel-shared/extent-tree.c
@@ -1039,7 +1039,6 @@ static int setup_inline_extent_backref(struct btrfs_root *root,
 	u64 refs;
 	int size;
 	int type;
-	int ret;
 
 	leaf = path->nodes[0];
 	ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item);
@@ -1048,8 +1047,7 @@ static int setup_inline_extent_backref(struct btrfs_root *root,
 	type = extent_ref_type(parent, owner);
 	size = btrfs_extent_inline_ref_size(type);
 
-	ret = btrfs_extend_item(root, path, size);
-	BUG_ON(ret);
+	btrfs_extend_item(path, size);
 
 	ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item);
 	refs = btrfs_extent_refs(leaf, ei);
diff --git a/kernel-shared/file-item.c b/kernel-shared/file-item.c
index e23e679e..7baa5614 100644
--- a/kernel-shared/file-item.c
+++ b/kernel-shared/file-item.c
@@ -282,8 +282,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans, u64 logical,
 		diff = diff - btrfs_item_size(leaf, path->slots[0]);
 		if (diff != csum_size)
 			goto insert;
-		ret = btrfs_extend_item(root, path, diff);
-		BUG_ON(ret);
+		btrfs_extend_item(path, diff);
 		goto csum;
 	}
 
diff --git a/kernel-shared/inode-item.c b/kernel-shared/inode-item.c
index 891ae40a..d0705267 100644
--- a/kernel-shared/inode-item.c
+++ b/kernel-shared/inode-item.c
@@ -78,8 +78,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
 			goto out;
 
 		old_size = btrfs_item_size(path->nodes[0], path->slots[0]);
-		ret = btrfs_extend_item(root, path, ins_len);
-		BUG_ON(ret);
+		btrfs_extend_item(path, ins_len);
 		ref = btrfs_item_ptr(path->nodes[0], path->slots[0],
 				     struct btrfs_inode_ref);
 		ref = (struct btrfs_inode_ref *)((unsigned long)ref + old_size);
@@ -352,7 +351,7 @@ int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans,
 						   name, name_len, NULL))
 			goto out;
 
-		btrfs_extend_item(root, path, ins_len);
+		btrfs_extend_item(path, ins_len);
 		ret = 0;
 	}
 
-- 
2.41.0


  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 ` [PATCH 06/38] btrfs-progs: update read_node_slot to match the kernel definition Josef Bacik
2023-08-23 14:32 ` [PATCH 07/38] btrfs-progs: update btrfs_bin_search " 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 ` Josef Bacik [this message]
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=0d67f505513af33ba9d49bb3242cc0884b89a370.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).