From patchwork Fri Oct 7 03:53:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 679135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sqwcp1n6dz9s3v for ; Fri, 7 Oct 2016 14:54:16 +1100 (AEDT) Received: from localhost ([::1]:60432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsMEd-0007Ds-6O for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2016 23:54:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsMDx-0006w0-01 for qemu-devel@nongnu.org; Thu, 06 Oct 2016 23:53:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsMDv-00012G-1P for qemu-devel@nongnu.org; Thu, 06 Oct 2016 23:53:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsMDp-0000xG-5d; Thu, 06 Oct 2016 23:53:21 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7EB34C056791; Fri, 7 Oct 2016 03:53:19 +0000 (UTC) Received: from localhost (ovpn-112-51.phx2.redhat.com [10.3.112.51]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u973rHn1020243 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 6 Oct 2016 23:53:19 -0400 From: Jeff Cody To: qemu-devel@nongnu.org Date: Thu, 6 Oct 2016 23:53:17 -0400 Message-Id: <307c86b73ddfd22d56c41ad0ee700a7c070c73f0.1475812005.git.jcody@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 07 Oct 2016 03:53:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/1] block: add gluster ifdef guard checks for SEEK_DATA/SEEK_HOLE support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pkalever@redhat.com, qemu-block@nongnu.org, ndevos@redhat.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add checks to see if the system compiling QEMU has support for SEEK_HOLE/SEEK_DATA. If the system does not, we will flag that seek data is unsupported in gluster. Note: this is not a check on whether the gluster server itself supports SEEK_DATA (that is already done during runtime), but rather if the compilation environment supports SEEK_DATA. Signed-off-by: Jeff Cody Tested-by: Eric Blake Reviewed-by: Eric Blake --- Note: this patch is untested on older systems that do not support SEEK_DATA (e.g.. RHEL6). This won't be pulled into my tree until it is verified. block/gluster.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index e7bd13c..acb1934 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -672,8 +672,10 @@ static void qemu_gluster_parse_flags(int bdrv_flags, int *open_flags) */ static bool qemu_gluster_test_seek(struct glfs_fd *fd) { - off_t ret, eof; + off_t ret = 0; + off_t eof; +#if defined SEEK_HOLE && defined SEEK_DATA eof = glfs_lseek(fd, 0, SEEK_END); if (eof < 0) { /* this should never occur */ @@ -682,6 +684,7 @@ static bool qemu_gluster_test_seek(struct glfs_fd *fd) /* this should always fail with ENXIO if SEEK_DATA is supported */ ret = glfs_lseek(fd, eof, SEEK_DATA); +#endif return (ret < 0) && (errno == ENXIO); } @@ -1185,9 +1188,10 @@ static int find_allocation(BlockDriverState *bs, off_t start, off_t offs; if (!s->supports_seek_data) { - return -ENOTSUP; + goto exit; } +#if defined SEEK_HOLE && defined SEEK_DATA /* * SEEK_DATA cases: * D1. offs == start: start is in data @@ -1251,6 +1255,9 @@ static int find_allocation(BlockDriverState *bs, off_t start, /* D1 and H1 */ return -EBUSY; +#endif +exit: + return -ENOTSUP; } /*