aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_alloc_btree.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-08 08:34:18 -0400
committerChristoph Hellwig <hch@lst.de>2011-07-08 08:34:18 -0400
commitdec58f1dfd30a3c3e9dadc808692f4e5cd922745 (patch)
tree42af1ab01493325e860e5cbf4245c6b39dd6e951 /fs/xfs/xfs_alloc_btree.c
parentdbcdde3e76f45d56c4a30ca6c5d69b6d473d3fd1 (diff)
xfs: work around bogus gcc warning in xfs_allocbt_init_cursor
GCC 4.6 complains about an array subscript is above array bounds when using the btree index to index into the agf_levels array. The only two indices passed in are 0 and 1, and we have an assert insuring that. Replace the trick of using the array index directly with using constants in the already existing branch for assigning the XFS_BTREE_LASTREC_UPDATE flag. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_alloc_btree.c')
-rw-r--r--fs/xfs/xfs_alloc_btree.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c
index 2b3518826a69..e277777a7cf9 100644
--- a/fs/xfs/xfs_alloc_btree.c
+++ b/fs/xfs/xfs_alloc_btree.c
@@ -427,13 +427,16 @@ xfs_allocbt_init_cursor(
427 427
428 cur->bc_tp = tp; 428 cur->bc_tp = tp;
429 cur->bc_mp = mp; 429 cur->bc_mp = mp;
430 cur->bc_nlevels = be32_to_cpu(agf->agf_levels[btnum]);
431 cur->bc_btnum = btnum; 430 cur->bc_btnum = btnum;
432 cur->bc_blocklog = mp->m_sb.sb_blocklog; 431 cur->bc_blocklog = mp->m_sb.sb_blocklog;
433
434 cur->bc_ops = &xfs_allocbt_ops; 432 cur->bc_ops = &xfs_allocbt_ops;
435 if (btnum == XFS_BTNUM_CNT) 433
434 if (btnum == XFS_BTNUM_CNT) {
435 cur->bc_nlevels = be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]);
436 cur->bc_flags = XFS_BTREE_LASTREC_UPDATE; 436 cur->bc_flags = XFS_BTREE_LASTREC_UPDATE;
437 } else {
438 cur->bc_nlevels = be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]);
439 }
437 440
438 cur->bc_private.a.agbp = agbp; 441 cur->bc_private.a.agbp = agbp;
439 cur->bc_private.a.agno = agno; 442 cur->bc_private.a.agno = agno;