From: Yangtao Li <frank.li@vivo.com>
To: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Yangtao Li <frank.li@vivo.com>
Subject: [PATCH 2/4] btrfs: use BTRFS_PATH_AUTO_FREE in del_balance_item()
Date: Tue, 8 Apr 2025 06:29:31 -0600 [thread overview]
Message-ID: <20250408122933.121056-2-frank.li@vivo.com> (raw)
In-Reply-To: <20250408122933.121056-1-frank.li@vivo.com>
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 a962efaec4ea..375d92720e17 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3775,7 +3775,7 @@ static int del_balance_item(struct btrfs_fs_info *fs_info)
{
struct btrfs_root *root = fs_info->tree_root;
struct btrfs_trans_handle *trans;
- struct btrfs_path *path;
+ BTRFS_PATH_AUTO_FREE(path);
struct btrfs_key key;
int ret, err;
@@ -3784,10 +3784,8 @@ static int del_balance_item(struct btrfs_fs_info *fs_info)
return -ENOMEM;
trans = btrfs_start_transaction_fallback_global_rsv(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;
@@ -3803,7 +3801,6 @@ static int del_balance_item(struct btrfs_fs_info *fs_info)
ret = btrfs_del_item(trans, root, path);
out:
- btrfs_free_path(path);
err = btrfs_commit_transaction(trans);
if (err && !ret)
ret = err;
--
2.39.0
next prev parent reply other threads:[~2025-04-08 12:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Yangtao Li [this message]
2025-04-08 14:47 ` [PATCH 2/4] btrfs: use BTRFS_PATH_AUTO_FREE in del_balance_item() 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250408122933.121056-2-frank.li@vivo.com \
--to=frank.li@vivo.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®