"jeff.liu" <jeff....@oracle.com> wrote:

> Hello List,
>
> I am trying to fetch the data/hole info of a sparse file through the 
> lseek(SEEK_HOLE/SEEK_DATA)
> stuff, the result of fpathconf(..., _PC_MIN_HOLE_SIZE) is ok, so I think this 
> interface is supported
> on my testing ZFS, but SEEK_HOLE always return the sparse file total size 
> instead of the desired
> first hole start offset.

Maybe you did not create the file correctly.

If you like to create a file of a specific size that only contains one single 
hole, there is a way to do this using star:

mkfile <size> some-file                 # create a file of the desired size
star -c f=xx.tar -meta some-file        # archive the meta data only
rm some-file                            # remove original file
star -x -xmeta -force-hole f=xx.tar     # let star create an empty file of the 
                                        # same size

This will try to create a file that has one hole but no data in case the 
filesystem supports to do this.

For UFS, such a file e.g. needs to be a multiple of 8k in size. This is because 
holes in UFS need to be aligned at 8k boundaries and need to be a multiple of 
8k in size.


A recent star can be found in the schily source consolidation:

ftp://ftp.berlios.de/pub/schily/


star is part of Schillix-ON (a free OpenSolaris fork).

Jörg

-- 
 EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       j...@cs.tu-berlin.de                (uni)  
       joerg.schill...@fokus.fraunhofer.de (work) Blog: 
http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to