]> 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>
Thu, 30 Jul 2015 23:14:07 +0000 (09:14 +1000)
commit5a3b2e0a09bc8ff90e93b1f81376ead5075579f4
tree302d0e0314e77bc2215703f360882b15c87a2fbc
parent7338c4b865c782aaba07f5ee0c6e56380f1467b1
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