]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: skip unallocated regions of inode chunks in xfs_ifree_cluster()
authorBrian Foster <bfoster@redhat.com>
Thu, 28 May 2015 23:26:03 +0000 (09:26 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 23 Jun 2015 05:08:29 +0000 (15:08 +1000)
commit9ad242402b29a2c3b5502b1ddfb37150512a0273
tree9de7b3873f68ca7e7bddef24cb310ce2f29e881d
parenta6b3ddb44103726fe07e694954746894eca43981
xfs: skip unallocated regions of inode chunks in xfs_ifree_cluster()

xfs_ifree_cluster() is called to mark all in-memory inodes and inode
buffers as stale. This occurs after we've removed the inobt records and
dropped any references of inobt data. xfs_ifree_cluster() uses the
starting inode number to walk the namespace of inodes expected for a
single chunk a cluster buffer at a time. The cluster buffer disk
addresses are calculated by decoding the sequential inode numbers
expected from the chunk.

The problem with this approach is that if the inode chunk being removed
is a sparse chunk, not all of the buffer addresses that are calculated
as part of this sequence may be inode clusters. Attempting to acquire
the buffer based on expected inode characterstics (i.e., cluster length)
can lead to errors and is generally incorrect.

We already use a couple variables to carry requisite state from
xfs_difree() to xfs_ifree_cluster(). Rather than add a third, define a
new internal structure to carry the existing parameters through these
functions. Add an alloc field that represents the physical allocation
bitmap of inodes in the chunk being removed. Modify xfs_ifree_cluster()
to check each inode against the bitmap and skip the clusters that were
never allocated as real inodes on disk.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
libxfs/xfs_ialloc.c
libxfs/xfs_ialloc.h