On Mon, Jun 22, 2009 at 02:28:25PM -0700, Jeremy Archer wrote:
>
> Also: what is  BP_IS_HOLE?  I see it has no birth_txg.

A "HOLE" BP is similar to a NULL pointer; it doesn't point to anything, and
is used to indicate there is no data underneath that block pointer.  The
representation is all-zeros.  Since any real block has to have a (non-zero)
birth txg, we only test birth_txg.

An example of the use of holes is in a file's data tree.  A file which was
created like:

        fd = open("foo", O_CREAT, 0777);
        pwrite(fd, "foo", 3, 1024*1024);
        close(fd);

will only have one block in it's data tree; the rest of the pointers will
be HOLEs.

When compression is turned on, any data block of all-zeros will be transformed
into a HOLE, instead of being written to disk.

The SEEK_HOLE and SEEK_DATA arguments to lseek(2) can be used to find the
actual data in a file.

Cheers,
- jonathan


Reply via email to