Re: silent semantic changes with reiser4

Matthew Wilcox
2004-08-26T14:49:40Z

On Thu, Aug 26, 2004 at 04:25:13PM +0200, Christophe Saout wrote:
> What reiser4 can do, but the VFS can't is to insert or remove data in
> the middle of a file. Adding this above the page cache would probably be
> almost impossible (truncate seems already complicated enough).
>
> But below page-cache and thus invisible from the VFS or the applications
> it is extremely useful for the compression plugin. When changing some
> data in the middle of the file the compressed data might grow in size.
> reiser4 can handle this inside the storage layer and doesn't mess with
> the rest of the filesystem.

Never say never ... regular readers of -fsdevel already know what I'm
going to say so can skip this post.

When compressing data on an ext2-like filesystem, you can use the
property of "holes" to deallocate disc blocks in the middle of a file.
It works like this:

Split the file into 64k chunks
Compress each chunk individually, then write them to disc on 64k boundaries,
leaving gaps.
Now you can quickly seek to the appropriate 64k block for the data you're
looking for and decompress just that 64k block.

This is how RISCiX managed to fit an 80MB distro onto a 50MB disc.
Someone has written an equivalent filesystem for Linux called SquashFS.

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain