]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs: Stop using __maybe_unused in xfs_alloc.c
authorJohn Garry <john.g.garry@oracle.com>
Wed, 3 Jul 2024 21:20:57 +0000 (14:20 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 31 Jul 2024 01:45:29 +0000 (18:45 -0700)
commit083e204d57ac884ccd4c22a8a0d9e9cebdc5e56c
treee138afb53443562dfa2623cb92bb0163d2c4fe5c
parentbaa5bf2e2aafd303f92879e728e9a72339032afe
xfs: Stop using __maybe_unused in xfs_alloc.c

Source kernel commit: b33874fb7f28326380562f208d948bab785fbd6f

In both xfs_alloc_cur_finish() and xfs_alloc_ag_vextent_exact(), local
variable @afg is tagged as __maybe_unused. Otherwise an unused variable
warning would be generated for when building with W=1 and CONFIG_XFS_DEBUG
unset. In both cases, the variable is unused as it is only referenced in
an ASSERT() call, which is compiled out (in this config).

It is generally a poor programming style to use __maybe_unused for
variables.

The ASSERT() call is to verify that agbno of the end of the extent is
within bounds for both functions. @afg is used as an intermediate variable
to find the AG length.

However xfs_verify_agbext() already exists to verify a valid extent range.
The arguments for calling xfs_verify_agbext() are already available, so use
that instead.

An advantage of using xfs_verify_agbext() is that it verifies that both the
start and the end of the extent are within the bounds of the AG and
catches overflows.

Suggested-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
libxfs/xfs_alloc.c