lkml.org 
[lkml]   [1999]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: why is the size of a directory always 1024b ?

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/

\
 
 \ /
  Last update: 2005-03-22 13:52    [from the cache]
©2003-2011 Jasper Spaans