Subject: Re: lseek() extension for spare files
To: Bill Studenmund <firstname.lastname@example.org>
From: Reinoud Zandijk <email@example.com>
Date: 09/21/2006 22:20:51
Content-Type: text/plain; charset=us-ascii
On Thu, Sep 21, 2006 at 11:19:14AM -0700, Bill Studenmund wrote:
> > It adds the SEEK_DATA and SEEK_HOLE `whence' arguments to lseek(). For a
> > more detailed look see the solaris 10 man page :
> > http://tinyurl.com/fk6we
> > Although its pretty complete and smoothed out it might need some fine
> > tuning. Note that in this patch no file system has yet implemented sparse
> > area reporting and the genfs implementation, that allmost all use,
> > implements the basic functionality.
> How will we implement the guts of SEEK_DATA and SEEK_HOLE? If we've handed
> the whole VOP off to genfs, we don't have an fs-specific callback.
> I think what we should do is have each fs have its own seek routine, which
> calls a genfs routine with the vop info plus a callback to handle finding
> regions. Either that, or to the extent we have genfs-ops, we need another
As discussed earlier i've moved the implementation of the `whence' to the
file system vnode. To ease the implementation i've passed the relevant data
down stream and all file systems that don't support sparse files natively
like msdosfs just use the genfs_seek function. It will provide a
minimalistic but correct behaviour for normal seeks and for data/hole
Each file system that does want to provide sparcity information can either
implement it as a seek for zero's (not really encouraged but never the less
possible) or seek its datastructures and give the offsets asked for. One
call can only return one offset so no lists have to be made.
Note that the interface definition in the Solaris manpage does not state
that data area's don't have zero regions nor that holes have a minimal
I think generally speaking for most file systems holes are defined in terms
of sector size blocks anyway and can be searched for in its own way.
If i understand FFS enough, it could be that the file's allocation tree can
be searched and the relevant region extracted at allmost no cost; esp. if
you count the reading and movement of all that dummy data to userland.
In UDF f.e. each file is defined as a series of extents on blocksize
lengths (either not allowed or allocated but not used) and so for UDF its
just searching the extent list for what's next to the extent referenced and
return that offset.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v184.108.40.206 (NetBSD)
-----END PGP SIGNATURE-----