Re: Big files in ext2fs (but not i_osync)

Albert D. Cahalan (
Sat, 28 Feb 1998 16:56:14 -0500 (EST)

Re: Big files in ext2fs (but not i_osync)

Linus Torvalds writes:
> On Sat, 28 Feb 1998, Chip Salzenberg wrote:
>> For that matter, we could decide that Really Big Files should
>> not have any direct pointers, only indirects. That would
>> actually be an optimization that would more than make
>> up for stealing one direct pointer for extra size bits.
> Trust me, you don't want to do this. This results in horrible
> stuff when the file grows past the cut-off point, where you'd
> have to start shuffling the indirect pointers on disk around
> or something equally disgusting.

It won't help here, but something similar is useful. For small files,
all 15 block pointers can be direct. When you need the first indirect
block pointer, the 3 extra block pointers go into the new block.
Now you have 12 direct block pointers and 3 indirect block pointers
in the inode. As soon as you need a double-indirect block pointer,
evict the extra two indirect block pointers and put them in the
double-indirect block. Now you have two double-indirect block pointers
in the inode. Evict one when you need a triple-indirect block pointer.

For trunctuation, when the last *-indirect block is almost empty it
must be converted to multiple lower *-indirect or direct blocks.
Example: when there is only one active double-indirect block which
only has one pointer in it, that pointer takes the place of it's
parent in the inode.

This saves space and improves performance. Backwards compatibility
would be rough though. Halfway converted filesystems could not be
supported without an inode flag. Maybe this isn't ext2 anymore.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to