2021-06-11 12:03:14

by YueHaibing

[permalink] [raw]
Subject: [PATCH -next] xfs: Fix -Wunused-variable warning

If DEBUG is n, gcc warns:

fs/xfs/libxfs/xfs_ialloc.c:2032:20: warning: unused variable ‘agi’ [-Wunused-variable]

Move it info #ifdef block to fix this.

Signed-off-by: YueHaibing <[email protected]>
---
fs/xfs/libxfs/xfs_ialloc.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 2ed6de6faf8a..a9973edd3c0a 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2029,7 +2029,9 @@ xfs_difree_finobt(
xfs_agino_t agino,
struct xfs_inobt_rec_incore *ibtrec) /* inobt record */
{
+#ifdef DEBUG
struct xfs_agi *agi = agbp->b_addr;
+#endif
struct xfs_btree_cur *cur;
struct xfs_inobt_rec_incore rec;
int offset = agino - ibtrec->ir_startino;
--
2.17.1


2021-06-11 12:13:09

by YueHaibing

[permalink] [raw]
Subject: Re: [PATCH -next] xfs: Fix -Wunused-variable warning

PLS ignore this.

On 2021/6/11 19:59, YueHaibing wrote:
> If DEBUG is n, gcc warns:
>
> fs/xfs/libxfs/xfs_ialloc.c:2032:20: warning: unused variable ‘agi’ [-Wunused-variable]
>
> Move it info #ifdef block to fix this.
>
> Signed-off-by: YueHaibing <[email protected]>
> ---
> fs/xfs/libxfs/xfs_ialloc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index 2ed6de6faf8a..a9973edd3c0a 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -2029,7 +2029,9 @@ xfs_difree_finobt(
> xfs_agino_t agino,
> struct xfs_inobt_rec_incore *ibtrec) /* inobt record */
> {
> +#ifdef DEBUG
> struct xfs_agi *agi = agbp->b_addr;
> +#endif
> struct xfs_btree_cur *cur;
> struct xfs_inobt_rec_incore rec;
> int offset = agino - ibtrec->ir_startino;
>