Subject: Re: lseek() extension for spare files
To: Bill Studenmund <wrstuden@netbsd.org>
From: Reinoud Zandijk <reinoud@netbsd.org>
List: tech-kern
Date: 09/21/2006 23:54:50
--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Sep 21, 2006 at 02:12:19PM -0700, Bill Studenmund wrote:
> I'm not sure you have the SEEK_DATA case right:
> 
> +               if (ap->a_offset != 0)
> +                       return ENXIO;
> 
> My read of the manpage is that if you're on top of data, there is a data 
> range starting at your offset. Note the use of "greater or equal" in the 
> Sun man page.
> 
> I think that should be that as long as the offset is not at or past the
> end of the file, there's data, so no error.

you are right! thanks for the bugreport!

> No. We should not implement this as a seek for zeros. Either you look at 
> your allocation tables to find holes, or you don't find holes.

thats reasonable yes.

> > 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.
> 
> It won't be "at almost no cost," however it will be MUCH cheaper than
> reading data. It will be expensive as indirect blocks will have to be read
> into the kernel, and that usually means seeks.

well normally one would have to seek those indirect blocks too to see if 
something is recorded anyway...

Cheers,
Reinoud

--dDRMvlgZJXvWKvBx
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (NetBSD)

iQEVAwUBRRMKI4KcNwBDyKpoAQISEQf+OXK3uaz3IaYmOF+b1BlovfoO74YpXI6y
nQhMtPzvuM8/hkMWtM5Jyeu4HYs3NuEdYAO5UQvMTSXfQbSi/Yhv203Fqppftq9K
X+l6p6MnDFPHkJhVsjpX04uDijtVvMQqGKsH0OdmUmbeoyJTUzcHGxvfMxVPt/VH
SsiV/XHe9wjNNz8hwgTD+c46O6/aGQcyxNEWb/v+FViDmEKu/1bl5OHyQdSmr1n+
Ekylx8OwlhZygVtpVchF8bEo5cL8TTqkZtoaz5/8+2kL2D/+Ulv4A2NIrb1PlW/i
pCKn7dvTpakUrYG/0hSi+iHDPvBG9427fQdz5WV5vXyOTnwN2wLirQ==
=zlUR
-----END PGP SIGNATURE-----

--dDRMvlgZJXvWKvBx--