netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: "Andreas Grünbacher" <andreas.gruenbacher@gmail.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>
Cc: Andreas Gruenbacher <agruenba@redhat.com>,
	Bob Peterson <rpeterso@redhat.com>, Thomas Graf <tgraf@suug.ch>,
	Tom Herbert <tom@quantonium.net>,
	cluster-devel@redhat.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [Cluster-devel] [PATCH v2 0/2] gfs2: Stop using rhashtable_walk_peek
Date: Fri, 06 Apr 2018 11:33:58 +1000	[thread overview]
Message-ID: <871sftxgmx.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <CAHpGcMKxDNOkMMKB1_9H0ob-502cD89E-94a18prp91y_a52GA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2687 bytes --]

On Wed, Apr 04 2018, Andreas Grünbacher wrote:

> Herbert Xu <herbert@gondor.apana.org.au> schrieb am Mi. 4. Apr. 2018 um
> 17:51:
>
>> On Wed, Apr 04, 2018 at 11:46:28AM -0400, Bob Peterson wrote:
>> >
>> > The patches look good. The big question is whether to add them to this
>> > merge window while it's still open. Opinions?
>>
>> We're still hashing out the rhashtable interface so I don't think now is
>> the time to rush things.
>
>
> Fair enough. No matter how rhashtable_walk_peek changes, we‘ll still need
> these two patches to fix the glock dump though.

Those two patches look fine to me and don't depend on changes to
rhashtable, so it is up to you when they go upstream.

However, I think the code can be substantially simplified, particularly
once we make rhashtable a little cleverer.
So this is what I'll probably be doing for a similar situation in
lustre....

Having examined seqfile closely, it is apparent that if ->start never
changes *ppos, and if ->next always increments it (except maybe on error)
then

1/ ->next is only ever given a 'pos' that was returned by the previous
   call to ->start or ->next.  So it should *always* return the next
   object, after the one previously returned by ->start or ->next.  It
   never needs to 'seek'. The 'traverse()' function in seq_file.c does
   any seeking needed.  ->next needs to increase 'pos' and when walking
   a dynamic list, it is easiest if it just increments it.

2/ ->start is only called with a pos of:
    0 - in this case it should rewind to the start
    the last pos passed to ->start of ->next
         In this case it should return the same thing that was
         returned last time.  If it no longer exists, then
         the following one should be returned.
    one more than the last pos passed to ->start or ->next
         In this case it should return the object after the
         last one returned.

The proposed enhancement to rhashtable_walk* is to add a
rhashtable_walk_prev() which returns the previously returned object,
if it is still in the table, or NULL. It also enhances
rhashtable_walk_start() so that if the previously returned object is
still in the table, it is preserved as the current cursor.
This means that if you take some action to ensure that the
previously returned object remains in the table until the next ->start,
then you can reliably walk the table with no duplicates or omissions
(unless a concurrent rehash causes duplicates)
If you don't keep the object in the table and it gets removed, then
the 'skip' counter is used to find your place, and you might get
duplicates or omissions.

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2018-04-06  1:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-29 12:06 [PATCH v2 0/2] gfs2: Stop using rhashtable_walk_peek Andreas Gruenbacher
2018-03-29 12:06 ` [PATCH v2 1/2] lockref: Add lockref_put_not_zero Andreas Gruenbacher
2018-03-29 12:06 ` [PATCH v2 2/2] gfs2: Stop using rhashtable_walk_peek Andreas Gruenbacher
2018-03-29 12:24 ` [Cluster-devel] [PATCH v2 0/2] " Steven Whitehouse
2018-03-29 13:12   ` Andreas Gruenbacher
2018-03-29 12:35 ` Herbert Xu
2018-03-29 13:15   ` Andreas Gruenbacher
2018-03-29 15:41     ` Herbert Xu
2018-03-29 16:52       ` Andreas Gruenbacher
2018-03-29 17:06         ` Herbert Xu
2018-04-03  3:41           ` NeilBrown
2018-04-03  4:03             ` Herbert Xu
2018-04-04 15:46 ` [Cluster-devel] " Bob Peterson
2018-04-04 15:48   ` Herbert Xu
2018-04-04 16:10     ` Andreas Grünbacher
2018-04-06  1:33       ` NeilBrown [this message]
2018-04-12 17:00 ` [Cluster-devel] " Bob Peterson

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=871sftxgmx.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=agruenba@redhat.com \
    --cc=andreas.gruenbacher@gmail.com \
    --cc=cluster-devel@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rpeterso@redhat.com \
    --cc=tgraf@suug.ch \
    --cc=tom@quantonium.net \
    /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).