Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: liuh0329 <liuhuan01@kylinos.cn>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: receive: fix unused variable warning without LZO
Date: Tue, 29 Sep 2026 20:07:19 +0930	[thread overview]
Message-ID: <1ba84f08-92d8-4add-9e19-82f47446de87@gmx.com> (raw)
In-Reply-To: <20260929071421.1114640-2-liuhuan01@kylinos.cn>



在 2026/9/29 16:44, 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.
> 
> Guard the declaration with COMPRESSION_LZO as well.

Just move the declaration to the only usage.

That makes more sense than introducing new #if block.
> 
> Fixes: 345731fff32d ("btrfs-progs: receive: optional build for lzo, zstd")
> Signed-off-by: liuh0329 <liuhuan01@kylinos.cn>
> ---
>   cmds/receive.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/cmds/receive.c b/cmds/receive.c
> index 49103ea3..14a9ba03 100644
> --- a/cmds/receive.c
> +++ b/cmds/receive.c
> @@ -1186,7 +1186,9 @@ static int decompress_and_write(struct btrfs_receive *rctx,
>   {
>   	int ret = 0;
>   	char *unencoded_data;
> +#if COMPRESSION_LZO
>   	int sector_shift = 0;
> +#endif
>   	u64 written = 0;
>   
>   	unencoded_data = calloc(unencoded_len, 1);


  reply	other threads:[~2026-09-29 10:37 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 [this message]
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

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=1ba84f08-92d8-4add-9e19-82f47446de87@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=liuhuan01@kylinos.cn \
    /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