From: Nikita Danilov <nikita@clusterfs.com>
To: Bob Copeland <bcopeland@gmail.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: readdir on hash filesystems
Date: Thu, 22 Sep 2005 00:22:48 +0400 [thread overview]
Message-ID: <17201.49432.28348.486601@gargle.gargle.HOWL> (raw)
In-Reply-To: <b6c5339f0509211046137bfd6b@mail.gmail.com>
Bob Copeland writes:
> Hi all,
>
> I am writing a new filesystem driver for the filesystem used by the
> Rio Karma (and, as it happens, ReplayTV). See the attached patch and
> my webpage here for more info: http://bobcopeland.com/karma/. I have
> a
> couple of newbie questions:
>
> 1) The directory structure implements a hash table where each
> directory has a fixed number of entries. Each entry is a file that
> has a pointer to another file in the hash chain and so there can be an
> unlimited number of files in any hash chain. What is the usual way to
> implement readdir efficiently in this case? With f_pos alone, I don't
All file systems with hash-based directories I know of, treat hash
collisions (a hash chain with more than one item) as some sort of
exception, because they have large number of hash buckets. For your case
where long hash chains are ordinary --because omfs has 201 hash buckets
per directory (hard-coded value is bad, by the way)-- there is no "usual
way", you have to invent one yourself.
> have any idea which node I want along the hash chain without counting
> up f_pos nodes in the tree.
One possible solution is to use lower 24 bits of f_pos to store an index
within given hash chain, and next 8 bits to store index of hash chain:
int hchain = file->f_pos >> 24 & 0xff;
int hindex = file->f_pos & 0xffffff;
Nikita.
next prev parent reply other threads:[~2005-09-21 20:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-21 17:46 readdir on hash filesystems Bob Copeland
2005-09-21 20:22 ` Nikita Danilov [this message]
2005-09-22 18:09 ` Bob Copeland
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=17201.49432.28348.486601@gargle.gargle.HOWL \
--to=nikita@clusterfs.com \
--cc=bcopeland@gmail.com \
--cc=linux-fsdevel@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).