Re: why is the size of a directory always 1024b ?

Brandon S. Allbery KF8NH (allbery@kf8nh.apk.net)
Sat, 26 Jun 1999 10:17:06 -0400


In message <Pine.LNX.4.05.9906260851050.2923-100000@mhw.ULib.IUPUI.Edu>, "Mark
H. Wood" writes:
+-----
| On Wed, 23 Jun 1999, Riley Williams wrote:
| [snippage]
| > I can understand the viewpoint that says the "size" of a directory is
| > simply a count of the number of valid entries therein, but I don't
| > agree with it.
|
| What I think the original poster objects to is that this makes directory
| files different from nondirectory files, without giving a good reason.
+--->8

Oh, futz. There's a very good reason, which has already been stated: the
same reason that "ls -l" of a database-type file (whether from Berkeley DB or
Oracle) doesn't return the number of bytes occupied by active records.

Reorganizing a database-like file (and directories are in effect simple
databases) on the fly is fraught with race conditions and performance
issues. So when you delete a "record" you leave the space there, allocated
but unused. If a later new record will fit in the space, you reuse it. This
is true of directories; it's true of gdbm; it's true of Berkeley DB; it's
true of Oracle and Informix. And not just on Linux.

Can we lay this silly thread to rest now?

-- 
brandon s. allbery	[os/2][linux][solaris][japh]	 allbery@kf8nh.apk.net
system administrator	     [WAY too many hats]	   allbery@ece.cmu.edu
carnegie mellon / electrical and computer engineering			 KF8NH
     We are Linux. Resistance is an indication that you missed the point.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/