All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikita Danilov <nikita@clusterfs.com>
To: David Dabbs <david@dabbs.net>
Cc: 'Nikita Danilov' <nikita@clusterfs.com>, reiserfs-list@namesys.com
Subject: Re: Performance improvements to key comparison functions
Date: Mon, 12 Jul 2004 16:00:22 +0400	[thread overview]
Message-ID: <16626.32086.481761.496932@gargle.gargle.HOWL> (raw)
In-Reply-To: <20040712220400.7273415F22@mail03.powweb.com>

David Dabbs writes:
 > 
 > 
 > 
 > >  I'm curious about testing znode->version before and then after the call
 > >  to 
 > >  > znode_contains_strict (when it returns true). Is there a reason this is
 > > not
 > >  > done e.g. extra call to znode_contains is a small price to pay vs.
 > >  > speculative, protected read of each cached node's version member?
 > > 
 > > I don't quite follow, can you elaborate? What znode_contains_strict()'s
 > > call site are you talking about?
 > > 
 > > Nikita.
 > 
 > [David Dabbs] 
 > 
 > The function that scans cached znodes before embarking on a full tree search
 > is the site I had in mind. It locks the cache, then calls
 > znode_contains_key_strict if the h->level == cached_node->level (or
 > something similar). All search key/cached node comparisons are done without
 > locking each cached node. If a cached node is found, the code then locks the
 > node, rechecks znode->level, recalls znode_contains_key_strict and, I think,
 > checks for ZNODE_HEARD_BANSHEE, etc. 
 > 
 > Assuming the search key is an invariant, it seems as though one could grab a
 > copy of cached_node->version _before_ calling znode_contains. If z_c_k_s
 > finds a match and the version member is unchanged, then one need not recall
 > z_c_k_s. If it is different, then recheck z_c_k_s as is done now.

I see now. Problem is that znode->version is protected by long-term lock
itself. That is, invariant

    "znode content change implies znode->version bump"

is maintained under long-term lock on znode. In particular, following
sequence of actions is valid:

(1) obtain long term lock on znode Z

(2) modify Z's content

(3) bump Z->version

(4) modify Z's content again

(5) release long-term lock (without increasing Z->version for the second
    time)

If first call to z_c_k_s() happens between (3) and (4), re-checking
->version is not enough.

 > 
 > David

Nikita.

  reply	other threads:[~2004-07-12 12:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-12 18:38 Performance improvements to key comparison functions David Dabbs
2004-07-12 20:04 ` Nikita Danilov
2004-07-12 20:26   ` David Dabbs
2004-07-10 23:18     ` Nikita Danilov
2004-07-12 21:27       ` David Dabbs
2004-07-11  0:01         ` Nikita Danilov
2004-07-12 22:03           ` David Dabbs
2004-07-12 12:00             ` Nikita Danilov [this message]
2004-07-13 17:58               ` David Dabbs
2004-07-12 20:49   ` David Dabbs
2004-07-10 23:23     ` Nikita Danilov
2004-07-12 21:07     ` mjt
2004-07-13 18:19       ` Hans Reiser
2004-07-12 21:42     ` Philippe Gramoullé
  -- strict thread matches above, loose matches on Subject: below --
2004-07-12  8:48 David Dabbs
2004-07-13 18:33 ` Hans Reiser
2004-07-13 19:59   ` David Dabbs
2004-07-14  6:59     ` Hans Reiser
2004-06-22 10:53       ` David Dabbs
2004-07-13 22:18   ` David Dabbs
2004-07-14  7:03     ` Hans Reiser
2004-06-23  8:43 David Dabbs

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=16626.32086.481761.496932@gargle.gargle.HOWL \
    --to=nikita@clusterfs.com \
    --cc=david@dabbs.net \
    --cc=reiserfs-list@namesys.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.