mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@turbolinux.com>
To: Daniel Phillips <phillips@nl.linux.org>
Cc: adilger@turbolinux.com, linux-kernel@vger.kernel.org
Subject: Re: Ext2 Directory Index - File Structure
Date: Fri, 13 Apr 2001 18:50:42 -0600 (MDT)	[thread overview]
Message-ID: <200104140050.f3E0ohpb014702@webber.adilger.int> (raw)
In-Reply-To: <20010413205832Z92227-31791+16@humbolt.nl.linux.org> "from Daniel Phillips at Apr 13, 2001 10:58:28 pm"

Daniel, you write:
> OK, I get it.  Nice article - it would sure be nice to see this
> incorporated Documentation/filesystems/ext2.txt.  I just checked my copy
> of Understanding the Linux Kernel and while existence of the compat
> fields in the super block is noted, there is nothing at all said about
> them. 
> 
> So then, the obvious candidate would be:
> 
> 	#define EXT2_FEATURE_RO_COMPAT_DIR_INDEX        0x0004
> 
> which was formerly EXT2_FEATURE_RO_COMPAT_BTREE_DIR.

Actually not.  We should go with "EXT2_FEATURE_COMPAT_DIR_INDEX 0x0008"
because the on-disk layout is 100% compatible with older kernels, so
no reason to force read-only for those systems.  I'm guessing Ted had
put RO_COMPAT_BTREE_DIR in there in anticipation, but it was never used.

> Other than declaring it, I gather I have to set this flag in the
> superblock every time I set the EXT2_INDEX_FL in an inode.  Is that it?

Yes.  If you do like the LARGE_FILE code, it may be worthwhile to check
whether it is already set to avoid writing out the superblock.  However,
in most cases the superblock is already dirty after block allocation, so
it is no extra overhead in those cases.

> Yes, I will mask of 8 bits of the block index and this will be more than
> enough to support the planned coalesce function.  I can't think of any
> other use for these bits than coalescing - can you?

Not at the moment, but then again, I probably couldn't have forseen any
of the other requirements either.  If we don't need them for indexed
directories, we may as well save them for a future (unspecified) use.
Start using them from the high bits down, so that we allow the directory
size to grow (if needed) in the future.

> > So then bailing out of index mode (on error) to go into linear search
> > mode is as easy as clearing the directory index flag and reading the
> > directory from the start.
> 
> Are you sure we want to clear the index flag?  The user has probably
> just booted the wrong kernel.  And yes, we are talking about a
> strategically placed goto here, after a little cleanup.

OK, no need to clear the index flag under normal circumstances.  We
simply fall back to linear search on unknown hash code, etc.  But
with the hash version byte and dx_root size we should _know_ when we
have bogus data.  Whether we clear the index flag or not in this case
is up for debate.  I was thinking that it would force us into the
"safer" code path of linear search.  However, clearing the index flag
may lose some state (if we decide to allow the admin to set un-indexed
but larger than 1 block directories).  In that case, how do we make
e2fsck create indexes for old filesystems when the DIR_INDEX compat flag
is turned on in the superblock?

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-04-14  0:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-13 20:58 Daniel Phillips
2001-04-14  0:50 ` Andreas Dilger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-04-16 16:36 Daniel Phillips
2001-04-16 10:41 Daniel Phillips
2001-04-15 19:52 Daniel Phillips
2001-04-16  1:42 ` Andreas Dilger
2001-04-16  6:58 ` Andreas Dilger
2001-04-10 16:53 Daniel Phillips
2001-04-10 19:18 ` 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=200104140050.f3E0ohpb014702@webber.adilger.int \
    --to=adilger@turbolinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phillips@nl.linux.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

all inboxes | Powered by JetHome®