public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 2/3] [PATCH 2/3] xfs: do not use xfs_mod_incore_sb for per-cpu counters
Date: Wed, 29 Sep 2010 21:39:14 +1000	[thread overview]
Message-ID: <20100929113914.GP5665@dastard> (raw)
In-Reply-To: <20100929072238.162539532@bombadil.infradead.org>

On Wed, Sep 29, 2010 at 03:22:23AM -0400, Christoph Hellwig wrote:
> Export xfs_icsb_modify_counters and always use it for modifying the per-cpu
> counters.  Remove support for per-cpu counters from xfs_mod_incore_sb to
> simplify it.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good. Couple of things, though.

>  			nblks += cur->bc_private.b.allocated;
>  		ASSERT(nblks <= da_old);
>  		if (nblks < da_old)
> -			xfs_mod_incore_sb(ip->i_mount, XFS_SBS_FDBLOCKS,
> +			xfs_icsb_modify_counters(ip->i_mount, XFS_SBS_FDBLOCKS,
>  				(int64_t)(da_old - nblks), rsvd);
>  	}
>  	/*
> @@ -1078,8 +1078,8 @@ xfs_bmap_add_extent_delay_real(
>  		temp2 = xfs_bmap_worst_indlen(ip, temp2);
>  		diff = (int)(temp + temp2 - startblockval(PREV.br_startblock) -
>  			(cur ? cur->bc_private.b.allocated : 0));
> -		if (diff > 0 &&
> -		    xfs_mod_incore_sb(ip->i_mount, XFS_SBS_FDBLOCKS, -((int64_t)diff), rsvd)) {
> +		if (diff > 0 && xfs_icsb_modify_counters(ip->i_mount,
> +				XFS_SBS_FDBLOCKS, -((int64_t)diff), rsvd)) {

Not sure I like the indenting of the second line. I'd prefer the
parameters to have a little more indent or use three lines...

>  int
>  xfs_mod_incore_sb(
> -	xfs_mount_t	*mp,
> -	xfs_sb_field_t	field,
> -	int64_t		delta,
> -	int		rsvd)
> +	struct xfs_mount	*mp,
> +	xfs_sb_field_t		field,
> +	int64_t			delta,
> +	int			rsvd)
>  {
> -	int	status;
> +	int			status;
>  
> -	/* check for per-cpu counters */
> -	switch (field) {
> -#ifdef HAVE_PERCPU_SB
> -	case XFS_SBS_ICOUNT:
> -	case XFS_SBS_IFREE:
> -	case XFS_SBS_FDBLOCKS:
> -		status = xfs_icsb_modify_counters(mp, field, delta, rsvd);
> -		break;
> -#endif
> -	default:
> -		spin_lock(&mp->m_sb_lock);
> -		status = xfs_mod_incore_sb_unlocked(mp, field, delta, rsvd);
> -		spin_unlock(&mp->m_sb_lock);
> -		break;
> -	}
> +	ASSERT(field < XFS_SBS_ICOUNT || field > XFS_SBS_FDBLOCKS);

That assert will cause issues with:

> @@ -97,6 +99,8 @@ extern void	xfs_icsb_sync_counters_locke
>  #define xfs_icsb_reinit_counters(mp)		do { } while (0)
>  #define xfs_icsb_sync_counters(mp, flags)	do { } while (0)
>  #define xfs_icsb_sync_counters_locked(mp, flags) do { } while (0)
> +#define xfs_icsb_modify_counters(mp, field, delta, rsvd) \
> +	xfs_mod_incore_sb(mp, field, delta, rsvd)
>  #endif

UP builds. Perhaps a CONFIG_SMP only assert? Given that the per-cpu
counter rework I'm doing doesn't have a different code path for
UP vs SMP, it'd only be a temporary concern....

>  undo_blocks:
>  	if (blocks > 0) {
> -		(void) xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FDBLOCKS,
> +		(void) xfs_icsb_modify_counters(tp->t_mountp, XFS_SBS_FDBLOCKS,
>  					 (int64_t)blocks, rsvd);

You can kill the (void) cast there.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2010-09-29 11:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-29  7:22 [PATCH 0/3] clean up superblock modification helpers Christoph Hellwig
2010-09-29  7:22 ` [PATCH 1/3] [PATCH 1/3] xfs: remove XFS_MOUNT_NO_PERCPU_SB Christoph Hellwig
2010-09-29 11:29   ` Dave Chinner
2010-09-29 11:49   ` Alex Elder
2010-09-29  7:22 ` [PATCH 2/3] [PATCH 2/3] xfs: do not use xfs_mod_incore_sb for per-cpu counters Christoph Hellwig
2010-09-29 11:39   ` Dave Chinner [this message]
2010-09-29 11:45     ` Christoph Hellwig
2010-09-29 12:06   ` Alex Elder
2010-09-29  7:22 ` [PATCH 3/3] [PATCH 3/3] xfs: do not use xfs_mod_incore_sb_batch " Christoph Hellwig
2010-09-29 11:27   ` Dave Chinner
2010-09-29 11:45     ` Christoph Hellwig
2010-09-29 12:26   ` Alex Elder
  -- strict thread matches above, loose matches on Subject: below --
2010-09-30  2:25 [PATCH 0/3] streamline superblock modification helpers V2 Christoph Hellwig
2010-09-30  2:25 ` [PATCH 2/3] [PATCH 2/3] xfs: do not use xfs_mod_incore_sb for per-cpu counters Christoph Hellwig
2010-10-01 13:56   ` Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100929113914.GP5665@dastard \
    --to=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox