mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@turbolinux.com>
To: Ext2 development mailing list <ext2-devel@lists.sourceforge.net>
Cc: Daniel Phillips <phillips@innominate.de>,
	Linux kernel development list <linux-kernel@vger.kernel.org>,
	Christoph Hellwig <hch@ns.caldera.de>,
	"Theodore Y. Ts'o" <tytso@mit.edu>
Subject: Re: [rfc] [LONG] Near-constant time directory index for Ext2
Date: Thu, 22 Feb 2001 01:31:16 -0700 (MST)	[thread overview]
Message-ID: <200102220831.f1M8VHS21717@webber.adilger.net> (raw)
In-Reply-To: From "(env:" "adilger)" at "Feb 22, 2001 01:06:17 am"

I just wrote:
> I just had a clever idea - on a single-level index you put the header
> and index data in block 0, and put the directory data in the first
> indirect block (11 sparse blocks, instead of 511).

To clarify (with wonderful ASCII art), an un-indexed directory would have
data blocks like:

<d0> <d1> <d2> <d3> (wherever we decide the cutoff is for indexing)

When we start with a single level index, it looks like:

<index header > 0 0 0 0 0 0 0 0 0 0 0 <indirect0>
                                      /  |  |   \
                                  <d0> <d1> ... <dN>

> If you need to go to a second-level index, you can simply shift the
> indirect data block to be a double-indirect block, and start the level-2
> index in the first indirect block.

So it would look like:

<index header > 0 0 0 0 0 0 0 0 0 0 0 <index_indirect> <dindirect0>
                                      /    |            /        \
                               <index0><index1>     <indirect0>   <indirect1>
                                                    /  |  |   \
                                                <d0> <d1> ... <dN>

> If we ever need a third-level index, you basically do the same thing -
> move the double-indirect blocks to triple-indirect, and put the level-3
> index in the double-indirect block.  The index blocks will always fit,
> because the index branching level is 1/2 of the indirect block
> branching because the index has the extra 4-byte hash values.

The benefit is that you don't need to do any copying of directory
block pointers (or contents) when you need to go to the next-level
index.

Cheers, Andreas
-- 
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert

             reply	other threads:[~2001-02-22  8:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-22  8:31 Andreas Dilger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-02-22  3:08 [rfc] " Daniel Phillips
2001-02-22  8:06 ` [rfc] [LONG] " Andreas Dilger

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=200102220831.f1M8VHS21717@webber.adilger.net \
    --to=adilger@turbolinux.com \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=hch@ns.caldera.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phillips@innominate.de \
    --cc=tytso@mit.edu \
    /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

all inboxes | Powered by JetHome®