From nobody Tue Feb 10 03:44:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1640716837; cv=none; d=zohomail.com; s=zohoarc; b=aM4cyiyhbMuZHNTSDONlRLtJTM8AX+p26r6YGKSwbYtgWwXXTSSzwSXys58PVcfwuASRjcrOntL2lGeYf1M7DH20kz9jn5Zwew37RVCSgr25MiOOMSCDQRB/yWvopwb+ZpsXRtSRC37DK0o/MXOfxGbNZX7TDd9NiIl7Fkhem6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1640716837; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nd1EE4vhAkeqi+wVjM+RCBW+1dRfwG9r9ZPevD2kWnI=; b=i/RD1clyNSsZL/tNOxBVVOJq9yGtvo0xhnhYYs2f3DWXh7o57C6odg4kTy5USDk+4KYAepWYojiRhmDCe4NaYR/xUMfYoBQGJ1T9qlX4TLb+OSbQiYq4fyKvJNJAN8GUxl00LGzPEjZfIT+XgZEQcWre/xhwIW6g/IkUQBcs9YM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1640716837330652.09086189637; Tue, 28 Dec 2021 10:40:37 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-9-I8g8QL2XPpyjPF08x3qERQ-1; Tue, 28 Dec 2021 13:40:33 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D538F81CCB8; Tue, 28 Dec 2021 18:40:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 462E9838EE; Tue, 28 Dec 2021 18:40:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 15E204BB7C; Tue, 28 Dec 2021 18:40:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1BSIeLfo021196 for ; Tue, 28 Dec 2021 13:40:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8EF627F808; Tue, 28 Dec 2021 18:40:21 +0000 (UTC) Received: from kinshicho.fritz.box (unknown [10.40.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BBAC97E124 for ; Tue, 28 Dec 2021 18:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640716835; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nd1EE4vhAkeqi+wVjM+RCBW+1dRfwG9r9ZPevD2kWnI=; b=UP88ERSZC5GIM7FlPcoLN6lsjDLwK9ONB8/8gIK7xDThcj+IugsyMyxegllmB51liNhfGr 7S+GbdA/UxXgyNQXEREu+NDaAsqfHfZa6wvGhRbO/OWVTj5IksRRW0kpgnDvZsdKYuy/OG +CbrIEQuqvRnIjck0IHeXE4OdMMh3Pg= X-MC-Unique: I8g8QL2XPpyjPF08x3qERQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] storage: Use the FICLONE ioctl unconditionally on Linux Date: Tue, 28 Dec 2021 19:40:01 +0100 Message-Id: <20211228184003.89794-2-abologna@redhat.com> In-Reply-To: <20211228184003.89794-1-abologna@redhat.com> References: <20211228184003.89794-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1640716838286000001 Content-Type: text/plain; charset="utf-8" According to ioctl_ficlonerange(2) These ioctl operations [FICLONE and FICLONERANGE] first appeared in Linux 4.5. They were previously known as BTRFS_IOC_CLONE and BTRFS_IOC_CLONE_RANGE, and were private to Btrfs. We no longer target any distro that comes with a kernel older than 4.5, so we can stop looking for the btrfs and xfs specific versions of the constant and just use the generic version directly. Signed-off-by: Andrea Bolognani --- src/storage/storage_util.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 03874d6ca3..21388cd255 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -43,16 +43,6 @@ # include #endif =20 -#ifdef FICLONE -# define REFLINK_IOC_CLONE FICLONE -#elif WITH_LINUX_BTRFS_H -# include -# define REFLINK_IOC_CLONE BTRFS_IOC_CLONE -#elif WITH_XFS_XFS_H -# include -# define REFLINK_IOC_CLONE XFS_IOC_CLONE -#endif - #include "datatypes.h" #include "virerror.h" #include "viralloc.h" @@ -107,11 +97,11 @@ virStorageBackendNamespaceInit(int poolType, * Perform the O(1) btrfs clone operation, if possible. * Upon success, return 0. Otherwise, return -1 and set errno. */ -#ifdef REFLINK_IOC_CLONE +#ifdef __linux__ static inline int reflinkCloneFile(int dest_fd, int src_fd) { - return ioctl(dest_fd, REFLINK_IOC_CLONE, src_fd); + return ioctl(dest_fd, FICLONE, src_fd); } #else static inline int --=20 2.31.1