xfs: use actual inode count for sparse records in bulkstat/inumbers
authorBrian Foster <bfoster@redhat.com>
Thu, 28 May 2015 23:04:19 +0000 (09:04 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 28 May 2015 23:04:19 +0000 (09:04 +1000)
commit12d0714d4bdd591d9cd3bce692c831da2c2a0cfc
tree5e919645cc4dc59b1571dfdaa81b5b9eb9bd8512
parent5419040fc0f3afc31c857b4d7f006bd9afbdb462
xfs: use actual inode count for sparse records in bulkstat/inumbers

The bulkstat and inumbers mechanisms make the assumption that inode
records consist of a full 64 inode chunk in several places. For example,
this is used to track how many inodes have been processed overall as
well as to determine whether a record has allocated inodes that must be
handled.

This assumption is invalid for sparse inode records. While sparse inodes
will be marked as free in the ir_free mask, they are not accounted as
free in ir_freecount because they cannot be allocated. Therefore,
ir_freecount may be less than 64 inodes in an inode record for which all
physically allocated inodes are free (and in turn ir_freecount < 64 does
not signify that the record has allocated inodes).

The new in-core inobt record format includes the ir_count field. This
holds the number of true, physical inodes tracked by the record. The
in-core ir_count field is always valid as it is hardcoded to
XFS_INODES_PER_CHUNK when sparse inodes is not enabled. Use ir_count to
handle inode records correctly in bulkstat in a generic manner.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_itable.c