Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: David Sterba <dsterba@suse.cz>
Cc: stable@vger.kernel.org, David Sterba <dsterba@suse.com>
Subject: Re: [PATCH 6.6.y 2/2] btrfs: constify more pointer parameters
Date: Tue, 19 Aug 2025 10:32:18 -0400	[thread overview]
Message-ID: <aKSK8rNSFR3TrhH3@laps> (raw)
In-Reply-To: <20250819121837.GR22430@suse.cz>

On Tue, Aug 19, 2025 at 02:18:37PM +0200, David Sterba wrote:
>On Mon, Aug 18, 2025 at 10:27:53PM -0400, Sasha Levin wrote:
>> From: David Sterba <dsterba@suse.com>
>>
>> [ Upstream commit ca283ea9920ac20ae23ed398b693db3121045019 ]
>>
>> Continue adding const to parameters.  This is for clarity and minor
>> addition to safety. There are some minor effects, in the assembly code
>> and .ko measured on release config.
>>
>> Signed-off-by: David Sterba <dsterba@suse.com>
>> Signed-off-by: Sasha Levin <sashal@kernel.org>
>
>What's the rationale for adding this to stable? Parameter constification
>is for programmers and to have cleaner interfaces but there's hardly any
>stability improvement.

When patches that assume that params are consts get backported, they tend to
break the build on older trees that don't have these "constification" changes.

In this case, without this patch, backporting 807d9023e75f ("btrfs: fix
ssd_spread overallocation") will cause the build error below, which is what
made Greg generate this FAILED email:

fs/btrfs/extent-tree.c: In function ‘find_free_extent_check_size_class’:
fs/btrfs/extent-tree.c:3538:54: error: passing argument 1 of ‘btrfs_block_group_should_use_size_class’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  3538 |         if (!btrfs_block_group_should_use_size_class(bg))
       |                                                      ^~
In file included from fs/btrfs/extent-tree.h:7,
                  from fs/btrfs/extent-tree.c:20:
fs/btrfs/block-group.h:375:72: note: expected ‘struct btrfs_block_group *’ but argument is of type ‘const struct btrfs_block_group *’
   375 | bool btrfs_block_group_should_use_size_class(struct btrfs_block_group *bg);
       |                                              ~~~~~~~~~~~~~~~~~~~~~~~~~~^~

So we take the constification patch to fix the issue.

-- 
Thanks,
Sasha

      reply	other threads:[~2025-08-19 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18 10:59 FAILED: patch "[PATCH] btrfs: fix ssd_spread overallocation" failed to apply to 6.6-stable tree gregkh
2025-08-19  2:27 ` [PATCH 6.6.y 1/2] btrfs: fix ssd_spread overallocation Sasha Levin
2025-08-19  2:27   ` [PATCH 6.6.y 2/2] btrfs: constify more pointer parameters Sasha Levin
2025-08-19 12:18     ` David Sterba
2025-08-19 14:32       ` Sasha Levin [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=aKSK8rNSFR3TrhH3@laps \
    --to=sashal@kernel.org \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=stable@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