All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] btrfs: some trivial cleanups
@ 2025-03-07 13:44 fdmanana
  2025-03-07 13:44 ` [PATCH 1/8] btrfs: return a btrfs_inode from btrfs_iget_logging() fdmanana
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: fdmanana @ 2025-03-07 13:44 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

A group of trivial cleanups that started with making log tree code
less verbose while fixing a couple bugs, by removing repeated BTRFS_I()
calls, and then extended to btrfs_iget() and removing redundant arguments
from a few functions. Details in the change logs.

Filipe Manana (8):
  btrfs: return a btrfs_inode from btrfs_iget_logging()
  btrfs: return a btrfs_inode from read_one_inode()
  btrfs: pass a btrfs_inode to fixup_inode_link_count()
  btrfs: make btrfs_iget() return a btrfs inode instead
  btrfs: make btrfs_iget_path() return a btrfs inode instead
  btrfs: remove unnecessary fs_info argument from create_reloc_inode()
  btrfs: remove unnecessary fs_info argument from delete_block_group_cache()
  btrfs: remove unnecessary fs_info argument from btrfs_add_block_group_cache()

 fs/btrfs/block-group.c      |  16 +--
 fs/btrfs/btrfs_inode.h      |   6 +-
 fs/btrfs/defrag.c           |  14 +-
 fs/btrfs/export.c           |  17 ++-
 fs/btrfs/free-space-cache.c |  10 +-
 fs/btrfs/inode.c            |  64 ++++-----
 fs/btrfs/ioctl.c            |   7 +-
 fs/btrfs/relocation.c       |  30 +++--
 fs/btrfs/send.c             |  25 ++--
 fs/btrfs/super.c            |   4 +-
 fs/btrfs/tree-log.c         | 261 +++++++++++++++++-------------------
 11 files changed, 225 insertions(+), 229 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/8] btrfs: return a btrfs_inode from btrfs_iget_logging()
  2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
@ 2025-03-07 13:44 ` fdmanana
  2025-03-07 13:44 ` [PATCH 2/8] btrfs: return a btrfs_inode from read_one_inode() fdmanana
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: fdmanana @ 2025-03-07 13:44 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

All callers of btrfs_iget_logging() are interested in the btrfs_inode
structure rather than the VFS inode, so make btrfs_iget_logging() return
the btrfs_inode instead, avoiding lots of BTRFS_I() calls.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/tree-log.c | 94 ++++++++++++++++++++++-----------------------
 1 file changed, 45 insertions(+), 49 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index fc5c761181eb..fc13dbfb96f8 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -138,7 +138,7 @@ static void wait_log_commit(struct btrfs_root *root, int transid);
  * and once to do all the other items.
  */
 
-static struct inode *btrfs_iget_logging(u64 objectid, struct btrfs_root *root)
+static struct btrfs_inode *btrfs_iget_logging(u64 objectid, struct btrfs_root *root)
 {
 	unsigned int nofs_flag;
 	struct inode *inode;
@@ -154,7 +154,10 @@ static struct inode *btrfs_iget_logging(u64 objectid, struct btrfs_root *root)
 	inode = btrfs_iget(objectid, root);
 	memalloc_nofs_restore(nofs_flag);
 
-	return inode;
+	if (IS_ERR(inode))
+		return ERR_CAST(inode);
+
+	return BTRFS_I(inode);
 }
 
 /*
@@ -616,12 +619,12 @@ static int read_alloc_one_name(struct extent_buffer *eb, void *start, int len,
 static noinline struct inode *read_one_inode(struct btrfs_root *root,
 					     u64 objectid)
 {
-	struct inode *inode;
+	struct btrfs_inode *inode;
 
 	inode = btrfs_iget_logging(objectid, root);
 	if (IS_ERR(inode))
-		inode = NULL;
-	return inode;
+		return NULL;
+	return &inode->vfs_inode;
 }
 
 /* replays a single extent in 'eb' at 'slot' with 'key' into the
@@ -5481,7 +5484,6 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
 	ihold(&curr_inode->vfs_inode);
 
 	while (true) {
-		struct inode *vfs_inode;
 		struct btrfs_key key;
 		struct btrfs_key found_key;
 		u64 next_index;
@@ -5497,7 +5499,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
 			struct extent_buffer *leaf = path->nodes[0];
 			struct btrfs_dir_item *di;
 			struct btrfs_key di_key;
-			struct inode *di_inode;
+			struct btrfs_inode *di_inode;
 			int log_mode = LOG_INODE_EXISTS;
 			int type;
 
@@ -5524,17 +5526,16 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
 				goto out;
 			}
 
-			if (!need_log_inode(trans, BTRFS_I(di_inode))) {
-				btrfs_add_delayed_iput(BTRFS_I(di_inode));
+			if (!need_log_inode(trans, di_inode)) {
+				btrfs_add_delayed_iput(di_inode);
 				break;
 			}
 
 			ctx->log_new_dentries = false;
 			if (type == BTRFS_FT_DIR)
 				log_mode = LOG_INODE_ALL;
-			ret = btrfs_log_inode(trans, BTRFS_I(di_inode),
-					      log_mode, ctx);
-			btrfs_add_delayed_iput(BTRFS_I(di_inode));
+			ret = btrfs_log_inode(trans, di_inode, log_mode, ctx);
+			btrfs_add_delayed_iput(di_inode);
 			if (ret)
 				goto out;
 			if (ctx->log_new_dentries) {
@@ -5576,14 +5577,13 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
 		kfree(dir_elem);
 
 		btrfs_add_delayed_iput(curr_inode);
-		curr_inode = NULL;
 
-		vfs_inode = btrfs_iget_logging(ino, root);
-		if (IS_ERR(vfs_inode)) {
-			ret = PTR_ERR(vfs_inode);
+		curr_inode = btrfs_iget_logging(ino, root);
+		if (IS_ERR(curr_inode)) {
+			ret = PTR_ERR(curr_inode);
+			curr_inode = NULL;
 			break;
 		}
-		curr_inode = BTRFS_I(vfs_inode);
 	}
 out:
 	btrfs_free_path(path);
@@ -5661,7 +5661,7 @@ static int add_conflicting_inode(struct btrfs_trans_handle *trans,
 				 struct btrfs_log_ctx *ctx)
 {
 	struct btrfs_ino_list *ino_elem;
-	struct inode *inode;
+	struct btrfs_inode *inode;
 
 	/*
 	 * It's rare to have a lot of conflicting inodes, in practice it is not
@@ -5752,12 +5752,12 @@ static int add_conflicting_inode(struct btrfs_trans_handle *trans,
 	 * inode in LOG_INODE_EXISTS mode and rename operations update the log,
 	 * so that the log ends up with the new name and without the old name.
 	 */
-	if (!need_log_inode(trans, BTRFS_I(inode))) {
-		btrfs_add_delayed_iput(BTRFS_I(inode));
+	if (!need_log_inode(trans, inode)) {
+		btrfs_add_delayed_iput(inode);
 		return 0;
 	}
 
-	btrfs_add_delayed_iput(BTRFS_I(inode));
+	btrfs_add_delayed_iput(inode);
 
 	ino_elem = kmalloc(sizeof(*ino_elem), GFP_NOFS);
 	if (!ino_elem)
@@ -5793,7 +5793,7 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,
 	 */
 	while (!list_empty(&ctx->conflict_inodes)) {
 		struct btrfs_ino_list *curr;
-		struct inode *inode;
+		struct btrfs_inode *inode;
 		u64 ino;
 		u64 parent;
 
@@ -5829,9 +5829,8 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,
 			 * dir index key range logged for the directory. So we
 			 * must make sure the deletion is recorded.
 			 */
-			ret = btrfs_log_inode(trans, BTRFS_I(inode),
-					      LOG_INODE_ALL, ctx);
-			btrfs_add_delayed_iput(BTRFS_I(inode));
+			ret = btrfs_log_inode(trans, inode, LOG_INODE_ALL, ctx);
+			btrfs_add_delayed_iput(inode);
 			if (ret)
 				break;
 			continue;
@@ -5847,8 +5846,8 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,
 		 * it again because if some other task logged the inode after
 		 * that, we can avoid doing it again.
 		 */
-		if (!need_log_inode(trans, BTRFS_I(inode))) {
-			btrfs_add_delayed_iput(BTRFS_I(inode));
+		if (!need_log_inode(trans, inode)) {
+			btrfs_add_delayed_iput(inode);
 			continue;
 		}
 
@@ -5859,8 +5858,8 @@ static int log_conflicting_inodes(struct btrfs_trans_handle *trans,
 		 * well because during a rename we pin the log and update the
 		 * log with the new name before we unpin it.
 		 */
-		ret = btrfs_log_inode(trans, BTRFS_I(inode), LOG_INODE_EXISTS, ctx);
-		btrfs_add_delayed_iput(BTRFS_I(inode));
+		ret = btrfs_log_inode(trans, inode, LOG_INODE_EXISTS, ctx);
+		btrfs_add_delayed_iput(inode);
 		if (ret)
 			break;
 	}
@@ -6351,7 +6350,7 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans,
 
 	list_for_each_entry(item, delayed_ins_list, log_list) {
 		struct btrfs_dir_item *dir_item;
-		struct inode *di_inode;
+		struct btrfs_inode *di_inode;
 		struct btrfs_key key;
 		int log_mode = LOG_INODE_EXISTS;
 
@@ -6367,8 +6366,8 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans,
 			break;
 		}
 
-		if (!need_log_inode(trans, BTRFS_I(di_inode))) {
-			btrfs_add_delayed_iput(BTRFS_I(di_inode));
+		if (!need_log_inode(trans, di_inode)) {
+			btrfs_add_delayed_iput(di_inode);
 			continue;
 		}
 
@@ -6376,12 +6375,12 @@ static int log_new_delayed_dentries(struct btrfs_trans_handle *trans,
 			log_mode = LOG_INODE_ALL;
 
 		ctx->log_new_dentries = false;
-		ret = btrfs_log_inode(trans, BTRFS_I(di_inode), log_mode, ctx);
+		ret = btrfs_log_inode(trans, di_inode, log_mode, ctx);
 
 		if (!ret && ctx->log_new_dentries)
-			ret = log_new_dir_dentries(trans, BTRFS_I(di_inode), ctx);
+			ret = log_new_dir_dentries(trans, di_inode, ctx);
 
-		btrfs_add_delayed_iput(BTRFS_I(di_inode));
+		btrfs_add_delayed_iput(di_inode);
 
 		if (ret)
 			break;
@@ -6789,7 +6788,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
 		ptr = btrfs_item_ptr_offset(leaf, slot);
 		while (cur_offset < item_size) {
 			struct btrfs_key inode_key;
-			struct inode *dir_inode;
+			struct btrfs_inode *dir_inode;
 
 			inode_key.type = BTRFS_INODE_ITEM_KEY;
 			inode_key.offset = 0;
@@ -6838,18 +6837,16 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
 				goto out;
 			}
 
-			if (!need_log_inode(trans, BTRFS_I(dir_inode))) {
-				btrfs_add_delayed_iput(BTRFS_I(dir_inode));
+			if (!need_log_inode(trans, dir_inode)) {
+				btrfs_add_delayed_iput(dir_inode);
 				continue;
 			}
 
 			ctx->log_new_dentries = false;
-			ret = btrfs_log_inode(trans, BTRFS_I(dir_inode),
-					      LOG_INODE_ALL, ctx);
+			ret = btrfs_log_inode(trans, dir_inode, LOG_INODE_ALL, ctx);
 			if (!ret && ctx->log_new_dentries)
-				ret = log_new_dir_dentries(trans,
-						   BTRFS_I(dir_inode), ctx);
-			btrfs_add_delayed_iput(BTRFS_I(dir_inode));
+				ret = log_new_dir_dentries(trans, dir_inode, ctx);
+			btrfs_add_delayed_iput(dir_inode);
 			if (ret)
 				goto out;
 		}
@@ -6874,7 +6871,7 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans,
 		struct extent_buffer *leaf;
 		int slot;
 		struct btrfs_key search_key;
-		struct inode *inode;
+		struct btrfs_inode *inode;
 		u64 ino;
 		int ret = 0;
 
@@ -6889,11 +6886,10 @@ static int log_new_ancestors(struct btrfs_trans_handle *trans,
 		if (IS_ERR(inode))
 			return PTR_ERR(inode);
 
-		if (BTRFS_I(inode)->generation >= trans->transid &&
-		    need_log_inode(trans, BTRFS_I(inode)))
-			ret = btrfs_log_inode(trans, BTRFS_I(inode),
-					      LOG_INODE_EXISTS, ctx);
-		btrfs_add_delayed_iput(BTRFS_I(inode));
+		if (inode->generation >= trans->transid &&
+		    need_log_inode(trans, inode))
+			ret = btrfs_log_inode(trans, inode, LOG_INODE_EXISTS, ctx);
+		btrfs_add_delayed_iput(inode);
 		if (ret)
 			return ret;
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/8] btrfs: return a btrfs_inode from read_one_inode()
  2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
  2025-03-07 13:44 ` [PATCH 1/8] btrfs: return a btrfs_inode from btrfs_iget_logging() fdmanana
