All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Miquel Sabaté Solà" <mssola@mssola.com>
To: Filipe Manana <fdmanana@kernel.org>
Cc: Burenchev Evgenii <EBurenchev@orionsoft.ru>,
	 "clm@fb.com" <clm@fb.com>, "dsterba@suse.com" <dsterba@suse.com>,
	 "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>
Subject: Re: [PATCH] btrfs: remove dead assignment to dirid in btrfs_search_path_in_tree()
Date: Tue, 17 Feb 2026 12:23:35 +0100	[thread overview]
Message-ID: <87ikbvtxzc.fsf@> (raw)
In-Reply-To: <CAL3q7H7x3ZRYXBkMjyA1UihWr8FUz4NQE1nR+thc9Q3g7rwd3w@mail.gmail.com> (Filipe Manana's message of "Tue, 17 Feb 2026 10:53:14 +0000")

[-- Attachment #1: Type: text/plain, Size: 2829 bytes --]

Filipe Manana @ 2026-02-17 10:53 GMT:

> On Tue, Feb 17, 2026 at 10:18 AM Miquel Sabaté Solà <mssola@mssola.com> wrote:
>>
>> Hello,
>>
>> Burenchev Evgenii @ 2026-02-16 16:16 GMT:
>>
>> > From ff2df73ba6483b0dc67b3ed89d2a43c49f1c2eb8 Mon Sep 17 00:00:00 2001
>> > From: Evgenii Burenchev <eburenchev@orionsoft.ru>
>> > 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.
>> >
>> > Signed-off-by: Evgenii Burenchev <eburenchev@orionsoft.ru>
>> > ---
>> >  fs/btrfs/ioctl.c | 1 -
>> >  1 file changed, 1 deletion(-)
>> >
>> > diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
>> > index a6cc2d3b414c..292043b11207 100644
>> > --- a/fs/btrfs/ioctl.c
>> > +++ b/fs/btrfs/ioctl.c
>> > @@ -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.
>

Got it, thanks for the explanation!

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 897 bytes --]

      reply	other threads:[~2026-02-17 11:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16 16:16 [PATCH] btrfs: remove dead assignment to dirid in btrfs_search_path_in_tree() Burenchev Evgenii
2026-02-17  9:37 ` Fedor Pchelkin
2026-02-17 10:17 ` Miquel Sabaté Solà
     [not found] ` <6994405b.170a0220.24287.89ffSMTPIN_ADDED_BROKEN@mx.google.com>
2026-02-17 10:53   ` Filipe Manana
2026-02-17 11:23     ` Miquel Sabaté Solà [this message]

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=87ikbvtxzc.fsf@ \
    --to=mssola@mssola.com \
    --cc=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 \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.