linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@tonian.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Tigran Mkrtchyan <kofemann@googlemail.com>,
	linux-nfs@vger.kernel.org, Tigran Mkrtchyan <kofemann@gmail.com>
Subject: Re: [PATCH] nfsd41: handle current stateid in open and close
Date: Thu, 08 Dec 2011 18:09:07 +0200	[thread overview]
Message-ID: <4EE0E123.20401@tonian.com> (raw)
In-Reply-To: <20111207171133.GD20079@fieldses.org>

On 2011-12-07 19:11, J. Bruce Fields wrote:
> On Wed, Dec 07, 2011 at 03:17:48PM +0200, Benny Halevy wrote:
>> On 2011-12-07 01:08, J. Bruce Fields wrote:
>>> It's a little verbose, but yes it does nicely collect the current
>>> stateid getting/setting into one place.  Benny, is the more or less what
>>> you were thinking of?
>>
>> Yes it is, though I also liked your direction of just using the current
>> stateid for xdr decoding and encoding.
> 
> I'd still have a slight preference for doing it that way, just because
> it would take fewer lines of code--but I can live with this too, so I'll
> leave the choice to Tigran's excellent taste....
> 
>> { ~0, { { ~0, ~0 }, ~0 } } is ugly but compact :)
>>
>> And the following may be an overkill...
>> {
>> 	.si_generation = ~0,
>> 	.si_opaque = {
>> 		.so_clid = {
>> 			.cl_boot = ~0,
>> 			.cl_id = ~0,
>> 		},
>> 		.so_id = ~0
>> 	}
>> };
> 
> Reminding myself of http://tools.ietf.org/html/rfc5661#section-8.2.3...
> "Stateid values whose "other" field is either all zeros or all ones are
> reserved."
> 
> Maybe:
> 
> #define all_ones   {{~0,~0 },~0}
> #define all_zeroes {{ 0, 0 }, 0}
> const stateid_t one_stateid = {
> 	.si_generation = ~0,
> 	.si_opaque = all_ones
> };

That looks like a good compromise to me.

> const stateid_t current_stateid = {
> 	.si_generation = 1,
> 	.si_opaque = all_zeroes
> };
> ...
> 
> Or you could ditch the all_zeroes; it's just there for some kind of
> symmetry.

Yeah, static initialization to zero is guaranteed.

Benny

> 
> --b.

  parent reply	other threads:[~2011-12-08 16:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-06 21:44 [PATCH] nfsd41: handle current stateid in open and close Tigran Mkrtchyan
2011-12-06 23:08 ` J. Bruce Fields
2011-12-07 13:17   ` Benny Halevy
2011-12-07 15:15     ` J. Bruce Fields
2011-12-07 17:11     ` J. Bruce Fields
2011-12-07 17:17       ` Tiramisu Mokka
2011-12-08 16:09       ` Benny Halevy [this message]
2011-12-12 22:40         ` J. Bruce Fields
2011-12-13  7:47           ` Benny Halevy

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=4EE0E123.20401@tonian.com \
    --to=bhalevy@tonian.com \
    --cc=bfields@fieldses.org \
    --cc=kofemann@gmail.com \
    --cc=kofemann@googlemail.com \
    --cc=linux-nfs@vger.kernel.org \
    /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).