From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39067) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wimk8-00076Y-UV for qemu-devel@nongnu.org; Fri, 09 May 2014 11:29:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wimk2-0005Bo-MH for qemu-devel@nongnu.org; Fri, 09 May 2014 11:29:48 -0400 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:37646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wimk2-0005BW-Gj for qemu-devel@nongnu.org; Fri, 09 May 2014 11:29:42 -0400 Received: by mail-wi0-f178.google.com with SMTP id hm4so1519660wib.11 for ; Fri, 09 May 2014 08:29:41 -0700 (PDT) Date: Fri, 9 May 2014 17:29:37 +0200 From: Stefan Hajnoczi Message-ID: <20140509152937.GC26017@stefanha-thinkpad.redhat.com> References: <1399575475-9751-1-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1399575475-9751-1-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH 4] block/raw-posix: Try both FIEMAP and SEEK_HOLE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Markus Armbruster On Thu, May 08, 2014 at 08:57:55PM +0200, Max Reitz wrote: > The current version of raw-posix always uses ioctl(FS_IOC_FIEMAP) if > FIEMAP is available; lseek with SEEK_HOLE/SEEK_DATA are not even > compiled in in this case. However, there may be implementations which > support the latter but not the former (e.g., NFSv4.2) as well as vice > versa. > > To cover both cases, try FIEMAP first (as this will return -ENOTSUP if > not supported instead of returning a failsafe value (everything > allocated as a single extent)) and if that does not work, fall back to > SEEK_HOLE/SEEK_DATA. > > Signed-off-by: Max Reitz > --- > v4: > - If the order of FIEMAP and SEEK_HOLE are reversed (that is, kept the > way they are now), the tristates from v3 are not required anymore, as > FIEMAP can never be in an “unknown” state and the worst that > SEEK_HOLE can do is to report everything as allocated (which is the > final fallback anyway). This patch is thus basically the same as v2, > only with the order of FIEMAP and SEEK_HOLE reversed (first FIEMAP, > then SEEK_HOLE). [Paolo] > --- > block/raw-posix.c | 127 +++++++++++++++++++++++++++++++++--------------------- > 1 file changed, 77 insertions(+), 50 deletions(-) Thanks, applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan