From nobody Mon Feb 9 10:32:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1571153910; cv=none; d=zoho.com; s=zohoarc; b=ixkDdg+hZxfcytUdSNyVu5igMFUnGwCJtJYn1Ajr7eN/QV9krDGn2poqZpOcdftAIhsYuea20C5DSghCDFLx8HJrU+nWsw0NKQ2loQ8dVmSvA72z9Ad9Gwt837fOOnQINRdh0zpmOAHaMBToMFie9tbtI/BoM9Hsp7I4UKiVQlc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571153910; h=Content-Transfer-Encoding:Cc: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=E3ZU1iFbE5HW1AIiBPqXlRoGatUOAMOrN4ipcn9TfgY=; b=DMoqciHZBFPzpGsG5MDNIKWVJrscG3Hk4SrmKZvkKJvdU7UUYeG1zByC0THZO/Fe8oSbBDXBJvgYvDuzXlfrY+zOAj/rbXSDWkjcWcFN1vNNMUBB/XJuxPl1MzZ2JI2bkURLpRP4gYeRBRnV8V7QvxAcobzzNywvWS2kLeOu0qs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157115391035618.4993788999833; Tue, 15 Oct 2019 08:38:30 -0700 (PDT) Received: from localhost ([::1]:48930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKOu4-0001FA-Uu for importer@patchew.org; Tue, 15 Oct 2019 11:38:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48397) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iKOhI-0003H3-Q3 for qemu-devel@nongnu.org; Tue, 15 Oct 2019 11:25:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iKOhH-0003qQ-Pd for qemu-devel@nongnu.org; Tue, 15 Oct 2019 11:25:16 -0400 Received: from fanzine.igalia.com ([178.60.130.6]:47106) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iKOhH-0003ZG-Gr; Tue, 15 Oct 2019 11:25:15 -0400 Received: from 82-181-115-92.bb.dnainternet.fi ([82.181.115.92] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1iKOge-0003aV-1i; Tue, 15 Oct 2019 17:24:36 +0200 Received: from berto by perseus.local with local (Exim 4.92) (envelope-from ) id 1iKOfm-00061M-Oa; Tue, 15 Oct 2019 18:23:42 +0300 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=E3ZU1iFbE5HW1AIiBPqXlRoGatUOAMOrN4ipcn9TfgY=; b=ZdDtiuxMd1JdhWPQgT5IRKEtIITUgFIqBm/PRsGyhIq3YWq17SGQj4Ekbz48btSzglFr8EOHSr0Hpqhh6Bd64oM4cg4u755wt5dNOOeAK145uHBqJOTENLZwi8zZNKv2jpYmeVVej+oTqHfFRjvNooa41zwhpxuUmx+NNgJS5E9kyVcya97gK1na5dn305TWe5kUW4+6L2LaG5zaUrzTmbXB0LBYE1qm+xvmKJIuGOvYY3CTeAhxwbKI6xdsI+eDZBmXaUKIvaAIKTOvgTFKegKXZPt7er3djQAPg+r43uIYL5zK4hqE1TOOoBmLYOBVzhEQETiddY7NuXNm5OOGiw==; From: Alberto Garcia To: qemu-devel@nongnu.org Subject: [RFC PATCH 08/23] qcow2: Add offset_to_sc_index() Date: Tue, 15 Oct 2019 18:23:19 +0300 Message-Id: <9fce39a724a96ddd217ef2bed26eb9c4a6ef30df.1571152571.git.berto@igalia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 178.60.130.6 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Anton Nefedov , Alberto Garcia , qemu-block@nongnu.org, Max Reitz , "Denis V . Lunev" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" For a given offset, return the subcluster number within its cluster (i.e. with 32 subclusters per cluster it returns a number between 0 and 31). Signed-off-by: Alberto Garcia --- block/qcow2.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/block/qcow2.h b/block/qcow2.h index e6486a2cf8..c450267c88 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -556,6 +556,11 @@ static inline int offset_to_l2_slice_index(BDRVQcow2St= ate *s, int64_t offset) return (offset >> s->cluster_bits) & (s->l2_slice_size - 1); } =20 +static inline int offset_to_sc_index(BDRVQcow2State *s, int64_t offset) +{ + return (offset >> s->subcluster_bits) & (s->subclusters_per_cluster - = 1); +} + static inline int64_t qcow2_vm_state_offset(BDRVQcow2State *s) { return (int64_t)s->l1_vm_state_index << (s->cluster_bits + s->l2_bits); --=20 2.20.1