From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjXVw-0006fD-4I for qemu-devel@nongnu.org; Sun, 11 May 2014 13:26:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WjXVo-0000oH-2R for qemu-devel@nongnu.org; Sun, 11 May 2014 13:26:16 -0400 Received: from verein.lst.de ([213.95.11.211]:47323 helo=newverein.lst.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WjXVn-0000oC-TH for qemu-devel@nongnu.org; Sun, 11 May 2014 13:26:08 -0400 Date: Sun, 11 May 2014 19:26:05 +0200 From: Christoph Hellwig Message-ID: <20140511172605.GA9761@lst.de> References: <1399402854-24559-1-git-send-email-mreitz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1399402854-24559-1-git-send-email-mreitz@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] 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 On Tue, May 06, 2014 at 09:00:54PM +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, always try SEEK_HOLE/SEEK_DATA (as this will > probably be covered by POSIX soon) and if that does not work, fall back > to FIEMAP; and if that does not work either, treat everything as > allocated. Btw, while I think that SEEK_HOLE/SEEK_DATA generally is the better API for qemu, the NFS 4.2 SEEK operation will be sufficient for a proper FIEMAP implementation, and we'll implement it for the Linux NFS client.