mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] btrfs: use BTRFS_PATH_AUTO_FREE in insert_balance_item()
@ 2025-04-08 12:29 Yangtao Li
  2025-04-08 12:29 ` [PATCH 2/4] btrfs: use BTRFS_PATH_AUTO_FREE in del_balance_item() Yangtao Li
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Yangtao Li @ 2025-04-08 12:29 UTC (permalink / raw)
  To: clm, josef, dsterba; +Cc: linux-btrfs, linux-kernel, Yangtao Li

All cleanup paths lead to btrfs_path_free so we can define path with the
automatic free callback.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/btrfs/volumes.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c8c21c55be53..a962efaec4ea 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3730,7 +3730,7 @@ static int insert_balance_item(struct btrfs_fs_info *fs_info,
 	struct btrfs_trans_handle *trans;
 	struct btrfs_balance_item *item;
 	struct btrfs_disk_balance_args disk_bargs;
-	struct btrfs_path *path;
+	BTRFS_PATH_AUTO_FREE(path);
 	struct extent_buffer *leaf;
 	struct btrfs_key key;
 	int ret, err;
@@ -3740,10 +3740,8 @@ static int insert_balance_item(struct btrfs_fs_info *fs_info,
 		return -ENOMEM;
 
 	trans = btrfs_start_transaction(root, 0);
-	if (IS_ERR(trans)) {
-		btrfs_free_path(path);
+	if (IS_ERR(trans))
 		return PTR_ERR(trans);
-	}
 
 	key.objectid = BTRFS_BALANCE_OBJECTID;
 	key.type = BTRFS_TEMPORARY_ITEM_KEY;
@@ -3767,7 +3765,6 @@ static int insert_balance_item(struct btrfs_fs_info *fs_info,
 	btrfs_set_balance_sys(leaf, item, &disk_bargs);
 	btrfs_set_balance_flags(leaf, item, bctl->flags);
 out:
-	btrfs_free_path(path);
 	err = btrfs_commit_transaction(trans);
 	if (err && !ret)
 		ret = err;
-- 
2.39.0


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

end of thread, other threads:[~2025-04-09 12:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-08 12:29 [PATCH 1/4] btrfs: use BTRFS_PATH_AUTO_FREE in insert_balance_item() Yangtao Li
2025-04-08 12:29 ` [PATCH 2/4] btrfs: use BTRFS_PATH_AUTO_FREE in del_balance_item() Yangtao Li
2025-04-08 14:47   ` Filipe Manana
2025-04-08 12:29 ` [PATCH 3/4] btrfs: Fix transaction abort during failure in insert_balance_item() Yangtao Li
2025-04-08 14:50   ` Filipe Manana
2025-04-08 12:29 ` [PATCH 4/4] btrfs: Fix transaction abort during failure in del_balance_item() Yangtao Li
2025-04-08 14:53   ` Filipe Manana
2025-04-08 23:04     ` David Sterba
2025-04-09  9:50       ` Filipe Manana
2025-04-08 14:44 ` [PATCH 1/4] btrfs: use BTRFS_PATH_AUTO_FREE in insert_balance_item() Filipe Manana
2025-04-08 17:36   ` Daniel Vacek
2025-04-08 17:40     ` Filipe Manana
2025-04-08 17:47       ` Daniel Vacek
2025-04-08 17:52         ` Filipe Manana
2025-04-08 18:00           ` Daniel Vacek
2025-04-09 12:19   ` 回复: " 李扬韬
2025-04-08 22:47 ` David Sterba
2025-04-09  9:45   ` Filipe Manana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®