From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38179) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS78Q-000833-Kk for qemu-devel@nongnu.org; Wed, 09 May 2012 09:41:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SS78G-0003i3-JI for qemu-devel@nongnu.org; Wed, 09 May 2012 09:40:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SS78G-0003ht-Ap for qemu-devel@nongnu.org; Wed, 09 May 2012 09:40:44 -0400 Message-ID: <4FAA73D7.3030203@redhat.com> Date: Wed, 09 May 2012 15:40:39 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1336488722-13120-1-git-send-email-pbonzini@redhat.com> <1336488722-13120-20-git-send-email-pbonzini@redhat.com> In-Reply-To: <1336488722-13120-20-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1.1 19/22] block: implement is_allocated for raw List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com Am 08.05.2012 16:51, schrieb Paolo Bonzini: > Either FIEMAP, or SEEK_DATA+SEEK_HOLE can be used to implement the > is_allocated callback for raw files. Ext4, btrfs and XFS all support > it. > > Signed-off-by: Paolo Bonzini This is for 1.2, I'll queue it in block-next. > --- > block/raw-posix.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > block/raw.c | 8 +++++ > 2 files changed, 110 insertions(+) > > diff --git a/block/raw-posix.c b/block/raw-posix.c > index 03fcfcc..6753c73 100644 > --- a/block/raw-posix.c > +++ b/block/raw-posix.c > @@ -52,6 +52,10 @@ > #include > #include > #include > +#include > +#endif > +#ifdef CONFIG_FIEMAP > +#include > #endif > #if defined (__FreeBSD__) || defined(__FreeBSD_kernel__) > #include > @@ -104,6 +108,13 @@ > #define O_DIRECT O_DSYNC > #endif > > +#ifndef SEEK_DATA > +#define SEEK_DATA 3 > +#endif > +#ifndef SEEK_HOLE > +#define SEEK_HOLE 4 > +#endif How is that going to be portable? You assume that on non-Linux you'll get -EINVAL, but what does guarantee that 3 or 4 aren't already used for the standard SEEK_* constants or for a different non-standard extension? Kevin