cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] Re: [PATCH] GFS2: remove division from new statfs code
Date: Tue, 27 Oct 2009 09:31:30 +0000	[thread overview]
Message-ID: <1256635890.2669.8.camel@localhost.localdomain> (raw)
In-Reply-To: <20091026182946.GA3555@ether.msp.redhat.com>

Hi,

Now in the -nmw git tree. Thanks,

Steve.

On Mon, 2009-10-26 at 13:29 -0500, Benjamin Marzinski wrote:
> It's not necessary to do any 64bit division for the statfs sync code, so
> remove it.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  fs/gfs2/super.c |   17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> Index: gfs2-2.6-nmw/fs/gfs2/super.c
> ===================================================================
> --- gfs2-2.6-nmw.orig/fs/gfs2/super.c
> +++ gfs2-2.6-nmw/fs/gfs2/super.c
> @@ -472,7 +472,8 @@ void gfs2_statfs_change(struct gfs2_sbd 
>  	struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local;
>  	struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
>  	struct buffer_head *l_bh;
> -	int percent, sync_percent;
> +	s64 x, y;
> +	int need_sync = 0;
>  	int error;
>  
>  	error = gfs2_meta_inode_buffer(l_ip, &l_bh);
> @@ -486,16 +487,16 @@ void gfs2_statfs_change(struct gfs2_sbd 
>  	l_sc->sc_free += free;
>  	l_sc->sc_dinodes += dinodes;
>  	gfs2_statfs_change_out(l_sc, l_bh->b_data + sizeof(struct gfs2_dinode));
> -	if (m_sc->sc_free)
> -		percent = (100 * l_sc->sc_free) / m_sc->sc_free;
> -	else
> -		percent = 100;
> +	if (sdp->sd_args.ar_statfs_percent) {
> +		x = 100 * l_sc->sc_free;
> +		y = m_sc->sc_free * sdp->sd_args.ar_statfs_percent;
> +		if (x >= y || x <= -y)
> +			need_sync = 1;
> +	}
>  	spin_unlock(&sdp->sd_statfs_spin);
>  
>  	brelse(l_bh);
> -	sync_percent = sdp->sd_args.ar_statfs_percent;
> -	if (sync_percent && (percent >= sync_percent ||
> -			     percent <= -sync_percent))
> +	if (need_sync)
>  		gfs2_wake_up_statfs(sdp);
>  }
>  



      reply	other threads:[~2009-10-27  9:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 18:29 [Cluster-devel] [PATCH] GFS2: remove division from new statfs code Benjamin Marzinski
2009-10-27  9:31 ` Steven Whitehouse [this message]

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=1256635890.2669.8.camel@localhost.localdomain \
    --to=swhiteho@redhat.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;
as well as URLs for NNTP newsgroup(s).