xfs: allow inode allocations in post-growfs disk space
authorEric Sandeen <sandeen@redhat.com>
Thu, 24 Jul 2014 10:51:54 +0000 (20:51 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 24 Jul 2014 10:51:54 +0000 (20:51 +1000)
commit9de67c3ba9ea961ba420573d56479d09d33a7587
treed173aa82969c02f0b8d275e9618d170652e0afa1
parenteb866bbf095ec68552c0583199208858618498e3
xfs: allow inode allocations in post-growfs disk space

Today, if we perform an xfs_growfs which adds allocation groups,
mp->m_maxagi is not properly updated when the growfs is complete.

Therefore inodes will continue to be allocated only in the
AGs which existed prior to the growfs, and the new space
won't be utilized.

This is because of this path in xfs_growfs_data_private():

xfs_growfs_data_private
xfs_initialize_perag(mp, nagcount, &nagimax);
if (mp->m_flags & XFS_MOUNT_32BITINODES)
index = xfs_set_inode32(mp);
else
index = xfs_set_inode64(mp);

if (maxagi)
*maxagi = index;

where xfs_set_inode* iterates over the (old) agcount in
mp->m_sb.sb_agblocks, which has not yet been updated
in the growfs path.  So "index" will be returned based on
the old agcount, not the new one, and new AGs are not available
for inode allocation.

Fix this by explicitly passing the proper AG count (which
xfs_initialize_perag() already has) down another level,
so that xfs_set_inode* can make the proper decision about
acceptable AGs for inode allocation in the potentially
newly-added AGs.

This has been broken since 3.7, when these two
xfs_set_inode* functions were added in commit 2d2194f.
Prior to that, we looped over "agcount" not sb_agblocks
in these calculations.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_mount.c
fs/xfs/xfs_super.c
fs/xfs/xfs_super.h