Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!gatech!hao!oddjob!gargoyle!ihnp4!homxb!mhuxt!mhuxm!mhuxh!mhuxo!ulysses!allegra!alice!ark
From: ark@alice.UUCP
Newsgroups: comp.unix.wizards
Subject: Re: stupidity in directory management?
Message-ID: <7078@alice.UUCP>
Date: Fri, 10-Jul-87 14:41:13 EDT
Article-I.D.: alice.7078
Posted: Fri Jul 10 14:41:13 1987
Date-Received: Tue, 14-Jul-87 01:52:19 EDT
References: <603@nonvon.UUCP>
Distribution: na
Organization: AT&T Bell Laboratories, Liberty Corner NJ
Lines: 22

In article <603@nonvon.UUCP>, mc68020@nonvon.UUCP writes:
>    After a file is removed, it's "slot" in the directory isn't re-used!  The
> damned directory keeps growing larger and LARGER.

Not quite true.

The following applies, as far as I know, to all versions of the
UNIX system except Berkeley 4.2 and 4.3.  I don't know the situation
for those systems.

Directories have the convention that an inode number of 0
means the directory entry is available, regardless of
whether there's a name in it or not.  When you remove a link to
a file, the inode number in that directory is zeroed but the
name stays around.

When creating a new directory entry, the system uses the first
available slot, where "available" means "inode == 0"

It is true that a directory can never shrink.  However, the 
size of a directory will never be greater than the maximum
number of entries that directory has ever contained.