[PATCH v2 1/2] btrfs: remove dead assignment to dirid in btrfs_search_path_in_tree()

From: Burenchev Evgenii

Date: Wed Feb 25 2026 - 07:41:47 EST



Related discussion: https://lore.kernel.org/linux-btrfs/20260224172835.GB26902@xxxxxxxxxxxxx

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 assignment:

dirid = key.objectid;

no longer affects control flow and is dead code.

Remove the unused assignment to avoid confusion and silence static analysis
warnings.

No functional change.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Changes since v1:
- split from original patch

Signed-off-by: Evgenii Burenchev <eburenchev@xxxxxxxxxxxx>
---
fs/btrfs/ioctl.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index ae2173235c4d..3a45ee1a7026 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1707,7 +1707,6 @@ 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';
--
2.43.0