Re: Patch to improve fs/ext2/truncate.c

Linus Torvalds (
Fri, 11 Jul 1997 21:51:44 -0700 (PDT)

On Sat, 12 Jul 1997, Theodore Y. Ts'o wrote:
> Enclosed please find a patch which improves how files are deleted in
> ext2. This patch causes ext2 to *not* zero the data blocks in indirect
> block, doubly indirect blocks, etc. As discussed before, this makes it
> easier to recover from accidentally deleted files, and it also speeds up
> deletions since we don't needlessly write out metadata blocks that we
> don't need to write out.
> Also, I've collapsed the swab32 variants back into a the main functions,
> which reduces the kernel size by over 1k, for free.

The "ininode" boolean could probably be removed by just _not_ ever
changing the block numbers in the inode to the CPU byte order: that way
all block numbers (whether they are in the inode or in a indirect block)
would always be in little-endian order. Then it wouldn't need any extra
code at all..

There really isn't any reason to change to a CPU byteorder in the inode,
it doesn't actually win us anything "bmap()" will become infinitesimally
slower on big-endian machines, but that has never been a cycle-critical

I'll apply this patch, but if somebody would try out the above suggestion
and send me patches (relative to this patch), I'd be very interested..