btrfs: remove dead assignment to dirid in btrfs_search_path_in_tree()
PATCH 1/1 btrfs: remove dead assignment to dirid in btrfs_search_path_in_tree()
From ff2df73ba6483b0dc67b3ed89d2a43c49f1c2eb8 Mon Sep 17 00:00:00 2001
From: Evgenii Burenchev <[email protected]>
Date: Mon, 16 Feb 2026 18:39:30 +0300
Subject: [PATCH] btrfs: remove dead assignment to dirid in
btrfs_search_path_in_tree()
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.
Remove the unused assignment to avoid confusion and silence static analysis warnings.
No functional change.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- fs/btrfs/ioctl.c | 1 - 1 file changed, 1 deletion(-)
fs/btrfs/ioctl.c +0 -1
@@ -1708,7 +1708,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' ;
Signature · 1 line
2.43.0
Hi there,
Quoted 5 lines · Burenchev Evgenii
From
ff2df73ba6483b0dc67b3ed89d2a43c49f1c2eb8Mon Sep 17 00:00:00 2001
From: Evgenii Burenchev <[email protected]>
Date: Mon, 16 Feb 2026 18:39:30 +0300
Subject: [PATCH] btrfs: remove dead assignment to dirid in
btrfs_search_path_in_tree()
These headers shouldn't appear inside the body of the patch.
Hello,
Burenchev Evgenii @ 2026-02-16 16:16 GMT:
Quoted 32 lines
From
ff2df73ba6483b0dc67b3ed89d2a43c49f1c2eb8Mon Sep 17 00:00:00 2001
From: Evgenii Burenchev <[email protected]>
Date: Mon, 16 Feb 2026 18:39:30 +0300
Subject: [PATCH] btrfs: remove dead assignment to dirid in
btrfs_search_path_in_tree()After the introduction of
btrfs_search_backwards(), the directory traversal state inbtrfs_search_path_in_tree()is fully maintained via structbtrfs_key. The local variable 'dirid' is no longer used to control the search and the assignmentdirid = key.objectid;has no observable effect 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.
Signed-off-by Evgenii Burenchev <[email protected]>--- fs/btrfs/ioctl.c | 1 - 1 file changed, 1 deletion(-)fs/btrfs/ioctl.c +0
-0
fs/btrfs/ioctl.c static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, · line 1713
Quoted 7 lines
fs/btrfs/ioctl.c +0
-1@@ -1708,7 +1708,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' ;
I would add a Fixes tag with the commit that made this assignment useless. As far as I can tell this is commit 98d377a0894e ("Btrfs: don't miss inode ref items in BTRFS_IOC_INO_LOOKUP"), which made the update inside of the loop of 'dirid' no longer needed. This way it's easier to track from where this was no longer needed and whether that's really the case.
Other than that, and taking a quick look at this function, I can already tell that the 'ret' variable could be initialized to 0 in the beginning and make the last assignment to it (just before the "out" label) not needed. Hence, while we are at it, could you also remove that assignment?
Cheers,
Miquel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 32 lines · Miquel Sabaté Solà
Hello,
Burenchev Evgenii @ 2026-02-16 16:16 GMT:
Quoted 27 lines
From
ff2df73ba6483b0dc67b3ed89d2a43c49f1c2eb8Mon Sep 17 00:00:00 2001
From: Evgenii Burenchev <[email protected]>
Date: Mon, 16 Feb 2026 18:39:30 +0300
Subject: [PATCH] btrfs: remove dead assignment to dirid in
btrfs_search_path_in_tree()After the introduction of
btrfs_search_backwards(), the directory traversal state inbtrfs_search_path_in_tree()is fully maintained via structbtrfs_key. The local variable 'dirid' is no longer used to control the search and the assignmentdirid = key.objectid;has no observable effect 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.
Signed-off-by Evgenii Burenchev <[email protected]>--- fs/btrfs/ioctl.c | 1 - 1 file changed, 1 deletion(-)
Quoted 15 lines
fs/btrfs/ioctl.c static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, · line 1713
Quoted 12 lines
fs/btrfs/ioctl.c +0
-1@@ -1708,7 +1708,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' ;I would add a Fixes tag with the commit that made this assignment useless.
No. We add Fixes tags for patches we want to backport to stable releases, things that fix a problem affecting users, like functional bugs or performance regressions for example.
For cleanups, removing unnecessary code, we don't want a Fixes tag, as that will trigger unnecessary backport overhead.
Quoted 14 lines
As far as I can tell this is commit
98d377a0894e("Btrfs: don't miss inode ref items inBTRFS_IOC_INO_LOOKUP"), which made the update inside of the loop of 'dirid' no longer needed. This way it's easier to track from where this was no longer needed and whether that's really the case.Other than that, and taking a quick look at this function, I can already tell that the 'ret' variable could be initialized to 0 in the beginning and make the last assignment to it (just before the "out" label) not needed. Hence, while we are at it, could you also remove that assignment?
Cheers,
Miquel
Filipe Manana @ 2026-02-17 10:53 GMT:
Quoted 49 lines · Miquel Sabaté Solà
Quoted 32 lines
Hello,
Burenchev Evgenii @ 2026-02-16 16:16 GMT:
Quoted 27 lines
From
ff2df73ba6483b0dc67b3ed89d2a43c49f1c2eb8Mon Sep 17 00:00:00 2001
From: Evgenii Burenchev <[email protected]>
Date: Mon, 16 Feb 2026 18:39:30 +0300
Subject: [PATCH] btrfs: remove dead assignment to dirid in
btrfs_search_path_in_tree()After the introduction of
btrfs_search_backwards(), the directory traversal state inbtrfs_search_path_in_tree()is fully maintained via structbtrfs_key. The local variable 'dirid' is no longer used to control the search and the assignmentdirid = key.objectid;has no observable effect 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.
Signed-off-by Evgenii Burenchev <[email protected]>--- fs/btrfs/ioctl.c | 1 - 1 file changed, 1 deletion(-)Quoted 15 lines
fs/btrfs/ioctl.c static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, · line 1713
Quoted 12 lines
fs/btrfs/ioctl.c +0
-1@@ -1708,7 +1708,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' ;I would add a Fixes tag with the commit that made this assignment useless.
Quoted 6 lines
No. We add Fixes tags for patches we want to backport to stable releases, things that fix a problem affecting users, like functional bugs or performance regressions for example.
For cleanups, removing unnecessary code, we don't want a Fixes tag, as that will trigger unnecessary backport overhead.
Got it, thanks for the explanation!
Quoted 14 lines
Quoted 14 lines
As far as I can tell this is commit
98d377a0894e("Btrfs: don't miss inode ref items inBTRFS_IOC_INO_LOOKUP"), which made the update inside of the loop of 'dirid' no longer needed. This way it's easier to track from where this was no longer needed and whether that's really the case.Other than that, and taking a quick look at this function, I can already tell that the 'ret' variable could be initialized to 0 in the beginning and make the last assignment to it (just before the "out" label) not needed. Hence, while we are at it, could you also remove that assignment?
Cheers,
Miquel