Subject: Re: Second patch for lseek() sparse file extension
To: None <tech-kern@NetBSD.org>
From: Pawel Jakub Dawidek <pjd@FreeBSD.org>
List: tech-kern
Date: 12/02/2006 01:08:46
--VywGB/WGlW4DM4P8
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Sep 21, 2006 at 08:47:49PM +0200, Reinoud Zandijk wrote:
> Dear folks,
>=20
> 2nd try that ought to be complete. I had to change the VOP_SEEK() a bit=
=20
> since i was worried about FS layering and got wierd results at times; thu=
s=20
> i pass the vattr down so it reflects the top vnode and not the bottom=20
> vnode. This might be important for some file systems and it saves=20
> duplicating and thus error-prone ness.
>=20
> I've also added and updated src/regress/os/fs/lseek to test for normal=20
> lseek() behaviour and to test the SEEK_DATA and SEEK_HOLE extension if it=
=20
> is defined.
>=20
> If all is ok, i'd like to commit this.

Hi. I'm implementing the same functionality for FreeBSD and here are few
notes from me:

First of all, there is no VOP_SEEK(9) on FreeBSD, so I'm using just like
in OpenSolaris VOP_IOCTL(9) to pass SEEK_DATA/SEEK_HOLE requests to the
file system.

> --- include/stdio.h	10 May 2006 21:09:45 -0000	1.64
> +++ include/stdio.h	21 Sep 2006 18:37:52 -0000
> @@ -203,6 +203,12 @@
>  #ifndef SEEK_END
>  #define	SEEK_END	2	/* set file offset to EOF plus offset */
>  #endif
> +#ifndef SEEK_DATA
> +#define	SEEK_DATA	3	/* Set file pointer to next data past offset */
> +#endif
> +#ifndef SEEK_HOLE
> +#define	SEEK_HOLE	4	/* Set file pointer to next hole past offset */
> +#endif

You may want to use s/pointer/offset/ for consistency here. The same for
sys/unistd.h and sys/fcntl.h.

In OpenSolaris (as well as in my patch) _PC_MIN_HOLE_SIZE attribute for
pathconf(2) is used to determine if file system supports
SEEK_DATA/SEEK_HOLE functionality, which you may also want to add.

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--VywGB/WGlW4DM4P8
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (FreeBSD)

iD8DBQFFcMQNForvXbEpPzQRAjrlAKDm5ITUPT/BD3IwkkfSkqC4b8OmFACgpUu+
ZI/OV7+nbXc+MBpE17qUj/w=
=wwZs
-----END PGP SIGNATURE-----

--VywGB/WGlW4DM4P8--