From: Qu Wenruo <wqu@suse.com>
To: liuh0329 <liuhuan01@kylinos.cn>
Cc: linux-btrfs@vger.kernel.org, quwenruo.btrfs@gmx.com
Subject: Re: [PATCH v3] btrfs-progs: receive: fix unused variable warning without LZO
Date: Wed, 30 Sep 2026 17:09:50 +0930 [thread overview]
Message-ID: <d5d16619-54be-4d1d-ae49-03f48e9fa6b1@suse.com> (raw)
In-Reply-To: <20260930064327.49205-2-liuhuan01@kylinos.cn>
在 2026/9/30 16:13, liuh0329 写道:
> When btrfs-progs is built without LZO support, sector_shift is still
> declared in decompress_and_write(), while all its uses are guarded by
> COMPRESSION_LZO. This results in an unused variable warning.
>
> Move the sector_shift declaration to the LZO-specific code path so it is
> only declared when LZO support is enabled.
>
> Fixes: 345731fff32d ("btrfs-progs: receive: optional build for lzo, zstd")
> Signed-off-by: liuh0329 <liuhuan01@kylinos.cn>
Reviewed-by: Qu Wenruo <wqu@suse.com>
> ---
> Changes in v3:
> - Drop the extra scope and move sector_shift declaration directly to its
> only usage as suggested by Qu Wenruo.
Next time please use more common sense, less brain dead "vibe" coding.
>
> Changes in v2:
> - Move sector_shift declaration to its only usage, as suggested by Qu Wenruo.
> - Add a local scope for sector_shift.
>
> cmds/receive.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/cmds/receive.c b/cmds/receive.c
> index 49103ea3..f592a044 100644
> --- a/cmds/receive.c
> +++ b/cmds/receive.c
> @@ -1186,7 +1186,6 @@ static int decompress_and_write(struct btrfs_receive *rctx,
> {
> int ret = 0;
> char *unencoded_data;
> - int sector_shift = 0;
> u64 written = 0;
>
> unencoded_data = calloc(unencoded_len, 1);
> @@ -1220,7 +1219,7 @@ static int decompress_and_write(struct btrfs_receive *rctx,
> case BTRFS_ENCODED_IO_COMPRESSION_LZO_32K:
> case BTRFS_ENCODED_IO_COMPRESSION_LZO_64K:
> #if COMPRESSION_LZO
> - sector_shift =
> + int sector_shift =
> compression - BTRFS_ENCODED_IO_COMPRESSION_LZO_4K + 12;
> ret = decompress_lzo(encoded_data, encoded_len, unencoded_data,
> unencoded_len, 1U << sector_shift);
prev parent reply other threads:[~2026-09-30 7:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-29 7:14 [PATCH] btrfs-progs: receive: fix unused variable warning without LZO liuh0329
2026-09-29 10:37 ` Qu Wenruo
2026-09-30 2:21 ` [PATCH v2] " liuh0329
2026-09-30 4:59 ` Qu Wenruo
2026-09-30 6:17 ` liuh
2026-09-30 6:43 ` [PATCH v3] " liuh0329
2026-09-30 7:39 ` Qu Wenruo [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=d5d16619-54be-4d1d-ae49-03f48e9fa6b1@suse.com \
--to=wqu@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=liuhuan01@kylinos.cn \
--cc=quwenruo.btrfs@gmx.com \
/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