Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Apr 2012 11:38:37 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        Attila Nagy <bra@fsn.hu>
Cc:        freebsd-fs@FreeBSD.org
Subject:   Re: SEEK_HOLE and SEEK_DATA does not work on zfs (with test case)
Message-ID:  <4F7C088D.4070803@FreeBSD.org>
In-Reply-To: <4F7BFDD4.6080703@fsn.hu>
References:  <4F7BFDD4.6080703@fsn.hu>

next in thread | previous in thread | raw e-mail | index | archive | help
on 04/04/2012 10:52 Attila Nagy said the following:
> Hi,
> 
> I've started to experiment with SEEK_HOLE and SEEK_DATA in python on a recent
> FreeBSD 9-STABLE/amd64 box and it quickly became evident that the program that
> works on Solaris doesn't work on FreeBSD.
> Python itself couldn't cause this, because it correctly issues the lseek, but
> taking the C test program from here:
> https://lkml.org/lkml/2011/4/22/79
> gives the same result (failure).

Please see this PR: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/164445
If you can't figure out a patch from its contents, then I'll try to provide it
some time later today.

> On a Solaris 10 box I get (the correct result):
> creating file
> Error 0
> fpathconf gives 512, ENXIO is 6
> 
> testing at start
> CUR at offset 0, errno 0
> HOLE gives offset 131072, errno 0
> CUR at offset 131072, errno 0
> DATA gives offset 0, errno 0
> CUR at offset 0, errno 0
> HOLE gives offset 131072, errno 0
> CUR at offset 131072, errno 0
> 
> testing at end
> end at offset 1048578, errno 0
> HOLE gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> DATA gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> HOLE gives offset 1048578, errno 0
> CUR at offset 1048578, errno 0
> DATA gives offset 1048577, errno 0
> CUR at offset 1048577, errno 0
> 
> testing at offset 1
> HOLE gives offset 131072, errno 0
> CUR at offset 131072, errno 0
> DATA gives offset 1, errno 0
> CUR at offset 1, errno 0
> 
> testing at offset 200000
> HOLE gives offset 200000, errno 0
> CUR at offset 200000, errno 0
> DATA gives offset 1048576, errno 0
> CUR at offset 1048576, errno 0
> 
> On FreeBSD 9-STABLE/amd64 (all HOLE or DATA seeks fail):
> creating file
> No error: 0
> fpathconf gives 512, ENXIO is 6
> 
> testing at start
> CUR at offset 0, errno 0
> HOLE gives offset -1, errno 6
> CUR at offset 0, errno 0
> DATA gives offset -1, errno 6
> CUR at offset 0, errno 0
> HOLE gives offset -1, errno 6
> CUR at offset 0, errno 0
> 
> testing at end
> end at offset 1048578, errno 0
> HOLE gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> DATA gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> HOLE gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> DATA gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> 
> testing at offset 1
> HOLE gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> DATA gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> 
> testing at offset 200000
> HOLE gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> DATA gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> 
> Interestingly on an older 8.2-PRELEASE (Dec 14 23:12:05 CET 2010 and i386) box
> it works:
> creating file
> No such file or directory
> fpathconf gives 512, ENXIO is 6
> 
> testing at start
> CUR at offset 0, errno 0
> HOLE gives offset 131072, errno 0
> CUR at offset 131072, errno 0
> DATA gives offset 0, errno 0
> CUR at offset 0, errno 0
> HOLE gives offset 131072, errno 0
> CUR at offset 131072, errno 0
> 
> testing at end
> end at offset 1048578, errno 0
> HOLE gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> DATA gives offset -1, errno 6
> CUR at offset 1048578, errno 0
> HOLE gives offset 1048578, errno 0
> CUR at offset 1048578, errno 0
> DATA gives offset 1048577, errno 0
> CUR at offset 1048577, errno 0
> 
> testing at offset 1
> HOLE gives offset 131072, errno 0
> CUR at offset 131072, errno 0
> DATA gives offset 1, errno 0
> CUR at offset 1, errno 0
> 
> testing at offset 200000
> HOLE gives offset 200000, errno 0
> CUR at offset 200000, errno 0
> DATA gives offset 1048576, errno 0
> CUR at offset 1048576, errno 0
> 
> I don't know whether 32 bit, the OS or the pool version (the only working
> FreeBSD case use a version 13 zpool) cause the malfunction, but this is a major
> issue for anybody who wants to use this documented feature.


-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F7C088D.4070803>