• B
    xfs: skip unallocated regions of inode chunks in xfs_ifree_cluster() · 09b56604
    Brian Foster 提交于
    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: NBrian Foster <bfoster@redhat.com>
    Reviewed-by: NDave Chinner <dchinner@redhat.com>
    Signed-off-by: NDave Chinner <david@fromorbit.com>
    09b56604
xfs_ialloc.h 5.5 KB