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.