public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@citi.umich.edu>
To: Peter Staubach <staubach@redhat.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 5/7] nfsd4: reshuffle lease-setting code to allow reuse
Date: Sat, 6 Mar 2010 13:31:41 -0500	[thread overview]
Message-ID: <20100306183141.GC22650@fieldses.org> (raw)
In-Reply-To: <4B8E8484.1090009@redhat.com>

On Wed, Mar 03, 2010 at 10:47:16AM -0500, Peter Staubach wrote:
> J. Bruce Fields wrote:
> > We'll soon allow setting the grace period, so we'll want to share this
> > code.
> > 
> > Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
> > ---
> >  fs/nfsd/nfsctl.c |   29 +++++++++++++++++------------
> >  1 files changed, 17 insertions(+), 12 deletions(-)
> > 
> > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> > index 7f70704..1db8010 100644
> > --- a/fs/nfsd/nfsctl.c
> > +++ b/fs/nfsd/nfsctl.c
> > @@ -1203,26 +1203,36 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size)
> >  }
> >  
> >  #ifdef CONFIG_NFSD_V4
> > -static ssize_t __write_leasetime(struct file *file, char *buf, size_t size)
> > +static ssize_t __write_time(struct file *file, char *buf, size_t size, time_t *time)
> >  {
> >  	/* if size > 10 seconds, call
> >  	 * nfs4_reset_lease() then write out the new lease (seconds) as reply
> >  	 */
> >  	char *mesg = buf;
> > -	int rv, lease;
> > +	int rv, i;
> >  
> >  	if (size > 0) {
> >  		if (nfsd_serv)
> >  			return -EBUSY;
> > -		rv = get_int(&mesg, &lease);
> > +		rv = get_int(&mesg, &i);
> >  		if (rv)
> >  			return rv;
> > -		if (lease < 10 || lease > 3600)
> > +		if (i < 10 || i > 3600)
> >  			return -EINVAL;
> > -		nfsd4_lease = lease;
> > +		*time = i;
> >  	}
> >  
> > -	return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n", nfsd4_lease);
> > +	return scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, "%ld\n", *time);
> > +}
> > +
> > +static ssize_t write_time(struct file *file, char *buf, size_t size, time_t *time)
> > +{
> > +	ssize_t rv;
> > +
> > +	mutex_lock(&nfsd_mutex);
> > +	rv = __write_time(file, buf, size, time);
> > +	mutex_unlock(&nfsd_mutex);
> > +	return rv;
> >  }
> >  
> 
> The name, write_time, seems a little generic, doesn't it?  It
> seems to me that it might be lead to easier maintenance to give
> it an NFSv4 related name at least.

Well, since they're static, I thought I could get away with it, but,
fair enough--prepended a "nfsd4_".

--b.

> 
> 	Thanx...
> 
> 		ps
> 
> >  /**
> > @@ -1239,12 +1249,7 @@ static ssize_t __write_leasetime(struct file *file, char *buf, size_t size)
> >   */
> >  static ssize_t write_leasetime(struct file *file, char *buf, size_t size)
> >  {
> > -	ssize_t rv;
> > -
> > -	mutex_lock(&nfsd_mutex);
> > -	rv = __write_leasetime(file, buf, size);
> > -	mutex_unlock(&nfsd_mutex);
> > -	return rv;
> > +	return write_time(file, buf, size, &nfsd4_lease);
> >  }
> >  
> >  extern char *nfs4_recoverydir(void);
> 

  reply	other threads:[~2010-03-06 18:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 23:12 grace period setting J. Bruce Fields
2010-03-02 23:12 ` [PATCH 1/7] nfsd4: simplify references to nfsd4 lease time J. Bruce Fields
2010-03-02 23:12   ` [PATCH 2/7] nfsd4: edit comment for concision J. Bruce Fields
2010-03-02 23:12     ` [PATCH 3/7] nfsd4: simplify lease/grace interaction J. Bruce Fields
2010-03-02 23:12       ` [PATCH 4/7] nfsd4: remove unnecessary lease-setting function J. Bruce Fields
2010-03-02 23:12         ` [PATCH 5/7] nfsd4: reshuffle lease-setting code to allow reuse J. Bruce Fields
2010-03-02 23:12           ` [PATCH 6/7] nfsd4: allow setting grace period time J. Bruce Fields
2010-03-02 23:12             ` [PATCH 7/7] nfsd4: document lease/grace-period limits J. Bruce Fields
2010-03-03 15:47           ` [PATCH 5/7] nfsd4: reshuffle lease-setting code to allow reuse Peter Staubach
2010-03-06 18:31             ` J. Bruce Fields [this message]
2010-03-03 18:06     ` [PATCH 2/7] nfsd4: edit comment for concision Chuck Lever
2010-03-06 18:50       ` J. Bruce Fields
2010-03-08 15:31         ` Chuck Lever
2010-03-08 18:10           ` J. Bruce Fields
2010-03-08 18:16             ` Chuck Lever

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=20100306183141.GC22650@fieldses.org \
    --to=bfields@citi.umich.edu \
    --cc=linux-nfs@vger.kernel.org \
    --cc=staubach@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