Commit b33874f
xfs: Stop using __maybe_unused in xfs_alloc.c
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 <[email protected]>
Signed-off-by: John Garry <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Signed-off-by: Chandan Babu R <[email protected]>1 parent d7ba701 commit b33874f
1 file changed
+2
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1008 | 1008 | | |
1009 | 1009 | | |
1010 | 1010 | | |
1011 | | - | |
1012 | 1011 | | |
1013 | 1012 | | |
1014 | 1013 | | |
1015 | 1014 | | |
1016 | 1015 | | |
1017 | | - | |
| 1016 | + | |
1018 | 1017 | | |
1019 | 1018 | | |
1020 | 1019 | | |
| |||
1217 | 1216 | | |
1218 | 1217 | | |
1219 | 1218 | | |
1220 | | - | |
1221 | 1219 | | |
1222 | 1220 | | |
1223 | 1221 | | |
| |||
1297 | 1295 | | |
1298 | 1296 | | |
1299 | 1297 | | |
1300 | | - | |
| 1298 | + | |
1301 | 1299 | | |
1302 | 1300 | | |
1303 | 1301 | | |
| |||
0 commit comments