diff options
Diffstat (limited to 'fs/xfs/libxfs/xfs_ialloc.c')
| -rw-r--r-- | fs/xfs/libxfs/xfs_ialloc.c | 36 | 
1 files changed, 21 insertions, 15 deletions
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index b83e54c70906..2361a22035b0 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c @@ -95,18 +95,28 @@ xfs_inobt_btrec_to_irec(  	irec->ir_free = be64_to_cpu(rec->inobt.ir_free);  } +/* Compute the freecount of an incore inode record. */ +uint8_t +xfs_inobt_rec_freecount( +	const struct xfs_inobt_rec_incore	*irec) +{ +	uint64_t				realfree = irec->ir_free; + +	if (xfs_inobt_issparse(irec->ir_holemask)) +		realfree &= xfs_inobt_irec_to_allocmask(irec); +	return hweight64(realfree); +} +  /* Simple checks for inode records. */  xfs_failaddr_t  xfs_inobt_check_irec( -	struct xfs_btree_cur			*cur, +	struct xfs_perag			*pag,  	const struct xfs_inobt_rec_incore	*irec)  { -	uint64_t			realfree; -  	/* Record has to be properly aligned within the AG. */ -	if (!xfs_verify_agino(cur->bc_ag.pag, irec->ir_startino)) +	if (!xfs_verify_agino(pag, irec->ir_startino))  		return __this_address; -	if (!xfs_verify_agino(cur->bc_ag.pag, +	if (!xfs_verify_agino(pag,  				irec->ir_startino + XFS_INODES_PER_CHUNK - 1))  		return __this_address;  	if (irec->ir_count < XFS_INODES_PER_HOLEMASK_BIT || @@ -115,12 +125,7 @@ xfs_inobt_check_irec(  	if (irec->ir_freecount > XFS_INODES_PER_CHUNK)  		return __this_address; -	/* if there are no holes, return the first available offset */ -	if (!xfs_inobt_issparse(irec->ir_holemask)) -		realfree = irec->ir_free; -	else -		realfree = irec->ir_free & xfs_inobt_irec_to_allocmask(irec); -	if (hweight64(realfree) != irec->ir_freecount) +	if (xfs_inobt_rec_freecount(irec) != irec->ir_freecount)  		return __this_address;  	return NULL; @@ -164,7 +169,7 @@ xfs_inobt_get_rec(  		return error;  	xfs_inobt_btrec_to_irec(mp, rec, irec); -	fa = xfs_inobt_check_irec(cur, irec); +	fa = xfs_inobt_check_irec(cur->bc_ag.pag, irec);  	if (fa)  		return xfs_inobt_complain_bad_rec(cur, fa, irec); @@ -1854,7 +1859,7 @@ xfs_difree_inode_chunk(  		return xfs_free_extent_later(tp,  				XFS_AGB_TO_FSB(mp, agno, sagbno),  				M_IGEO(mp)->ialloc_blks, &XFS_RMAP_OINFO_INODES, -				XFS_AG_RESV_NONE); +				XFS_AG_RESV_NONE, false);  	}  	/* holemask is only 16-bits (fits in an unsigned long) */ @@ -1900,7 +1905,8 @@ xfs_difree_inode_chunk(  		ASSERT(contigblk % mp->m_sb.sb_spino_align == 0);  		error = xfs_free_extent_later(tp,  				XFS_AGB_TO_FSB(mp, agno, agbno), contigblk, -				&XFS_RMAP_OINFO_INODES, XFS_AG_RESV_NONE); +				&XFS_RMAP_OINFO_INODES, XFS_AG_RESV_NONE, +				false);  		if (error)  			return error; @@ -2739,7 +2745,7 @@ xfs_ialloc_count_inodes_rec(  	xfs_failaddr_t			fa;  	xfs_inobt_btrec_to_irec(cur->bc_mp, rec, &irec); -	fa = xfs_inobt_check_irec(cur, &irec); +	fa = xfs_inobt_check_irec(cur->bc_ag.pag, &irec);  	if (fa)  		return xfs_inobt_complain_bad_rec(cur, fa, &irec);  |