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: 9365579 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3A67E60487 for ; Fri, 7 Oct 2016 03:53:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2554F292A1 for ; Fri, 7 Oct 2016 03:53:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17E76292B8; Fri, 7 Oct 2016 03:53:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ABD5E292A1 for ; Fri, 7 Oct 2016 03:53:46 +0000 (UTC) Received: from localhost ([::1]:60431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsMED-0006xQ-Cy for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Oct 2016 23:53:45 -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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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; } /*