Re: [PATCH 17/18] xfs: use actual inode count for sparse records in bulkstat/inumbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 24, 2014 at 10:23:07AM -0400, Brian Foster wrote:
> The bulkstat and inumbers mechanisms make the assumption that inode
> records consist of a full 64 inode chunk in several places. E.g., this
> is used to track how many inodes have been processed overall as well as
> to determine when all in-use inodes of a record have been processed. The
> record processing, in particular, increments the record freecount for
> each in-use inode until it hits the expected max of 64.
> 
> This is invalid for sparse inode records. While all inodes might be
> marked free in the free mask regardless of whether they are allocated on
> disk, ir_freecount is based on the total number of physically allocated
> inodes and thus may be less than 64 inodes on a completely free inode
> chunk.
> 
> Create the xfs_inobt_count() helper to calculate the total number of
> physically allocated inodes based on the holemask. Use the helper in
> xfs_bulkstat() and xfs_inumbers() instead of the fixed
> XFS_INODE_PER_CHUNK value to ensure correct accounting in the event of
> sparse inode records.
> 
> Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
> ---
>  fs/xfs/libxfs/xfs_ialloc.c | 27 +++++++++++++++++++++++++++
>  fs/xfs/libxfs/xfs_ialloc.h |  5 +++++
>  fs/xfs/xfs_itable.c        | 12 +++++++-----
>  3 files changed, 39 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index 86c6ccd..daf317f 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -951,6 +951,33 @@ xfs_inobt_first_free_inode(
>  }
>  
>  /*
> + * Calculate the real count of inodes in a chunk.
> + */
> +int
> +xfs_inobt_count(
> +	struct xfs_inobt_rec_incore	*rec)
> +{
> +	__uint16_t	allocmask;
> +	uint		allocbitmap;
> +	int		nextbit;
> +	int		count = 0;
> +
> +	if (!xfs_inobt_issparse(rec))
> +		return XFS_INODES_PER_CHUNK;
> +
> +	allocmask = ~rec->ir_holemask;
> +	allocbitmap = allocmask;
> +
> +	nextbit = xfs_next_bit(&allocbitmap, 1, 0);
> +	while (nextbit != -1) {
> +		count += XFS_INODES_PER_SPCHUNK;
> +		nextbit = xfs_next_bit(&allocbitmap, 1, nextbit + 1);
> +	}

	bitmap_weight() * XFS_INODES_PER_SPCHUNK?

-Dave
-- 
Dave Chinner
david@xxxxxxxxxxxxx

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux