[PATCH 3/3] [PATCH 3/3] xfs: do not use xfs_mod_incore_sb_batch for per-cpu counters

Alex Elder aelder at sgi.com
Wed Sep 29 07:26:06 CDT 2010


On Wed, 2010-09-29 at 03:22 -0400, Christoph Hellwig wrote:
> plain text document attachment (xfs-simplify-icsb-updates)
> Update the per-cpu counters manually in xfs_trans_unreserve_and_mod_sb and
> remove support for per-cpu counters from xfs_mod_incore_sb_batch to
> simplify it.  And added benefit is that we don't have to take m_sb_lock
> for transactions that only modify per-cpu counters.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>

Two undo's have the wrong sign, but if that's fixed this
looks good.

Reviewed-by: Alex Elder <aelder at sgi.com> 

. . .

> Index: xfs/fs/xfs/xfs_trans.c
> ===================================================================
> --- xfs.orig/fs/xfs/xfs_trans.c	2010-09-29 13:14:08.521557720 +0900
> +++ xfs/fs/xfs/xfs_trans.c	2010-09-29 13:21:58.164557721 +0900
> @@ -1017,55 +1017,61 @@ xfs_trans_unreserve_and_mod_sb(
. . .
> +
> +	/* apply the per-cpu counters */
> +	if (blkdelta) {
> +		error = xfs_icsb_modify_counters(mp, XFS_SBS_FDBLOCKS,
> +						 blkdelta, rsvd);
> +		if (error)
> +			goto out;
> +	}
> +
> +	if (idelta) {
> +		error = xfs_icsb_modify_counters(mp, XFS_SBS_ICOUNT,
> +						 idelta, rsvd);
> +		if (error)
> +			goto out_undo_fdblocks;
> +	}
> +
> +	if (ifreedelta) {
> +		error = xfs_icsb_modify_counters(mp, XFS_SBS_IFREE,
> +						 ifreedelta, rsvd);
> +		if (error)
> +			goto out_undo_icount;
> +	}
> +
> +	/* apply remaining deltas */
>  
. . .
> +	return;
> +
> +out_undo_ifreecount:
> +	if (ifreedelta)
> +		xfs_icsb_modify_counters(mp, XFS_SBS_IFREE, ifreedelta, rsvd);

*negative* ifreedelta

> +out_undo_icount:
> +	if (idelta)
> +		xfs_icsb_modify_counters(mp, XFS_SBS_ICOUNT, idelta, rsvd);

*negative* idelta

> +out_undo_fdblocks:
> +	if (blkdelta)
> +		xfs_icsb_modify_counters(mp, XFS_SBS_FDBLOCKS, -blkdelta, rsvd);
> +out:






More information about the xfs mailing list