From owner-freebsd-fs@FreeBSD.ORG Wed Apr 4 07:53:05 2012 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AE82106564A for ; Wed, 4 Apr 2012 07:53:05 +0000 (UTC) (envelope-from bra@fsn.hu) Received: from people.fsn.hu (people.fsn.hu [195.228.252.137]) by mx1.freebsd.org (Postfix) with ESMTP id 142078FC0A for ; Wed, 4 Apr 2012 07:53:04 +0000 (UTC) Received: by people.fsn.hu (Postfix, from userid 1001) id 54AAECA40B3; Wed, 4 Apr 2012 09:52:57 +0200 (CEST) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MF-ACE0E1EA [pR: 12.6474] X-CRM114-CacheID: sfid-20120404_09525_9F1F6089 X-CRM114-Status: Good ( pR: 12.6474 ) X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Wed Apr 4 09:52:57 2012 X-DSPAM-Confidence: 0.7621 X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 4f7bfdd971781311117049 X-DSPAM-Factors: 27, From*Attila Nagy , 0.00010, FreeBSD, 0.00048, FreeBSD, 0.00048, To*FreeBSD.org, 0.00065, I+get, 0.00551, Received*FreeBSD.org>, 0.00632, documented, 0.00710, python, 0.00811, 14+23, 0.00811, User-Agent*i686, 0.00896, file+or, 0.00945, use+a, 0.00945, User-Agent*Linux+i686, 0.01000, Received*4+Apr, 0.99000, Date*04+Apr, 0.99000, errno, 0.01000, errno, 0.01000, such+file, 0.01000, bit+the, 0.01000, a+version, 0.01000, No+such, 0.01000, is+6, 0.01000, is+6, 0.01000, or+directory, 0.01000, the+C, 0.01132, doesn't+work, 0.01132, X-Spambayes-Classification: ham; 0.00 Received: from japan.t-online.private (japan.t-online.co.hu [195.228.243.99]) by people.fsn.hu (Postfix) with ESMTPSA id 15C58CA40A7 for ; Wed, 4 Apr 2012 09:52:56 +0200 (CEST) Message-ID: <4F7BFDD4.6080703@fsn.hu> Date: Wed, 04 Apr 2012 09:52:52 +0200 From: Attila Nagy User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.23) Gecko/20090817 Thunderbird/2.0.0.23 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: freebsd-fs@FreeBSD.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: SEEK_HOLE and SEEK_DATA does not work on zfs (with test case) X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2012 07:53:05 -0000 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). 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.