From nobody Mon Feb 9 21:21:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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; spf=pass (zohomail.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=1586931207; cv=none; d=zohomail.com; s=zohoarc; b=A4emO+RUc3/AuQmLq1jGv7Vzn1Dpx71VXSmIm1Eao/8jbfZtOni7Mg6neyde+bxiLm8zj1z4A43QFq8fpsMiYFg+Csk1U+Fc3r1OlwB4aoTruXbO1tTAS85lr6JHrw+CKapQM+wR7EL745vLmnaFhtuHqIbGjlHwkdYz+Cm9RHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586931207; 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=mGfMd7n9iIBAgWU2hFiV9/Fsfcfk4BobKzokGHOwQdY=; b=gJ2yLhdXakqdAQBhcrEpg5vbl2VwVJQNgEjvwnm4fk46dK844lFd8Ur+5jqMO3Dz+yQ5su2ftQMOaMz1198J91OGjb4dZLWkR0f7tmjCML21Lzg9ozIaN3VlvkCxpE4cIQ6YmQZQQcnCAXBEYYVYGXSfnkt68Uq/99FD9tKn310= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.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 1586931207975485.51810579824814; Tue, 14 Apr 2020 23:13:27 -0700 (PDT) Received: from localhost ([::1]:43892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jObIc-0005pe-NH for importer@patchew.org; Wed, 15 Apr 2020 02:13:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35872) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOazJ-0003MV-Io for qemu-devel@nongnu.org; Wed, 15 Apr 2020 01:53:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jOazI-00034c-IT for qemu-devel@nongnu.org; Wed, 15 Apr 2020 01:53:29 -0400 Received: from charlie.dont.surf ([128.199.63.193]:47598) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jOazF-0002kk-A6; Wed, 15 Apr 2020 01:53:25 -0400 Received: from apples.local (80-167-98-190-cable.dk.customer.tdc.net [80.167.98.190]) by charlie.dont.surf (Postfix) with ESMTPSA id 60764BFE06; Wed, 15 Apr 2020 05:52:34 +0000 (UTC) From: Klaus Jensen To: qemu-block@nongnu.org Subject: [PATCH v7 44/48] nvme: refactor identify active namespace id list Date: Wed, 15 Apr 2020 07:51:36 +0200 Message-Id: <20200415055140.466900-45-its@irrelevant.dk> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200415055140.466900-1-its@irrelevant.dk> References: <20200415055140.466900-1-its@irrelevant.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 128.199.63.193 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 , Beata Michalska , Klaus Jensen , qemu-devel@nongnu.org, Max Reitz , Klaus Jensen , Keith Busch , Javier Gonzalez , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Klaus Jensen Prepare to support inactive namespaces. Signed-off-by: Klaus Jensen Reviewed-by: Maxim Levitsky --- hw/block/nvme.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index f295f027b8e2..05a6fa334a70 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1549,16 +1549,16 @@ static uint16_t nvme_identify_nslist(NvmeCtrl *n, N= vmeRequest *req) uint32_t min_nsid =3D le32_to_cpu(c->nsid); uint32_t *list; uint16_t ret; - int i, j =3D 0; + int j =3D 0; =20 trace_nvme_dev_identify_nslist(min_nsid); =20 list =3D g_malloc0(data_len); - for (i =3D 0; i < n->num_namespaces; i++) { - if (i < min_nsid) { + for (int i =3D 1; i <=3D n->num_namespaces; i++) { + if (i <=3D min_nsid) { continue; } - list[j++] =3D cpu_to_le32(i + 1); + list[j++] =3D cpu_to_le32(i); if (j =3D=3D data_len / sizeof(uint32_t)) { break; } --=20 2.26.0