Hammer performance
Bakul Shah
bakul at bitblocks.com
Mon Jul 7 11:58:53 PDT 2008
On Mon, 07 Jul 2008 10:10:29 PDT Matthew Dillon <dillon at apollo.backplane.com> wrote:
> :How about if I write a 1M of 0 over an existing file, will I recover
> :the space?
> :
> :Cedric
>
> No, if you write out zeros it will write zeros to the disk. It
> will not make that area sparse again. We don't want to have to
> scan data buffers to see if they are all zero. The door is open
> for some other method of re-creating a hole in a file but there
> is no standard UNIX way of doing it at the moment.
Freeing a block of zeroes would be nice - my qemu images
would thank you :-) This can be done transparently by the FS
(no need for user visible changes).
It might be worth checking if a block is all zeroes (first
check if the first and last word are all zeroes and if so
check the rest). Even if one out of a few thousand disk
writes can be avoided, this is worth it.
While I am here let me also suggest adding SEEK_HOLE and
SEEK_DATA tyoes of lseek(2) which allows a quicker navigation
of holey files -- no need to do anything heroic, just find
the first null block pointer for SEEK_HOLE and find the first
non-null block pointer for SEEK_DATA.
More information about the Users
mailing list