From: Burenchev Evgenii <EBurenchev@orionsoft.ru>
To: "clm@fb.com" <clm@fb.com>, "dsterba@suse.com" <dsterba@suse.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>,
"mssola@mssola.com" <mssola@mssola.com>,
"fdmanana@kernel.org" <fdmanana@kernel.org>
Subject: [PATCH] btrfs: perform a minor cleanup in btrfs_search_path_in_tree()
Date: Thu, 19 Feb 2026 17:55:32 +0000 [thread overview]
Message-ID: <5a31d815257543b689373583411428b0@orionsoft.ru> (raw)
After the introduction of btrfs_search_backwards(), the directory
traversal state in btrfs_search_path_in_tree() is fully maintained via
struct btrfs_key. The local variable 'dirid' is no longer used to control
the search and the assignment
dirid = key.objectid;
has no observable effect and is dead code.
Also initialize ret at declaration and remove a redundant
"ret = 0;" before out:.
Remove the unused assignment to avoid confusion and silence static
analysis warnings.
No functional change.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Evgenii Burenchev <eburenchev@orionsoft.ru>
---
fs/btrfs/ioctl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index a6cc2d3b414c..d85e6a92538e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1648,7 +1648,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
struct btrfs_root *root;
struct btrfs_key key;
char *ptr;
- int ret = -1;
+ int ret = 0;
int slot;
int len;
int total_len = 0;
@@ -1708,11 +1708,9 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
btrfs_release_path(path);
key.objectid = key.offset;
key.offset = (u64)-1;
- dirid = key.objectid;
}
memmove(name, ptr, total_len);
name[total_len] = '\0';
- ret = 0;
out:
btrfs_put_root(root);
return ret;
--
2.43.0
next reply other threads:[~2026-02-19 17:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 17:55 Burenchev Evgenii [this message]
2026-02-24 17:28 ` [PATCH] btrfs: perform a minor cleanup in btrfs_search_path_in_tree() David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5a31d815257543b689373583411428b0@orionsoft.ru \
--to=eburenchev@orionsoft.ru \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=mssola@mssola.com \
/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