@ 2025-03-07 13:44 ` fdmanana
  2025-03-07 13:44 ` [PATCH 3/8] btrfs: pass a btrfs_inode to fixup_inode_link_count() fdmanana
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: fdmanana @ 2025-03-07 13:44 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

All callers of read_one_inode() are mostly interested in the btrfs_inode
structure rather than the VFS inode, so make read_one_inode() return
the btrfs_inode instead, avoiding lots of BTRFS_I() calls.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/tree-log.c | 152 +++++++++++++++++++++-----------------------
 1 file changed, 73 insertions(+), 79 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index fc13dbfb96f8..0df356e23762 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -616,15 +616,15 @@ static int read_alloc_one_name(struct extent_buffer *eb, void *start, int len,
  * simple helper to read an inode off the disk from a given root
  * This can only be called for subvolume roots and not for the log
  */
-static noinline struct inode *read_one_inode(struct btrfs_root *root,
-					     u64 objectid)
+static noinline struct btrfs_inode *read_one_inode(struct btrfs_root *root,
+						   u64 objectid)
 {
 	struct btrfs_inode *inode;
 
 	inode = btrfs_iget_logging(objectid, root);
 	if (IS_ERR(inode))
 		return NULL;
-	return &inode->vfs_inode;
+	return inode;
 }
 
 /* replays a single extent in 'eb' at 'slot' with 'key' into the
@@ -652,7 +652,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
 	u64 start = key->offset;
 	u64 nbytes = 0;
 	struct btrfs_file_extent_item *item;
-	struct inode *inode = NULL;
+	struct btrfs_inode *inode = NULL;
 	unsigned long size;
 	int ret = 0;
 
@@ -691,8 +691,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
 	 * file.  This must be done before the btrfs_drop_extents run
 	 * so we don't try to drop this extent.
 	 */
-	ret = btrfs_lookup_file_extent(trans, root, path,
-			btrfs_ino(BTRFS_I(inode)), start, 0);
+	ret = btrfs_lookup_file_extent(trans, root, path, btrfs_ino(inode), start, 0);
 
 	if (ret == 0 &&
 	    (found_type == BTRFS_FILE_EXTENT_REG ||
@@ -726,7 +725,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
 	drop_args.start = start;
 	drop_args.end = extent_end;
 	drop_args.drop_cache = true;
-	ret = btrfs_drop_extents(trans, root, BTRFS_I(inode), &drop_args);
+	ret = btrfs_drop_extents(trans, root, inode, &drop_args);
 	if (ret)
 		goto out;
 
@@ -904,16 +903,15 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
 			goto out;
 	}
 
-	ret = btrfs_inode_set_file_extent_range(BTRFS_I(inode), start,
-						extent_end - start);
+	ret = btrfs_inode_set_file_extent_range(inode, start, extent_end - start);
 	if (ret)
 		goto out;
 
 update_inode:
-	btrfs_update_inode_bytes(BTRFS_I(inode), nbytes, drop_args.bytes_found);
-	ret = btrfs_update_inode(trans, BTRFS_I(inode));
+	btrfs_update_inode_bytes(inode, nbytes, drop_args.bytes_found);
+	ret = btrfs_update_inode(trans, inode);
 out:
-	iput(inode);
+	iput(&inode->vfs_inode);
 	return ret;
 }
 
@@ -950,7 +948,7 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
 				      struct btrfs_dir_item *di)
 {
 	struct btrfs_root *root = dir->root;
-	struct inode *inode;
+	struct btrfs_inode *inode;
 	struct fscrypt_str name;
 	struct extent_buffer *leaf;
 	struct btrfs_key location;
@@ -975,10 +973,10 @@ static noinline int drop_one_dir_item(struct btrfs_trans_handle *trans,
 	if (ret)
 		goto out;
 
-	ret = unlink_inode_for_log_replay(trans, dir, BTRFS_I(inode), &name);
+	ret = unlink_inode_for_log_replay(trans, dir, inode, &name);
 out:
 	kfree(name.name);
-	iput(inode);
+	iput(&inode->vfs_inode);
 	return ret;
 }
 
@@ -1151,7 +1149,7 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
 		u32 item_size;
 		u32 cur_offset = 0;
 		unsigned long base;
-		struct inode *victim_parent;
+		struct btrfs_inode *victim_parent;
 
 		leaf = path->nodes[0];
 
@@ -1191,10 +1189,10 @@ static inline int __add_inode_ref(struct btrfs_trans_handle *trans,
 					btrfs_release_path(path);
 
 					ret = unlink_inode_for_log_replay(trans,
-							BTRFS_I(victim_parent),
+							victim_parent,
 							inode, &victim_name);
 				}
-				iput(victim_parent);
+				iput(&victim_parent->vfs_inode);
 				kfree(victim_name.name);
 				if (ret)
 					return ret;
@@ -1328,7 +1326,7 @@ static int unlink_old_inode_refs(struct btrfs_trans_handle *trans,
 			ret = !!btrfs_find_name_in_backref(log_eb, log_slot, &name);
 
 		if (!ret) {
-			struct inode *dir;
+			struct btrfs_inode *dir;
 
 			btrfs_release_path(path);
 			dir = read_one_inode(root, parent_id);
@@ -1337,10 +1335,9 @@ static int unlink_old_inode_refs(struct btrfs_trans_handle *trans,
 				kfree(name.name);
 				goto out;
 			}
-			ret = unlink_inode_for_log_replay(trans, BTRFS_I(dir),
-						 inode, &name);
+			ret = unlink_inode_for_log_replay(trans, dir, inode, &name);
 			kfree(name.name);
-			iput(dir);
+			iput(&dir->vfs_inode);
 			if (ret)
 				goto out;
 			goto again;
@@ -1372,8 +1369,8 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
 				  struct extent_buffer *eb, int slot,
 				  struct btrfs_key *key)
 {
-	struct inode *dir = NULL;
-	struct inode *inode = NULL;
+	struct btrfs_inode *dir = NULL;
+	struct btrfs_inode *inode = NULL;
 	unsigned long ref_ptr;
 	unsigned long ref_end;
 	struct fscrypt_str name = { 0 };
@@ -1438,8 +1435,8 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
 		if (ret)
 			goto out;
 
-		ret = inode_in_dir(root, path, btrfs_ino(BTRFS_I(dir)),
-				   btrfs_ino(BTRFS_I(inode)), ref_index, &name);
+		ret = inode_in_dir(root, path, btrfs_ino(dir), btrfs_ino(inode),
+				   ref_index, &name);
 		if (ret < 0) {
 			goto out;
 		} else if (ret == 0) {
@@ -1450,8 +1447,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
 			 * overwrite any existing back reference, and we don't
 			 * want to create dangling pointers in the directory.
 			 */
-			ret = __add_inode_ref(trans, root, path, log,
-					      BTRFS_I(dir), BTRFS_I(inode),
+			ret = __add_inode_ref(trans, root, path, log, dir, inode,
 					      inode_objectid, parent_objectid,
 					      ref_index, &name);
 			if (ret) {
@@ -1461,12 +1457,11 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
 			}
 
 			/* insert our name */
-			ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
-					     &name, 0, ref_index);
+			ret = btrfs_add_link(trans, dir, inode, &name, 0, ref_index);
 			if (ret)
 				goto out;
 
-			ret = btrfs_update_inode(trans, BTRFS_I(inode));
+			ret = btrfs_update_inode(trans, inode);
 			if (ret)
 				goto out;
 		}
@@ -1476,7 +1471,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
 		kfree(name.name);
 		name.name = NULL;
 		if (log_ref_ver) {
-			iput(dir);
+			iput(&dir->vfs_inode);
 			dir = NULL;
 		}
 	}
@@ -1489,8 +1484,7 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
 	 * dir index entries exist for a name but there is no inode reference
 	 * item with the same name.
 	 */
-	ret = unlink_old_inode_refs(trans, root, path, BTRFS_I(inode), eb, slot,
-				    key);
+	ret = unlink_old_inode_refs(trans, root, path, inode, eb, slot, key);
 	if (ret)
 		goto out;
 
@@ -1499,8 +1493,10 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans,
 out:
 	btrfs_release_path(path);
 	kfree(name.name);
-	iput(dir);
-	iput(inode);
+	if (dir)
+		iput(&dir->vfs_inode);
+	if (inode)
+		iput(&inode->vfs_inode);
 	return ret;
 }
 
@@ -1672,12 +1668,13 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
 {
 	int ret;
 	struct btrfs_key key;
-	struct inode *inode;
 
 	key.objectid = BTRFS_TREE_LOG_FIXUP_OBJECTID;
 	key.type = BTRFS_ORPHAN_ITEM_KEY;
 	key.offset = (u64)-1;
 	while (1) {
+		struct btrfs_inode *inode;
+
 		ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
 		if (ret < 0)
 			break;
@@ -1705,8 +1702,8 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
 			break;
 		}
 
-		ret = fixup_inode_link_count(trans, inode);
-		iput(inode);
+		ret = fixup_inode_link_count(trans, &inode->vfs_inode);
+		iput(&inode->vfs_inode);
 		if (ret)
 			break;
 
@@ -1734,12 +1731,14 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans,
 {
 	struct btrfs_key key;
 	int ret = 0;
-	struct inode *inode;
+	struct btrfs_inode *inode;
+	struct inode *vfs_inode;
 
 	inode = read_one_inode(root, objectid);
 	if (!inode)
 		return -EIO;
 
+	vfs_inode = &inode->vfs_inode;
 	key.objectid = BTRFS_TREE_LOG_FIXUP_OBJECTID;
 	key.type = BTRFS_ORPHAN_ITEM_KEY;
 	key.offset = objectid;
@@ -1748,15 +1747,15 @@ static noinline int link_to_fixup_dir(struct btrfs_trans_handle *trans,
 
 	btrfs_release_path(path);
 	if (ret == 0) {
-		if (!inode->i_nlink)
-			set_nlink(inode, 1);
+		if (!vfs_inode->i_nlink)
+			set_nlink(vfs_inode, 1);
 		else
-			inc_nlink(inode);
-		ret = btrfs_update_inode(trans, BTRFS_I(inode));
+			inc_nlink(vfs_inode);
+		ret = btrfs_update_inode(trans, inode);
 	} else if (ret == -EEXIST) {
 		ret = 0;
 	}
-	iput(inode);
+	iput(vfs_inode);
 
 	return ret;
 }
@@ -1772,8 +1771,8 @@ static noinline int insert_one_name(struct btrfs_trans_handle *trans,
 				    const struct fscrypt_str *name,
 				    struct btrfs_key *location)
 {
-	struct inode *inode;
-	struct inode *dir;
+	struct btrfs_inode *inode;
+	struct btrfs_inode *dir;
 	int ret;
 
 	inode = read_one_inode(root, location->objectid);
@@ -1782,17 +1781,16 @@ static noinline int insert_one_name(struct btrfs_trans_handle *trans,
 
 	dir = read_one_inode(root, dirid);
 	if (!dir) {
-		iput(inode);
+		iput(&inode->vfs_inode);
 		return -EIO;
 	}
 
-	ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode), name,
-			     1, index);
+	ret = btrfs_add_link(trans, dir, inode, name, 1, index);
 
 	/* FIXME, put inode into FIXUP list */
 
-	iput(inode);
-	iput(dir);
+	iput(&inode->vfs_inode);
+	iput(&dir->vfs_inode);
 	return ret;
 }
 
@@ -1854,7 +1852,7 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
 	bool index_dst_matches = false;
 	struct btrfs_key log_key;
 	struct btrfs_key search_key;
-	struct inode *dir;
+	struct btrfs_inode *dir;
 	u8 log_flags;
 	bool exists;
 	int ret;
@@ -1884,9 +1882,8 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
 		ret = PTR_ERR(dir_dst_di);
 		goto out;
 	} else if (dir_dst_di) {
-		ret = delete_conflicting_dir_entry(trans, BTRFS_I(dir), path,
-						   dir_dst_di, &log_key,
-						   log_flags, exists);
+		ret = delete_conflicting_dir_entry(trans, dir, path, dir_dst_di,
+						   &log_key, log_flags, exists);
 		if (ret < 0)
 			goto out;
 		dir_dst_matches = (ret == 1);
@@ -1901,9 +1898,8 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
 		ret = PTR_ERR(index_dst_di);
 		goto out;
 	} else if (index_dst_di) {
-		ret = delete_conflicting_dir_entry(trans, BTRFS_I(dir), path,
-						   index_dst_di, &log_key,
-						   log_flags, exists);
+		ret = delete_conflicting_dir_entry(trans, dir, path, index_dst_di,
+						   &log_key, log_flags, exists);
 		if (ret < 0)
 			goto out;
 		index_dst_matches = (ret == 1);
@@ -1958,11 +1954,11 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,
 
 out:
 	if (!ret && update_size) {
-		btrfs_i_size_write(BTRFS_I(dir), dir->i_size + name.len * 2);
-		ret = btrfs_update_inode(trans, BTRFS_I(dir));
+		btrfs_i_size_write(dir, dir->vfs_inode.i_size + name.len * 2);
+		ret = btrfs_update_inode(trans, dir);
 	}
 	kfree(name.name);
-	iput(dir);
+	iput(&dir->vfs_inode);
 	if (!ret && name_added)
 		ret = 1;
 	return ret;
@@ -2119,16 +2115,16 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
 				      struct btrfs_root *log,
 				      struct btrfs_path *path,
 				      struct btrfs_path *log_path,
-				      struct inode *dir,
+				      struct btrfs_inode *dir,
 				      struct btrfs_key *dir_key)
 {
-	struct btrfs_root *root = BTRFS_I(dir)->root;
+	struct btrfs_root *root = dir->root;
 	int ret;
 	struct extent_buffer *eb;
 	int slot;
 	struct btrfs_dir_item *di;
 	struct fscrypt_str name = { 0 };
-	struct inode *inode = NULL;
+	struct btrfs_inode *inode = NULL;
 	struct btrfs_key location;
 
 	/*
@@ -2175,9 +2171,8 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
 	if (ret)
 		goto out;
 
-	inc_nlink(inode);
-	ret = unlink_inode_for_log_replay(trans, BTRFS_I(dir), BTRFS_I(inode),
-					  &name);
+	inc_nlink(&inode->vfs_inode);
+	ret = unlink_inode_for_log_replay(trans, dir, inode, &name);
 	/*
 	 * Unlike dir item keys, dir index keys can only have one name (entry) in
 	 * them, as there are no key collisions since each key has a unique offset
@@ -2187,7 +2182,8 @@ static noinline int check_item_in_log(struct btrfs_trans_handle *trans,
 	btrfs_release_path(path);
 	btrfs_release_path(log_path);
 	kfree(name.name);
-	iput(inode);
+	if (inode)
+		iput(&inode->vfs_inode);
 	return ret;
 }
 
@@ -2311,7 +2307,7 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans,
 	struct btrfs_key dir_key;
 	struct btrfs_key found_key;
 	struct btrfs_path *log_path;
-	struct inode *dir;
+	struct btrfs_inode *dir;
 
 	dir_key.objectid = dirid;
 	dir_key.type = BTRFS_DIR_INDEX_KEY;
@@ -2388,7 +2384,7 @@ static noinline int replay_dir_deletes(struct btrfs_trans_handle *trans,
 out:
 	btrfs_release_path(path);
 	btrfs_free_path(log_path);
-	iput(dir);
+	iput(&dir->vfs_inode);
 	return ret;
 }
 
@@ -2482,7 +2478,7 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb,
 			 */
 			if (S_ISREG(mode)) {
 				struct btrfs_drop_extents_args drop_args = { 0 };
-				struct inode *inode;
+				struct btrfs_inode *inode;
 				u64 from;
 
 				inode = read_one_inode(root, key.objectid);
@@ -2490,22 +2486,20 @@ static int replay_one_buffer(struct btrfs_root *log, struct extent_buffer *eb,
 					ret = -EIO;
 					break;
 				}
-				from = ALIGN(i_size_read(inode),
+				from = ALIGN(i_size_read(&inode->vfs_inode),
 					     root->fs_info->sectorsize);
 				drop_args.start = from;
 				drop_args.end = (u64)-1;
 				drop_args.drop_cache = true;
-				ret = btrfs_drop_extents(wc->trans, root,
-							 BTRFS_I(inode),
+				ret = btrfs_drop_extents(wc->trans, root, inode,
 							 &drop_args);
 				if (!ret) {
-					inode_sub_bytes(inode,
+					inode_sub_bytes(&inode->vfs_inode,
 							drop_args.bytes_found);
 					/* Update the inode's nbytes. */
-					ret = btrfs_update_inode(wc->trans,
-								 BTRFS_I(inode));
+					ret = btrfs_update_inode(wc->trans, inode);
 				}
-				iput(inode);
+				iput(&inode->vfs_inode);
 				if (ret)
 					break;
 			}
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/8] btrfs: pass a btrfs_inode to fixup_inode_link_count()
  2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
  2025-03-07 13:44 ` [PATCH 1/8] btrfs: return a btrfs_inode from btrfs_iget_logging() fdmanana
  2025-03-07 13:44 ` [PATCH 2/8] btrfs: return a btrfs_inode from read_one_inode() fdmanana
@ 2025-03-07 13:44 ` fdmanana
  2025-03-07 13:44 ` [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead fdmanana
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: fdmanana @ 2025-03-07 13:44 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

fixup_inode_link_count() mostly wants to use a btrfs_inode, plus it's an
internal function so it should take btrfs_inode instead of a VFS inode.
Change the argument type to btrfs_inode, avoiding several BTRFS_I() calls
too.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/tree-log.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 0df356e23762..349c9482e9b9 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1610,25 +1610,25 @@ static int count_inode_refs(struct btrfs_inode *inode, struct btrfs_path *path)
  * will free the inode.
  */
 static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
-					   struct inode *inode)
+					   struct btrfs_inode *inode)
 {
-	struct btrfs_root *root = BTRFS_I(inode)->root;
+	struct btrfs_root *root = inode->root;
 	struct btrfs_path *path;
 	int ret;
 	u64 nlink = 0;
-	u64 ino = btrfs_ino(BTRFS_I(inode));
+	const u64 ino = btrfs_ino(inode);
 
 	path = btrfs_alloc_path();
 	if (!path)
 		return -ENOMEM;
 
-	ret = count_inode_refs(BTRFS_I(inode), path);
+	ret = count_inode_refs(inode, path);
 	if (ret < 0)
 		goto out;
 
 	nlink = ret;
 
-	ret = count_inode_extrefs(BTRFS_I(inode), path);
+	ret = count_inode_extrefs(inode, path);
 	if (ret < 0)
 		goto out;
 
@@ -1636,17 +1636,17 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
 
 	ret = 0;
 
-	if (nlink != inode->i_nlink) {
-		set_nlink(inode, nlink);
-		ret = btrfs_update_inode(trans, BTRFS_I(inode));
+	if (nlink != inode->vfs_inode.i_nlink) {
+		set_nlink(&inode->vfs_inode, nlink);
+		ret = btrfs_update_inode(trans, inode);
 		if (ret)
 			goto out;
 	}
-	if (S_ISDIR(inode->i_mode))
-		BTRFS_I(inode)->index_cnt = (u64)-1;
+	if (S_ISDIR(inode->vfs_inode.i_mode))
+		inode->index_cnt = (u64)-1;
 
-	if (inode->i_nlink == 0) {
-		if (S_ISDIR(inode->i_mode)) {
+	if (inode->vfs_inode.i_nlink == 0) {
+		if (S_ISDIR(inode->vfs_inode.i_mode)) {
 			ret = replay_dir_deletes(trans, root, NULL, path,
 						 ino, 1);
 			if (ret)
@@ -1702,7 +1702,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
 			break;
 		}
 
-		ret = fixup_inode_link_count(trans, &inode->vfs_inode);
+		ret = fixup_inode_link_count(trans, inode);
 		iput(&inode->vfs_inode);
 		if (ret)
 			break;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
  2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
                   ` (2 preceding siblings ...)
  2025-03-07 13:44 ` [PATCH 3/8] btrfs: pass a btrfs_inode to fixup_inode_link_count() fdmanana
@ 2025-03-07 13:44 ` fdmanana
  2025-03-08 15:31   ` kernel test robot
  2025-03-08 17:48   ` kernel test robot
  2025-03-07 13:44 ` [PATCH 5/8] btrfs: make btrfs_iget_path() " fdmanana
                   ` (4 subsequent siblings)
  8 siblings, 2 replies; 15+ messages in thread
From: fdmanana @ 2025-03-07 13:44 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

It's an internal function and most of the time the callers are doing a lot
of BTRFS_I() calls on the returned VFS inode to get the btrfs inode, so
change the return type to struct btrfs_inode instead.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/btrfs_inode.h |  2 +-
 fs/btrfs/defrag.c      | 14 +++++------
 fs/btrfs/export.c      | 17 +++++++++----
 fs/btrfs/inode.c       | 56 +++++++++++++++++++++---------------------
 fs/btrfs/ioctl.c       |  7 +++---
 fs/btrfs/relocation.c  | 17 +++++++------
 fs/btrfs/send.c        | 25 +++++++++----------
 fs/btrfs/super.c       |  4 +--
 fs/btrfs/tree-log.c    |  7 ++----
 9 files changed, 78 insertions(+), 71 deletions(-)

diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index ca1cd600f5d2..d81bfc760f9b 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -594,7 +594,7 @@ int __init btrfs_init_cachep(void);
 void __cold btrfs_destroy_cachep(void);
 struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
 			      struct btrfs_path *path);
-struct inode *btrfs_iget(u64 ino, struct btrfs_root *root);
+struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root);
 struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 				    struct folio *folio, u64 start, u64 len);
 int btrfs_update_inode(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c
index 18f0704263f3..6097c2e12b41 100644
--- a/fs/btrfs/defrag.c
+++ b/fs/btrfs/defrag.c
@@ -225,7 +225,7 @@ static int btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
 				  struct file_ra_state *ra)
 {
 	struct btrfs_root *inode_root;
-	struct inode *inode;
+	struct btrfs_inode *inode;
 	struct btrfs_ioctl_defrag_range_args range;
 	int ret = 0;
 	u64 cur = 0;
@@ -250,24 +250,24 @@ static int btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info,
 		goto cleanup;
 	}
 
-	if (cur >= i_size_read(inode)) {
-		iput(inode);
+	if (cur >= i_size_read(&inode->vfs_inode)) {
+		iput(&inode->vfs_inode);
 		goto cleanup;
 	}
 
 	/* Do a chunk of defrag */
-	clear_bit(BTRFS_INODE_IN_DEFRAG, &BTRFS_I(inode)->runtime_flags);
+	clear_bit(BTRFS_INODE_IN_DEFRAG, &inode->runtime_flags);
 	memset(&range, 0, sizeof(range));
 	range.len = (u64)-1;
 	range.start = cur;
 	range.extent_thresh = defrag->extent_thresh;
-	file_ra_state_init(ra, inode->i_mapping);
+	file_ra_state_init(ra, inode->vfs_inode.i_mapping);
 
 	sb_start_write(fs_info->sb);
-	ret = btrfs_defrag_file(BTRFS_I(inode), ra, &range, defrag->transid,
+	ret = btrfs_defrag_file(inode, ra, &range, defrag->transid,
 				BTRFS_DEFRAG_BATCH);
 	sb_end_write(fs_info->sb);
-	iput(inode);
+	iput(&inode->vfs_inode);
 
 	if (ret < 0)
 		goto cleanup;
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index a91eaf0ca34e..9fddbb4bb66c 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -75,7 +75,7 @@ struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
 {
 	struct btrfs_fs_info *fs_info = btrfs_sb(sb);
 	struct btrfs_root *root;
-	struct inode *inode;
+	struct btrfs_inode *inode;
 
 	if (objectid < BTRFS_FIRST_FREE_OBJECTID)
 		return ERR_PTR(-ESTALE);
@@ -89,12 +89,12 @@ struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
 	if (IS_ERR(inode))
 		return ERR_CAST(inode);
 
-	if (generation != 0 && generation != inode->i_generation) {
-		iput(inode);
+	if (generation != 0 && generation != inode->vfs_inode.i_generation) {
+		iput(&inode->vfs_inode);
 		return ERR_PTR(-ESTALE);
 	}
 
-	return d_obtain_alias(inode);
+	return d_obtain_alias(&inode->vfs_inode);
 }
 
 static struct dentry *btrfs_fh_to_parent(struct super_block *sb, struct fid *fh,
@@ -146,6 +146,7 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
 struct dentry *btrfs_get_parent(struct dentry *child)
 {
 	struct btrfs_inode *dir = BTRFS_I(d_inode(child));
+	struct btrfs_inode *inode;
 	struct btrfs_root *root = dir->root;
 	struct btrfs_fs_info *fs_info = root->fs_info;
 	struct btrfs_path *path;
@@ -210,7 +211,13 @@ struct dentry *btrfs_get_parent(struct dentry *child)
 					found_key.offset, 0);
 	}
 
-	return d_obtain_alias(btrfs_iget(key.objectid, root));
+	inode = btrfs_iget(key.objectid, root);
+	if (IS_ERR(inode)) {
+		ret = PTR_ERR(inode);
+		goto fail;
+	}
+
+	return d_obtain_alias(&inode->vfs_inode);
 fail:
 	btrfs_free_path(path);
 	return ERR_PTR(ret);
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8ac4858b70e7..072e7a47f162 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3555,7 +3555,6 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
 	struct extent_buffer *leaf;
 	struct btrfs_key key, found_key;
 	struct btrfs_trans_handle *trans;
-	struct inode *inode;
 	u64 last_objectid = 0;
 	int ret = 0, nr_unlink = 0;
 
@@ -3574,6 +3573,8 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
 	key.offset = (u64)-1;
 
 	while (1) {
+		struct btrfs_inode *inode;
+
 		ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
 		if (ret < 0)
 			goto out;
@@ -3697,10 +3698,10 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
 		 * deleted but wasn't. The inode number may have been reused,
 		 * but either way, we can delete the orphan item.
 		 */
-		if (!inode || inode->i_nlink) {
+		if (!inode || inode->vfs_inode.i_nlink) {
 			if (inode) {
-				ret = btrfs_drop_verity_items(BTRFS_I(inode));
-				iput(inode);
+				ret = btrfs_drop_verity_items(inode);
+				iput(&inode->vfs_inode);
 				inode = NULL;
 				if (ret)
 					goto out;
@@ -3723,7 +3724,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
 		nr_unlink++;
 
 		/* this will do delete_inode and everything for us */
-		iput(inode);
+		iput(&inode->vfs_inode);
 	}
 	/* release the path since we're done with it */
 	btrfs_release_path(path);
@@ -5673,7 +5674,7 @@ struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
 /*
  * Get an inode object given its inode number and corresponding root.
  */
-struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
+struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root)
 {
 	struct btrfs_inode *inode;
 	struct btrfs_path *path;
@@ -5684,7 +5685,7 @@ struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
 		return ERR_PTR(-ENOMEM);
 
 	if (!(inode->vfs_inode.i_state & I_NEW))
-		return &inode->vfs_inode;
+		return inode;
 
 	path = btrfs_alloc_path();
 	if (!path)
@@ -5696,7 +5697,7 @@ struct inode *btrfs_iget(u64 ino, struct btrfs_root *root)
 		return ERR_PTR(ret);
 
 	unlock_new_inode(&inode->vfs_inode);
-	return &inode->vfs_inode;
+	return inode;
 }
 
 static struct btrfs_inode *new_simple_dir(struct inode *dir,
@@ -5756,7 +5757,7 @@ static inline u8 btrfs_inode_type(const struct btrfs_inode *inode)
 struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
 {
 	struct btrfs_fs_info *fs_info = inode_to_fs_info(dir);
-	struct inode *inode;
+	struct btrfs_inode *inode;
 	struct btrfs_root *root = BTRFS_I(dir)->root;
 	struct btrfs_root *sub_root = root;
 	struct btrfs_key location = { 0 };
@@ -5773,49 +5774,48 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
 	if (location.type == BTRFS_INODE_ITEM_KEY) {
 		inode = btrfs_iget(location.objectid, root);
 		if (IS_ERR(inode))
-			return inode;
+			return ERR_CAST(inode);
 
 		/* Do extra check against inode mode with di_type */
-		if (btrfs_inode_type(BTRFS_I(inode)) != di_type) {
+		if (btrfs_inode_type(inode) != di_type) {
 			btrfs_crit(fs_info,
 "inode mode mismatch with dir: inode mode=0%o btrfs type=%u dir type=%u",
-				  inode->i_mode, btrfs_inode_type(BTRFS_I(inode)),
+				  inode->vfs_inode.i_mode, btrfs_inode_type(inode),
 				  di_type);
-			iput(inode);
+			iput(&inode->vfs_inode);
 			return ERR_PTR(-EUCLEAN);
 		}
-		return inode;
+		return &inode->vfs_inode;
 	}
 
 	ret = fixup_tree_root_location(fs_info, BTRFS_I(dir), dentry,
 				       &location, &sub_root);
 	if (ret < 0) {
-		if (ret != -ENOENT) {
+		if (ret != -ENOENT)
 			inode = ERR_PTR(ret);
-		} else {
-			struct btrfs_inode *b_inode;
-
-			b_inode = new_simple_dir(dir, &location, root);
-			inode = &b_inode->vfs_inode;
-		}
+		else
+			inode = new_simple_dir(dir, &location, root);
 	} else {
 		inode = btrfs_iget(location.objectid, sub_root);
 		btrfs_put_root(sub_root);
 
 		if (IS_ERR(inode))
-			return inode;
+			return ERR_CAST(inode);
 
 		down_read(&fs_info->cleanup_work_sem);
-		if (!sb_rdonly(inode->i_sb))
+		if (!sb_rdonly(inode->vfs_inode.i_sb))
 			ret = btrfs_orphan_cleanup(sub_root);
 		up_read(&fs_info->cleanup_work_sem);
 		if (ret) {
-			iput(inode);
+			iput(&inode->vfs_inode);
 			inode = ERR_PTR(ret);
 		}
 	}
 
-	return inode;
+	if (IS_ERR(inode))
+		return ERR_CAST(inode);
+
+	return &inode->vfs_inode;
 }
 
 static int btrfs_dentry_delete(const struct dentry *dentry)
@@ -6468,7 +6468,7 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
 	path = NULL;
 
 	if (args->subvol) {
-		struct inode *parent;
+		struct btrfs_inode *parent;
 
 		/*
 		 * Subvolumes inherit properties from their parent subvolume,
@@ -6479,8 +6479,8 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
 			ret = PTR_ERR(parent);
 		} else {
 			ret = btrfs_inode_inherit_props(trans, BTRFS_I(inode),
-							BTRFS_I(parent));
-			iput(parent);
+							parent);
+			iput(&parent->vfs_inode);
 		}
 	} else {
 		ret = btrfs_inode_inherit_props(trans, BTRFS_I(inode),
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index fffa2868f329..c68e505710af 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1832,7 +1832,6 @@ static int btrfs_search_path_in_tree_user(struct mnt_idmap *idmap,
 	struct btrfs_path *path;
 	struct btrfs_key key, key2;
 	struct extent_buffer *leaf;
-	struct inode *temp_inode;
 	char *ptr;
 	int slot;
 	int len;
@@ -1860,6 +1859,8 @@ static int btrfs_search_path_in_tree_user(struct mnt_idmap *idmap,
 		key.type = BTRFS_INODE_REF_KEY;
 		key.offset = (u64)-1;
 		while (1) {
+			struct btrfs_inode *temp_inode;
+
 			ret = btrfs_search_backwards(root, &key, path);
 			if (ret < 0)
 				goto out_put;
@@ -1914,9 +1915,9 @@ static int btrfs_search_path_in_tree_user(struct mnt_idmap *idmap,
 				ret = PTR_ERR(temp_inode);
 				goto out_put;
 			}
-			ret = inode_permission(idmap, temp_inode,
+			ret = inode_permission(idmap, &temp_inode->vfs_inode,
 					       MAY_READ | MAY_EXEC);
-			iput(temp_inode);
+			iput(&temp_inode->vfs_inode);
 			if (ret) {
 				ret = -EACCES;
 				goto out_put;
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index af0969b70b53..5359cf2b79b5 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -3246,14 +3246,16 @@ static int delete_block_group_cache(struct btrfs_fs_info *fs_info,
 {
 	struct btrfs_root *root = fs_info->tree_root;
 	struct btrfs_trans_handle *trans;
+	struct btrfs_inode *btrfs_inode;
 	int ret = 0;
 
 	if (inode)
 		goto truncate;
 
-	inode = btrfs_iget(ino, root);
-	if (IS_ERR(inode))
+	btrfs_inode = btrfs_iget(ino, root);
+	if (IS_ERR(btrfs_inode))
 		return -ENOENT;
+	inode = &btrfs_inode->vfs_inode;
 
 truncate:
 	ret = btrfs_check_trunc_cache_free_space(fs_info,
@@ -3764,7 +3766,7 @@ static noinline_for_stack struct inode *create_reloc_inode(
 					struct btrfs_fs_info *fs_info,
 					const struct btrfs_block_group *group)
 {
-	struct inode *inode = NULL;
+	struct btrfs_inode *inode = NULL;
 	struct btrfs_trans_handle *trans;
 	struct btrfs_root *root;
 	u64 objectid;
@@ -3792,18 +3794,19 @@ static noinline_for_stack struct inode *create_reloc_inode(
 		inode = NULL;
 		goto out;
 	}
-	BTRFS_I(inode)->reloc_block_group_start = group->start;
+	inode->reloc_block_group_start = group->start;
 
-	ret = btrfs_orphan_add(trans, BTRFS_I(inode));
+	ret = btrfs_orphan_add(trans, inode);
 out:
 	btrfs_put_root(root);
 	btrfs_end_transaction(trans);
 	btrfs_btree_balance_dirty(fs_info);
 	if (ret) {
-		iput(inode);
+		if (inode)
+			iput(&inode->vfs_inode);
 		inode = ERR_PTR(ret);
 	}
-	return inode;
+	return &inode->vfs_inode;
 }
 
 /*
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 17a6ed3691e7..0c8c58c4f29b 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5187,14 +5187,14 @@ static int send_verity(struct send_ctx *sctx, struct fs_path *path,
 static int process_verity(struct send_ctx *sctx)
 {
 	int ret = 0;
-	struct inode *inode;
+	struct btrfs_inode *inode;
 	struct fs_path *p;
 
 	inode = btrfs_iget(sctx->cur_ino, sctx->send_root);
 	if (IS_ERR(inode))
 		return PTR_ERR(inode);
 
-	ret = btrfs_get_verity_descriptor(inode, NULL, 0);
+	ret = btrfs_get_verity_descriptor(&inode->vfs_inode, NULL, 0);
 	if (ret < 0)
 		goto iput;
 
@@ -5211,7 +5211,7 @@ static int process_verity(struct send_ctx *sctx)
 		}
 	}
 
-	ret = btrfs_get_verity_descriptor(inode, sctx->verity_descriptor, ret);
+	ret = btrfs_get_verity_descriptor(&inode->vfs_inode, sctx->verity_descriptor, ret);
 	if (ret < 0)
 		goto iput;
 
@@ -5223,7 +5223,7 @@ static int process_verity(struct send_ctx *sctx)
 
 	ret = send_verity(sctx, p, sctx->verity_descriptor);
 iput:
-	iput(inode);
+	iput(&inode->vfs_inode);
 	return ret;
 }
 
@@ -5573,7 +5573,7 @@ static int send_encoded_extent(struct send_ctx *sctx, struct btrfs_path *path,
 {
 	struct btrfs_root *root = sctx->send_root;
 	struct btrfs_fs_info *fs_info = root->fs_info;
-	struct inode *inode;
+	struct btrfs_inode *inode;
 	struct fs_path *fspath;
 	struct extent_buffer *leaf = path->nodes[0];
 	struct btrfs_key key;
@@ -5639,7 +5639,7 @@ static int send_encoded_extent(struct send_ctx *sctx, struct btrfs_path *path,
 	 * Note that send_buf is a mapping of send_buf_pages, so this is really
 	 * reading into send_buf.
 	 */
-	ret = btrfs_encoded_read_regular_fill_pages(BTRFS_I(inode),
+	ret = btrfs_encoded_read_regular_fill_pages(inode,
 						    disk_bytenr, disk_num_bytes,
 						    sctx->send_buf_pages +
 						    (data_offset >> PAGE_SHIFT),
@@ -5665,7 +5665,7 @@ static int send_encoded_extent(struct send_ctx *sctx, struct btrfs_path *path,
 
 tlv_put_failure:
 out:
-	iput(inode);
+	iput(&inode->vfs_inode);
 	return ret;
 }
 
@@ -5707,15 +5707,14 @@ static int send_extent_data(struct send_ctx *sctx, struct btrfs_path *path,
 	}
 
 	if (sctx->cur_inode == NULL) {
+		struct btrfs_inode *btrfs_inode;
 		struct btrfs_root *root = sctx->send_root;
 
-		sctx->cur_inode = btrfs_iget(sctx->cur_ino, root);
-		if (IS_ERR(sctx->cur_inode)) {
-			int err = PTR_ERR(sctx->cur_inode);
+		btrfs_inode = btrfs_iget(sctx->cur_ino, root);
+		if (IS_ERR(btrfs_inode))
+			return PTR_ERR(btrfs_inode);
 
-			sctx->cur_inode = NULL;
-			return err;
-		}
+		sctx->cur_inode = &btrfs_inode->vfs_inode;
 		memset(&sctx->ra, 0, sizeof(struct file_ra_state));
 		file_ra_state_init(&sctx->ra, sctx->cur_inode->i_mapping);
 
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index fdec546a87f3..40709e2a44fc 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -947,7 +947,7 @@ static int get_default_subvol_objectid(struct btrfs_fs_info *fs_info, u64 *objec
 static int btrfs_fill_super(struct super_block *sb,
 			    struct btrfs_fs_devices *fs_devices)
 {
-	struct inode *inode;
+	struct btrfs_inode *inode;
 	struct btrfs_fs_info *fs_info = btrfs_sb(sb);
 	int err;
 
@@ -982,7 +982,7 @@ static int btrfs_fill_super(struct super_block *sb,
 		goto fail_close;
 	}
 
-	sb->s_root = d_make_root(inode);
+	sb->s_root = d_make_root(&inode->vfs_inode);
 	if (!sb->s_root) {
 		err = -ENOMEM;
 		goto fail_close;
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 349c9482e9b9..2d23223f476b 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -141,7 +141,7 @@ static void wait_log_commit(struct btrfs_root *root, int transid);
 static struct btrfs_inode *btrfs_iget_logging(u64 objectid, struct btrfs_root *root)
 {
 	unsigned int nofs_flag;
-	struct inode *inode;
+	struct btrfs_inode *inode;
 
 	/*
 	 * We're holding a transaction handle whether we are logging or
@@ -154,10 +154,7 @@ static struct btrfs_inode *btrfs_iget_logging(u64 objectid, struct btrfs_root *r
 	inode = btrfs_iget(objectid, root);
 	memalloc_nofs_restore(nofs_flag);
 
-	if (IS_ERR(inode))
-		return ERR_CAST(inode);
-
-	return BTRFS_I(inode);
+	return inode;
 }
 
 /*
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 5/8] btrfs: make btrfs_iget_path() return a btrfs inode instead
  2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
                   ` (3 preceding siblings ...)
  2025-03-07 13:44 ` [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead fdmanana
@ 2025-03-07 13:44 ` fdmanana
  2025-03-07 13:44 ` [PATCH 6/8] btrfs: remove unnecessary fs_info argument from create_reloc_inode() fdmanana
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: fdmanana @ 2025-03-07 13:44 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

It's an internal function and btrfs_iget() is now returning a btrfs inode,
so change btrfs_iget_path() to also return a btrfs inode instead of a VFS
inode.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/btrfs_inode.h      |  4 ++--
 fs/btrfs/free-space-cache.c | 10 +++++-----
 fs/btrfs/inode.c            |  8 ++++----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index d81bfc760f9b..a2925562b4e9 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -592,8 +592,8 @@ void btrfs_free_inode(struct inode *inode);
 int btrfs_drop_inode(struct inode *inode);
 int __init btrfs_init_cachep(void);
 void __cold btrfs_destroy_cachep(void);
-struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
-			      struct btrfs_path *path);
+struct btrfs_inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
+				    struct btrfs_path *path);
 struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root);
 struct extent_map *btrfs_get_extent(struct btrfs_inode *inode,
 				    struct folio *folio, u64 start, u64 len);
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 3095cce904b5..05e173311c1a 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -88,7 +88,7 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
 	struct btrfs_disk_key disk_key;
 	struct btrfs_free_space_header *header;
 	struct extent_buffer *leaf;
-	struct inode *inode = NULL;
+	struct btrfs_inode *inode;
 	unsigned nofs_flag;
 	int ret;
 
@@ -120,13 +120,13 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
 	btrfs_release_path(path);
 	memalloc_nofs_restore(nofs_flag);
 	if (IS_ERR(inode))
-		return inode;
+		return ERR_CAST(inode);
 
-	mapping_set_gfp_mask(inode->i_mapping,
-			mapping_gfp_constraint(inode->i_mapping,
+	mapping_set_gfp_mask(inode->vfs_inode.i_mapping,
+			mapping_gfp_constraint(inode->vfs_inode.i_mapping,
 			~(__GFP_FS | __GFP_HIGHMEM)));
 
-	return inode;
+	return &inode->vfs_inode;
 }
 
 struct inode *lookup_free_space_inode(struct btrfs_block_group *block_group,
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 072e7a47f162..d2cafd2f46b0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5650,8 +5650,8 @@ static struct btrfs_inode *btrfs_iget_locked(u64 ino, struct btrfs_root *root)
  * Get an inode object given its inode number and corresponding root.  Path is
  * preallocated to prevent recursing back to iget through allocator.
  */
-struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
-			      struct btrfs_path *path)
+struct btrfs_inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
+				    struct btrfs_path *path)
 {
 	struct btrfs_inode *inode;
 	int ret;
@@ -5661,14 +5661,14 @@ struct inode *btrfs_iget_path(u64 ino, struct btrfs_root *root,
 		return ERR_PTR(-ENOMEM);
 
 	if (!(inode->vfs_inode.i_state & I_NEW))
-		return &inode->vfs_inode;
+		return inode;
 
 	ret = btrfs_read_locked_inode(inode, path);
 	if (ret)
 		return ERR_PTR(ret);
 
 	unlock_new_inode(&inode->vfs_inode);
-	return &inode->vfs_inode;
+	return inode;
 }
 
 /*
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 6/8] btrfs: remove unnecessary fs_info argument from create_reloc_inode()
  2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
                   ` (4 preceding siblings ...)
  2025-03-07 13:44 ` [PATCH 5/8] btrfs: make btrfs_iget_path() " fdmanana
@ 2025-03-07 13:44 ` fdmanana
  2025-03-07 13:44 ` [PATCH 7/8] btrfs: remove unnecessary fs_info argument from delete_block_group_cache() fdmanana
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: fdmanana @ 2025-03-07 13:44 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

The fs_info can be taken from the given block group, so there is no need
to pass it as an argument.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/relocation.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 5359cf2b79b5..33d3b5ca7ee0 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -3763,9 +3763,9 @@ static void delete_orphan_inode(struct btrfs_trans_handle *trans,
  * the inode is in data relocation tree and its link count is 0
  */
 static noinline_for_stack struct inode *create_reloc_inode(
-					struct btrfs_fs_info *fs_info,
 					const struct btrfs_block_group *group)
 {
+	struct btrfs_fs_info *fs_info = group->fs_info;
 	struct btrfs_inode *inode = NULL;
 	struct btrfs_trans_handle *trans;
 	struct btrfs_root *root;
@@ -3989,7 +3989,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
 		goto out;
 	}
 
-	rc->data_inode = create_reloc_inode(fs_info, rc->block_group);
+	rc->data_inode = create_reloc_inode(rc->block_group);
 	if (IS_ERR(rc->data_inode)) {
 		err = PTR_ERR(rc->data_inode);
 		rc->data_inode = NULL;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 7/8] btrfs: remove unnecessary fs_info argument from delete_block_group_cache()
  2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
                   ` (5 preceding siblings ...)
  2025-03-07 13:44 ` [PATCH 6/8] btrfs: remove unnecessary fs_info argument from create_reloc_inode() fdmanana
@ 2025-03-07 13:44 ` fdmanana
  2025-03-07 13:44 ` [PATCH 8/8] btrfs: remove unnecessary fs_info argument from btrfs_add_block_group_cache() fdmanana
  2025-03-10 18:42 ` [PATCH 0/8] btrfs: some trivial cleanups David Sterba
  8 siblings, 0 replies; 15+ messages in thread
From: fdmanana @ 2025-03-07 13:44 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

The fs_info can be taken from the given block group, so there is no need
to pass it as an argument.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/relocation.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 33d3b5ca7ee0..f948f4f6431c 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -3239,11 +3239,11 @@ static int __add_tree_block(struct reloc_control *rc,
 	return ret;
 }
 
-static int delete_block_group_cache(struct btrfs_fs_info *fs_info,
-				    struct btrfs_block_group *block_group,
+static int delete_block_group_cache(struct btrfs_block_group *block_group,
 				    struct inode *inode,
 				    u64 ino)
 {
+	struct btrfs_fs_info *fs_info = block_group->fs_info;
 	struct btrfs_root *root = fs_info->tree_root;
 	struct btrfs_trans_handle *trans;
 	struct btrfs_inode *btrfs_inode;
@@ -3315,8 +3315,7 @@ static int delete_v1_space_cache(struct extent_buffer *leaf,
 	}
 	if (!found)
 		return -ENOENT;
-	ret = delete_block_group_cache(leaf->fs_info, block_group, NULL,
-					space_cache_ino);
+	ret = delete_block_group_cache(block_group, NULL, space_cache_ino);
 	return ret;
 }
 
@@ -3980,7 +3979,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
 	btrfs_free_path(path);
 
 	if (!IS_ERR(inode))
-		ret = delete_block_group_cache(fs_info, rc->block_group, inode, 0);
+		ret = delete_block_group_cache(rc->block_group, inode, 0);
 	else
 		ret = PTR_ERR(inode);
 
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 8/8] btrfs: remove unnecessary fs_info argument from btrfs_add_block_group_cache()
  2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
                   ` (6 preceding siblings ...)
  2025-03-07 13:44 ` [PATCH 7/8] btrfs: remove unnecessary fs_info argument from delete_block_group_cache() fdmanana
@ 2025-03-07 13:44 ` fdmanana
  2025-03-10 18:42 ` [PATCH 0/8] btrfs: some trivial cleanups David Sterba
  8 siblings, 0 replies; 15+ messages in thread
From: fdmanana @ 2025-03-07 13:44 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

The fs_info can be taken from the given block group, so there is no need
to pass it as an argument. Also rename the local variable from 'info' to
'fs_info' which is more widely used, more clear and to be more consistent.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/block-group.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index 64f0268dcf02..4975aa5665ae 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -191,21 +191,21 @@ static int btrfs_bg_start_cmp(const struct rb_node *new,
 /*
  * This adds the block group to the fs_info rb tree for the block group cache
  */
-static int btrfs_add_block_group_cache(struct btrfs_fs_info *info,
-				       struct btrfs_block_group *block_group)
+static int btrfs_add_block_group_cache(struct btrfs_block_group *block_group)
 {
+	struct btrfs_fs_info *fs_info = block_group->fs_info;
 	struct rb_node *exist;
 	int ret = 0;
 
 	ASSERT(block_group->length != 0);
 
-	write_lock(&info->block_group_cache_lock);
+	write_lock(&fs_info->block_group_cache_lock);
 
 	exist = rb_find_add_cached(&block_group->cache_node,
-			&info->block_group_cache_tree, btrfs_bg_start_cmp);
+			&fs_info->block_group_cache_tree, btrfs_bg_start_cmp);
 	if (exist)
 		ret = -EEXIST;
-	write_unlock(&info->block_group_cache_lock);
+	write_unlock(&fs_info->block_group_cache_lock);
 
 	return ret;
 }
@@ -2438,7 +2438,7 @@ static int read_one_block_group(struct btrfs_fs_info *info,
 			goto error;
 	}
 
-	ret = btrfs_add_block_group_cache(info, cache);
+	ret = btrfs_add_block_group_cache(cache);
 	if (ret) {
 		btrfs_remove_free_space_cache(cache);
 		goto error;
@@ -2487,7 +2487,7 @@ static int fill_dummy_bgs(struct btrfs_fs_info *fs_info)
 		bg->cached = BTRFS_CACHE_FINISHED;
 		bg->used = map->chunk_len;
 		bg->flags = map->type;
-		ret = btrfs_add_block_group_cache(fs_info, bg);
+		ret = btrfs_add_block_group_cache(bg);
 		/*
 		 * We may have some valid block group cache added already, in
 		 * that case we skip to the next one.
@@ -2914,7 +2914,7 @@ struct btrfs_block_group *btrfs_make_block_group(struct btrfs_trans_handle *tran
 	cache->space_info = btrfs_find_space_info(fs_info, cache->flags);
 	ASSERT(cache->space_info);
 
-	ret = btrfs_add_block_group_cache(fs_info, cache);
+	ret = btrfs_add_block_group_cache(cache);
 	if (ret) {
 		btrfs_remove_free_space_cache(cache);
 		btrfs_put_block_group(cache);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
  2025-03-07 13:44 ` [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead fdmanana
@ 2025-03-08 15:31   ` kernel test robot
  2025-03-10 10:45     ` Filipe Manana
  2025-03-08 17:48   ` kernel test robot
  1 sibling, 1 reply; 15+ messages in thread
From: kernel test robot @ 2025-03-08 15:31 UTC (permalink / raw)
  To: fdmanana, linux-btrfs; +Cc: oe-kbuild-all

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on kdave/for-next]
[also build test ERROR on next-20250307]
[cannot apply to linus/master v6.14-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/fdmanana-kernel-org/btrfs-return-a-btrfs_inode-from-btrfs_iget_logging/20250307-214724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
patch link:    https://lore.kernel.org/r/f6d2a09fb43742fb5be38f820908510e298f8d40.1741354479.git.fdmanana%40suse.com
patch subject: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20250308/202503082341.T7dnq95G-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250308/202503082341.T7dnq95G-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503082341.T7dnq95G-lkp@intel.com/

All errors (new ones prefixed by >>):

   fs/btrfs/send.c: In function 'send_encoded_inline_extent':
>> fs/btrfs/send.c:5535:15: error: assignment to 'struct inode *' from incompatible pointer type 'struct btrfs_inode *' [-Wincompatible-pointer-types]
    5535 |         inode = btrfs_iget(sctx->cur_ino, root);
         |               ^


vim +5535 fs/btrfs/send.c

16e7549f045d33b Josef Bacik   2013-10-22  5519  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5520  static int send_encoded_inline_extent(struct send_ctx *sctx,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5521  				      struct btrfs_path *path, u64 offset,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5522  				      u64 len)
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5523  {
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5524  	struct btrfs_root *root = sctx->send_root;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5525  	struct btrfs_fs_info *fs_info = root->fs_info;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5526  	struct inode *inode;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5527  	struct fs_path *fspath;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5528  	struct extent_buffer *leaf = path->nodes[0];
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5529  	struct btrfs_key key;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5530  	struct btrfs_file_extent_item *ei;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5531  	u64 ram_bytes;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5532  	size_t inline_size;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5533  	int ret;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5534  
d13240dd0a2d13b Filipe Manana 2024-06-13 @5535  	inode = btrfs_iget(sctx->cur_ino, root);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5536  	if (IS_ERR(inode))
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5537  		return PTR_ERR(inode);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5538  
6054b503e2eafac Filipe Manana 2025-02-18  5539  	fspath = get_cur_inode_path(sctx);
6054b503e2eafac Filipe Manana 2025-02-18  5540  	if (IS_ERR(fspath)) {
6054b503e2eafac Filipe Manana 2025-02-18  5541  		ret = PTR_ERR(fspath);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5542  		goto out;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5543  	}
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5544  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5545  	ret = begin_cmd(sctx, BTRFS_SEND_C_ENCODED_WRITE);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5546  	if (ret < 0)
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5547  		goto out;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5548  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5549  	btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5550  	ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5551  	ram_bytes = btrfs_file_extent_ram_bytes(leaf, ei);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5552  	inline_size = btrfs_file_extent_inline_item_len(leaf, path->slots[0]);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5553  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5554  	TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, fspath);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5555  	TLV_PUT_U64(sctx, BTRFS_SEND_A_FILE_OFFSET, offset);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5556  	TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_FILE_LEN,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5557  		    min(key.offset + ram_bytes - offset, len));
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5558  	TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_LEN, ram_bytes);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5559  	TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_OFFSET, offset - key.offset);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5560  	ret = btrfs_encoded_io_compression_from_extent(fs_info,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5561  				btrfs_file_extent_compression(leaf, ei));
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5562  	if (ret < 0)
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5563  		goto out;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5564  	TLV_PUT_U32(sctx, BTRFS_SEND_A_COMPRESSION, ret);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5565  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5566  	ret = put_data_header(sctx, inline_size);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5567  	if (ret < 0)
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5568  		goto out;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5569  	read_extent_buffer(leaf, sctx->send_buf + sctx->send_size,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5570  			   btrfs_file_extent_inline_start(ei), inline_size);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5571  	sctx->send_size += inline_size;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5572  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5573  	ret = send_cmd(sctx);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5574  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5575  tlv_put_failure:
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5576  out:
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5577  	iput(inode);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5578  	return ret;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5579  }
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5580  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
  2025-03-07 13:44 ` [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead fdmanana
  2025-03-08 15:31   ` kernel test robot
@ 2025-03-08 17:48   ` kernel test robot
  2025-03-10 10:46     ` Filipe Manana
  1 sibling, 1 reply; 15+ messages in thread
From: kernel test robot @ 2025-03-08 17:48 UTC (permalink / raw)
  To: fdmanana, linux-btrfs; +Cc: llvm, oe-kbuild-all

Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on kdave/for-next]
[also build test ERROR on next-20250307]
[cannot apply to linus/master v6.14-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/fdmanana-kernel-org/btrfs-return-a-btrfs_inode-from-btrfs_iget_logging/20250307-214724
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
patch link:    https://lore.kernel.org/r/f6d2a09fb43742fb5be38f820908510e298f8d40.1741354479.git.fdmanana%40suse.com
patch subject: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250309/202503090344.SeJrOfHD-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250309/202503090344.SeJrOfHD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503090344.SeJrOfHD-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from fs/btrfs/send.c:11:
   In file included from include/linux/xattr.h:18:
   In file included from include/linux/mm.h:2224:
   include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     505 |                            item];
         |                            ~~~~
   include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     512 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
   include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
     524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~ ^
     525 |                            NR_VM_NUMA_EVENT_ITEMS +
         |                            ~~~~~~~~~~~~~~~~~~~~~~
>> fs/btrfs/send.c:5535:8: error: incompatible pointer types assigning to 'struct inode *' from 'struct btrfs_inode *' [-Werror,-Wincompatible-pointer-types]
    5535 |         inode = btrfs_iget(sctx->cur_ino, root);
         |               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   3 warnings and 1 error generated.


vim +5535 fs/btrfs/send.c

16e7549f045d33b Josef Bacik   2013-10-22  5519  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5520  static int send_encoded_inline_extent(struct send_ctx *sctx,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5521  				      struct btrfs_path *path, u64 offset,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5522  				      u64 len)
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5523  {
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5524  	struct btrfs_root *root = sctx->send_root;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5525  	struct btrfs_fs_info *fs_info = root->fs_info;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5526  	struct inode *inode;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5527  	struct fs_path *fspath;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5528  	struct extent_buffer *leaf = path->nodes[0];
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5529  	struct btrfs_key key;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5530  	struct btrfs_file_extent_item *ei;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5531  	u64 ram_bytes;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5532  	size_t inline_size;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5533  	int ret;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5534  
d13240dd0a2d13b Filipe Manana 2024-06-13 @5535  	inode = btrfs_iget(sctx->cur_ino, root);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5536  	if (IS_ERR(inode))
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5537  		return PTR_ERR(inode);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5538  
6054b503e2eafac Filipe Manana 2025-02-18  5539  	fspath = get_cur_inode_path(sctx);
6054b503e2eafac Filipe Manana 2025-02-18  5540  	if (IS_ERR(fspath)) {
6054b503e2eafac Filipe Manana 2025-02-18  5541  		ret = PTR_ERR(fspath);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5542  		goto out;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5543  	}
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5544  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5545  	ret = begin_cmd(sctx, BTRFS_SEND_C_ENCODED_WRITE);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5546  	if (ret < 0)
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5547  		goto out;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5548  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5549  	btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5550  	ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5551  	ram_bytes = btrfs_file_extent_ram_bytes(leaf, ei);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5552  	inline_size = btrfs_file_extent_inline_item_len(leaf, path->slots[0]);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5553  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5554  	TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, fspath);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5555  	TLV_PUT_U64(sctx, BTRFS_SEND_A_FILE_OFFSET, offset);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5556  	TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_FILE_LEN,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5557  		    min(key.offset + ram_bytes - offset, len));
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5558  	TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_LEN, ram_bytes);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5559  	TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_OFFSET, offset - key.offset);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5560  	ret = btrfs_encoded_io_compression_from_extent(fs_info,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5561  				btrfs_file_extent_compression(leaf, ei));
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5562  	if (ret < 0)
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5563  		goto out;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5564  	TLV_PUT_U32(sctx, BTRFS_SEND_A_COMPRESSION, ret);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5565  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5566  	ret = put_data_header(sctx, inline_size);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5567  	if (ret < 0)
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5568  		goto out;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5569  	read_extent_buffer(leaf, sctx->send_buf + sctx->send_size,
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5570  			   btrfs_file_extent_inline_start(ei), inline_size);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5571  	sctx->send_size += inline_size;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5572  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5573  	ret = send_cmd(sctx);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5574  
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5575  tlv_put_failure:
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5576  out:
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5577  	iput(inode);
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5578  	return ret;
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5579  }
3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5580  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
  2025-03-08 15:31   ` kernel test robot
@ 2025-03-10 10:45     ` Filipe Manana
  2025-03-11  9:40       ` Philip Li
  0 siblings, 1 reply; 15+ messages in thread
From: Filipe Manana @ 2025-03-10 10:45 UTC (permalink / raw)
  To: kernel test robot; +Cc: linux-btrfs, oe-kbuild-all

On Sat, Mar 8, 2025 at 3:32 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on kdave/for-next]
> [also build test ERROR on next-20250307]
> [cannot apply to linus/master v6.14-rc5]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/fdmanana-kernel-org/btrfs-return-a-btrfs_inode-from-btrfs_iget_logging/20250307-214724
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
> patch link:    https://lore.kernel.org/r/f6d2a09fb43742fb5be38f820908510e298f8d40.1741354479.git.fdmanana%40suse.com
> patch subject: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
> config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20250308/202503082341.T7dnq95G-lkp@intel.com/config)
> compiler: sh4-linux-gcc (GCC) 14.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250308/202503082341.T7dnq95G-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202503082341.T7dnq95G-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
>    fs/btrfs/send.c: In function 'send_encoded_inline_extent':
> >> fs/btrfs/send.c:5535:15: error: assignment to 'struct inode *' from incompatible pointer type 'struct btrfs_inode *' [-Wincompatible-pointer-types]
>     5535 |         inode = btrfs_iget(sctx->cur_ino, root);


You're testing against a branch that doesn't contain this dependency:

https://lore.kernel.org/linux-btrfs/89867e61f94b9a9f3711f66c141e4d483a9cc6bd.1741283556.git.fdmanana@suse.com/

It's in the for-next branch of the github repo:

https://github.com/btrfs/linux/commits/for-next/

but not yet in  any kernel.org repo.

Thanks.

>          |               ^
>
>
> vim +5535 fs/btrfs/send.c
>
> 16e7549f045d33b Josef Bacik   2013-10-22  5519
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5520  static int send_encoded_inline_extent(struct send_ctx *sctx,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5521                                        struct btrfs_path *path, u64 offset,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5522                                        u64 len)
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5523  {
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5524          struct btrfs_root *root = sctx->send_root;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5525          struct btrfs_fs_info *fs_info = root->fs_info;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5526          struct inode *inode;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5527          struct fs_path *fspath;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5528          struct extent_buffer *leaf = path->nodes[0];
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5529          struct btrfs_key key;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5530          struct btrfs_file_extent_item *ei;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5531          u64 ram_bytes;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5532          size_t inline_size;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5533          int ret;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5534
> d13240dd0a2d13b Filipe Manana 2024-06-13 @5535          inode = btrfs_iget(sctx->cur_ino, root);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5536          if (IS_ERR(inode))
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5537                  return PTR_ERR(inode);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5538
> 6054b503e2eafac Filipe Manana 2025-02-18  5539          fspath = get_cur_inode_path(sctx);
> 6054b503e2eafac Filipe Manana 2025-02-18  5540          if (IS_ERR(fspath)) {
> 6054b503e2eafac Filipe Manana 2025-02-18  5541                  ret = PTR_ERR(fspath);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5542                  goto out;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5543          }
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5544
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5545          ret = begin_cmd(sctx, BTRFS_SEND_C_ENCODED_WRITE);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5546          if (ret < 0)
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5547                  goto out;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5548
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5549          btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5550          ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5551          ram_bytes = btrfs_file_extent_ram_bytes(leaf, ei);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5552          inline_size = btrfs_file_extent_inline_item_len(leaf, path->slots[0]);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5553
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5554          TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, fspath);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5555          TLV_PUT_U64(sctx, BTRFS_SEND_A_FILE_OFFSET, offset);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5556          TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_FILE_LEN,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5557                      min(key.offset + ram_bytes - offset, len));
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5558          TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_LEN, ram_bytes);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5559          TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_OFFSET, offset - key.offset);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5560          ret = btrfs_encoded_io_compression_from_extent(fs_info,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5561                                  btrfs_file_extent_compression(leaf, ei));
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5562          if (ret < 0)
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5563                  goto out;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5564          TLV_PUT_U32(sctx, BTRFS_SEND_A_COMPRESSION, ret);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5565
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5566          ret = put_data_header(sctx, inline_size);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5567          if (ret < 0)
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5568                  goto out;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5569          read_extent_buffer(leaf, sctx->send_buf + sctx->send_size,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5570                             btrfs_file_extent_inline_start(ei), inline_size);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5571          sctx->send_size += inline_size;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5572
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5573          ret = send_cmd(sctx);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5574
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5575  tlv_put_failure:
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5576  out:
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5577          iput(inode);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5578          return ret;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5579  }
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5580
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
  2025-03-08 17:48   ` kernel test robot
@ 2025-03-10 10:46     ` Filipe Manana
  0 siblings, 0 replies; 15+ messages in thread
From: Filipe Manana @ 2025-03-10 10:46 UTC (permalink / raw)
  To: kernel test robot; +Cc: linux-btrfs, llvm, oe-kbuild-all

On Sat, Mar 8, 2025 at 5:49 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on kdave/for-next]
> [also build test ERROR on next-20250307]
> [cannot apply to linus/master v6.14-rc5]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/fdmanana-kernel-org/btrfs-return-a-btrfs_inode-from-btrfs_iget_logging/20250307-214724
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
> patch link:    https://lore.kernel.org/r/f6d2a09fb43742fb5be38f820908510e298f8d40.1741354479.git.fdmanana%40suse.com
> patch subject: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
> config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250309/202503090344.SeJrOfHD-lkp@intel.com/config)
> compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250309/202503090344.SeJrOfHD-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202503090344.SeJrOfHD-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
>    In file included from fs/btrfs/send.c:11:
>    In file included from include/linux/xattr.h:18:
>    In file included from include/linux/mm.h:2224:
>    include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
>      504 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      505 |                            item];
>          |                            ~~~~
>    include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
>      511 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      512 |                            NR_VM_NUMA_EVENT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~~
>    include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
>      524 |         return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~ ^
>      525 |                            NR_VM_NUMA_EVENT_ITEMS +
>          |                            ~~~~~~~~~~~~~~~~~~~~~~
> >> fs/btrfs/send.c:5535:8: error: incompatible pointer types assigning to 'struct inode *' from 'struct btrfs_inode *' [-Werror,-Wincompatible-pointer-types]
>     5535 |         inode = btrfs_iget(sctx->cur_ino, root);
>          |               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    3 warnings and 1 error generated.

You're testing against a branch that doesn't contain this dependency:

https://lore.kernel.org/linux-btrfs/89867e61f94b9a9f3711f66c141e4d483a9cc6bd.1741283556.git.fdmanana@suse.com/

It's in the for-next branch of the github repo:

https://github.com/btrfs/linux/commits/for-next/

but not yet in  any kernel.org repo.

Thanks.

>
>
> vim +5535 fs/btrfs/send.c
>
> 16e7549f045d33b Josef Bacik   2013-10-22  5519
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5520  static int send_encoded_inline_extent(struct send_ctx *sctx,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5521                                        struct btrfs_path *path, u64 offset,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5522                                        u64 len)
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5523  {
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5524          struct btrfs_root *root = sctx->send_root;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5525          struct btrfs_fs_info *fs_info = root->fs_info;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5526          struct inode *inode;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5527          struct fs_path *fspath;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5528          struct extent_buffer *leaf = path->nodes[0];
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5529          struct btrfs_key key;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5530          struct btrfs_file_extent_item *ei;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5531          u64 ram_bytes;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5532          size_t inline_size;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5533          int ret;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5534
> d13240dd0a2d13b Filipe Manana 2024-06-13 @5535          inode = btrfs_iget(sctx->cur_ino, root);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5536          if (IS_ERR(inode))
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5537                  return PTR_ERR(inode);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5538
> 6054b503e2eafac Filipe Manana 2025-02-18  5539          fspath = get_cur_inode_path(sctx);
> 6054b503e2eafac Filipe Manana 2025-02-18  5540          if (IS_ERR(fspath)) {
> 6054b503e2eafac Filipe Manana 2025-02-18  5541                  ret = PTR_ERR(fspath);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5542                  goto out;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5543          }
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5544
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5545          ret = begin_cmd(sctx, BTRFS_SEND_C_ENCODED_WRITE);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5546          if (ret < 0)
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5547                  goto out;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5548
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5549          btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5550          ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5551          ram_bytes = btrfs_file_extent_ram_bytes(leaf, ei);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5552          inline_size = btrfs_file_extent_inline_item_len(leaf, path->slots[0]);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5553
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5554          TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, fspath);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5555          TLV_PUT_U64(sctx, BTRFS_SEND_A_FILE_OFFSET, offset);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5556          TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_FILE_LEN,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5557                      min(key.offset + ram_bytes - offset, len));
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5558          TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_LEN, ram_bytes);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5559          TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_OFFSET, offset - key.offset);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5560          ret = btrfs_encoded_io_compression_from_extent(fs_info,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5561                                  btrfs_file_extent_compression(leaf, ei));
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5562          if (ret < 0)
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5563                  goto out;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5564          TLV_PUT_U32(sctx, BTRFS_SEND_A_COMPRESSION, ret);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5565
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5566          ret = put_data_header(sctx, inline_size);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5567          if (ret < 0)
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5568                  goto out;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5569          read_extent_buffer(leaf, sctx->send_buf + sctx->send_size,
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5570                             btrfs_file_extent_inline_start(ei), inline_size);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5571          sctx->send_size += inline_size;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5572
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5573          ret = send_cmd(sctx);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5574
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5575  tlv_put_failure:
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5576  out:
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5577          iput(inode);
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5578          return ret;
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5579  }
> 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5580
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/8] btrfs: some trivial cleanups
  2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
                   ` (7 preceding siblings ...)
  2025-03-07 13:44 ` [PATCH 8/8] btrfs: remove unnecessary fs_info argument from btrfs_add_block_group_cache() fdmanana
@ 2025-03-10 18:42 ` David Sterba
  8 siblings, 0 replies; 15+ messages in thread
From: David Sterba @ 2025-03-10 18:42 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Fri, Mar 07, 2025 at 01:44:17PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> A group of trivial cleanups that started with making log tree code
> less verbose while fixing a couple bugs, by removing repeated BTRFS_I()
> calls, and then extended to btrfs_iget() and removing redundant arguments
> from a few functions. Details in the change logs.
> 
> Filipe Manana (8):
>   btrfs: return a btrfs_inode from btrfs_iget_logging()
>   btrfs: return a btrfs_inode from read_one_inode()
>   btrfs: pass a btrfs_inode to fixup_inode_link_count()
>   btrfs: make btrfs_iget() return a btrfs inode instead
>   btrfs: make btrfs_iget_path() return a btrfs inode instead
>   btrfs: remove unnecessary fs_info argument from create_reloc_inode()
>   btrfs: remove unnecessary fs_info argument from delete_block_group_cache()
>   btrfs: remove unnecessary fs_info argument from btrfs_add_block_group_cache()

Reviewed-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
  2025-03-10 10:45     ` Filipe Manana
@ 2025-03-11  9:40       ` Philip Li
  0 siblings, 0 replies; 15+ messages in thread
From: Philip Li @ 2025-03-11  9:40 UTC (permalink / raw)
  To: Filipe Manana; +Cc: kernel test robot, linux-btrfs, oe-kbuild-all

On Mon, Mar 10, 2025 at 10:45:24AM +0000, Filipe Manana wrote:
> On Sat, Mar 8, 2025 at 3:32 PM kernel test robot <lkp@intel.com> wrote:
> >
> > Hi,
> >
> > kernel test robot noticed the following build errors:
> >
> > [auto build test ERROR on kdave/for-next]
> > [also build test ERROR on next-20250307]
> > [cannot apply to linus/master v6.14-rc5]
> > [If your patch is applied to the wrong git tree, kindly drop us a note.
> > And when submitting patch, we suggest to use '--base' as documented in
> > https://git-scm.com/docs/git-format-patch#_base_tree_information]
> >
> > url:    https://github.com/intel-lab-lkp/linux/commits/fdmanana-kernel-org/btrfs-return-a-btrfs_inode-from-btrfs_iget_logging/20250307-214724
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
> > patch link:    https://lore.kernel.org/r/f6d2a09fb43742fb5be38f820908510e298f8d40.1741354479.git.fdmanana%40suse.com
> > patch subject: [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead
> > config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20250308/202503082341.T7dnq95G-lkp@intel.com/config)
> > compiler: sh4-linux-gcc (GCC) 14.2.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250308/202503082341.T7dnq95G-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202503082341.T7dnq95G-lkp@intel.com/
> >
> > All errors (new ones prefixed by >>):
> >
> >    fs/btrfs/send.c: In function 'send_encoded_inline_extent':
> > >> fs/btrfs/send.c:5535:15: error: assignment to 'struct inode *' from incompatible pointer type 'struct btrfs_inode *' [-Wincompatible-pointer-types]
> >     5535 |         inode = btrfs_iget(sctx->cur_ino, root);
> 
> 
> You're testing against a branch that doesn't contain this dependency:
> 
> https://lore.kernel.org/linux-btrfs/89867e61f94b9a9f3711f66c141e4d483a9cc6bd.1741283556.git.fdmanana@suse.com/
> 
> It's in the for-next branch of the github repo:
> 
> https://github.com/btrfs/linux/commits/for-next/

Thanks for the info, i will configure the bot to consider this. Sorry for the false
positive.

> 
> but not yet in  any kernel.org repo.
> 
> Thanks.
> 
> >          |               ^
> >
> >
> > vim +5535 fs/btrfs/send.c
> >
> > 16e7549f045d33b Josef Bacik   2013-10-22  5519
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5520  static int send_encoded_inline_extent(struct send_ctx *sctx,
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5521                                        struct btrfs_path *path, u64 offset,
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5522                                        u64 len)
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5523  {
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5524          struct btrfs_root *root = sctx->send_root;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5525          struct btrfs_fs_info *fs_info = root->fs_info;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5526          struct inode *inode;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5527          struct fs_path *fspath;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5528          struct extent_buffer *leaf = path->nodes[0];
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5529          struct btrfs_key key;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5530          struct btrfs_file_extent_item *ei;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5531          u64 ram_bytes;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5532          size_t inline_size;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5533          int ret;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5534
> > d13240dd0a2d13b Filipe Manana 2024-06-13 @5535          inode = btrfs_iget(sctx->cur_ino, root);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5536          if (IS_ERR(inode))
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5537                  return PTR_ERR(inode);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5538
> > 6054b503e2eafac Filipe Manana 2025-02-18  5539          fspath = get_cur_inode_path(sctx);
> > 6054b503e2eafac Filipe Manana 2025-02-18  5540          if (IS_ERR(fspath)) {
> > 6054b503e2eafac Filipe Manana 2025-02-18  5541                  ret = PTR_ERR(fspath);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5542                  goto out;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5543          }
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5544
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5545          ret = begin_cmd(sctx, BTRFS_SEND_C_ENCODED_WRITE);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5546          if (ret < 0)
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5547                  goto out;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5548
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5549          btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5550          ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5551          ram_bytes = btrfs_file_extent_ram_bytes(leaf, ei);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5552          inline_size = btrfs_file_extent_inline_item_len(leaf, path->slots[0]);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5553
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5554          TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, fspath);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5555          TLV_PUT_U64(sctx, BTRFS_SEND_A_FILE_OFFSET, offset);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5556          TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_FILE_LEN,
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5557                      min(key.offset + ram_bytes - offset, len));
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5558          TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_LEN, ram_bytes);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5559          TLV_PUT_U64(sctx, BTRFS_SEND_A_UNENCODED_OFFSET, offset - key.offset);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5560          ret = btrfs_encoded_io_compression_from_extent(fs_info,
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5561                                  btrfs_file_extent_compression(leaf, ei));
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5562          if (ret < 0)
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5563                  goto out;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5564          TLV_PUT_U32(sctx, BTRFS_SEND_A_COMPRESSION, ret);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5565
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5566          ret = put_data_header(sctx, inline_size);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5567          if (ret < 0)
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5568                  goto out;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5569          read_extent_buffer(leaf, sctx->send_buf + sctx->send_size,
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5570                             btrfs_file_extent_inline_start(ei), inline_size);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5571          sctx->send_size += inline_size;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5572
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5573          ret = send_cmd(sctx);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5574
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5575  tlv_put_failure:
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5576  out:
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5577          iput(inode);
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5578          return ret;
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5579  }
> > 3ea4dc5bf00c7d1 Omar Sandoval 2022-03-17  5580
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2025-03-11  9:41 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 13:44 [PATCH 0/8] btrfs: some trivial cleanups fdmanana
2025-03-07 13:44 ` [PATCH 1/8] btrfs: return a btrfs_inode from btrfs_iget_logging() fdmanana
2025-03-07 13:44 ` [PATCH 2/8] btrfs: return a btrfs_inode from read_one_inode() fdmanana
2025-03-07 13:44 ` [PATCH 3/8] btrfs: pass a btrfs_inode to fixup_inode_link_count() fdmanana
2025-03-07 13:44 ` [PATCH 4/8] btrfs: make btrfs_iget() return a btrfs inode instead fdmanana
2025-03-08 15:31   ` kernel test robot
2025-03-10 10:45     ` Filipe Manana
2025-03-11  9:40       ` Philip Li
2025-03-08 17:48   ` kernel test robot
2025-03-10 10:46     ` Filipe Manana
2025-03-07 13:44 ` [PATCH 5/8] btrfs: make btrfs_iget_path() " fdmanana
2025-03-07 13:44 ` [PATCH 6/8] btrfs: remove unnecessary fs_info argument from create_reloc_inode() fdmanana
2025-03-07 13:44 ` [PATCH 7/8] btrfs: remove unnecessary fs_info argument from delete_block_group_cache() fdmanana
2025-03-07 13:44 ` [PATCH 8/8] btrfs: remove unnecessary fs_info argument from btrfs_add_block_group_cache() fdmanana
2025-03-10 18:42 ` [PATCH 0/8] btrfs: some trivial cleanups David Sterba

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.