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

Brad Kemp (kemp@indusriver.com)
Thu, 24 Jun 1999 12:44:08 -0400


lost+found is a special case, the mklost+found pre-allocates empty directory
entries so the fsck always has room to add lost directory entries

At 02:56 PM 6/24/99 +0530, MURALI N wrote:
>
>Please look at the listing below.
>
>"/"
>
>drwxr-xr-x 17 root root 1024 May 28 16:40 .
>drwxr-xr-x 17 root root 1024 May 28 16:40 ..
>drwxr-xr-x 2 root root 12288 May 4 21:35 lost+found
>drwxr-xr-x 5 root root 1024 May 5 12:12 mnt
>dr-xr-xr-x 33 root root 0 Jun 23 19:06 proc
>
>"lost+found"
>
>drwxr-xr-x 2 root root 12288 May 4 21:35 .
>drwxr-xr-x 17 root root 1024 May 28 16:40 ..
>
>If the present scheme allocates 13 * 1024 bytes for just "." and "..", I
>feel it is time to rethink the directory handling.
>
>> 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.
>
> ffs was designed that way.
>
> "the filesystem records free space in a directory by having
>entries accumulate the free space in their fields. Space allocated to
>directories should be accounted for completely by the total sizes of the
>directory's entries.... If the first entry of a directory block is free,
>then the pointer to that block in the directory's inode is set to zero to
>indicate that the entry is unused." - 4.4 BSD - McKusick et.al.
>
>
>
>
>-
>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/
>
--- -- --
Brad Kemp
Indus River Networks, Inc. BradKemp@indusriver.com
31 Nagog Park 978-266-8122
Acton, MA 01720 fax 978-266-8111

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