From: j.neuschaefer@gmx.net (Jonathan Neuschäfer)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Why count the hash value in this way?
Date: Sun, 4 Aug 2013 12:35:27 +0200 [thread overview]
Message-ID: <20130804103527.GA3041@debian.debian> (raw)
In-Reply-To: <CA+5jrfkeyrJkYOzcE0c0GknzwnVUQtApq_GBfOAStEpWf1MQFg@mail.gmail.com>
On Sun, Aug 04, 2013 at 05:38:55PM +0800, lx wrote:
> hi all:
> In the function of link_path_walk() , it counts the hash value of the
> compoent of the pathname.
> Why "(prevhash + (c <<4) + (c >> 4))*11;"?
In the code you quoted it says:
/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */
A bit of googling led me to this[1] page, where it says:
r5 - This hash is a modified version of rupasov hash. It is used by
default and it is better to stick here until you have to support
huge directories and unusual file-name patterns.
and:
rupasov - This hash is invented by Yury Yu. Rupasov. It is fast and
preserves locality, mapping lexicographically close file names to
the close hash values. Never use it, as it has a high probability
of hash collisions.
[1] https://reiser4.wiki.kernel.org/index.php/Mount
Reading the ReiserFS code and/or mailing lists might give you a clue
about how the R5 hash was designed.
HTH,
Jonathan Neusch?fer
prev parent reply other threads:[~2013-08-04 10:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-04 9:38 Why count the hash value in this way? lx
2013-08-04 10:35 ` Jonathan Neuschäfer [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=20130804103527.GA3041@debian.debian \
--to=j.neuschaefer@gmx.net \
--cc=kernelnewbies@lists.kernelnewbies.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).