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

Alexander Viro (viro@math.psu.edu)
Thu, 24 Jun 1999 00:18:26 -0400 (EDT)


On Wed, 23 Jun 1999, Albert D. Cahalan wrote:

> David S. Miller writes:
> > From: MURALI N <murali.n@tatainfotech.com>
>
> >> I want to know if there is any significant reason why the
> >> size of each directory ( ext2fs) is reported as 1024b ( or a
> >> multiple of 1024).
> >
> > Because this is the "block size" of the filesystem, the directory
> > space is allocated in units of this.
>
> One could say the same for regular files, so this doen't really
> explain why directory sizes are poorly reported.

Albert, look at the ext2/ufs/ffs directory layout. You'll see the reason.
Blocks *are* filled. Completely. Fresh directory (after mkdir) looks so:
<inumber><size of 1st record><length of name (1)><name (".")><slack>
<inumber><size of 2nd record><length of name (2)><name ("..")><slack>
<inumber (0, i.e. free><size of the 3rd record><slack>
Each block is filled with records. Some records are marked free. Records
may have a slack in the end. That's it. There is no meaningful sub-block
boundary.

-
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/