From nobody Mon Feb 9 07:56:41 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=1584378112; cv=none; d=zohomail.com; s=zohoarc; b=nsWe+ZnCVkwqlM5vQ+Xv9grVdI8KmD1V5EHpvI60SVOI7q5aSqQ5fCzENJJc5txnCfM23RjRDjaPs1a39kibKaH6pwsxyvaKIqMDHq6/rFIt5+HznMTMu2VYZgbukMZUJeXFnA+/cMsZIqw214nMcgRQXbCpXdVzuZema7HE9/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584378112; 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=hqQJ4T8F1Dyd7PxkKnf9/CZvHwMbI+pxxgg3MVw/vjA=; b=N+8NnOrUnOLSzu5IOV8btrjfFVQo2/wuKLiVTVIS4Y6OIbHnfMovTBQrukXzcgOIuNTFp6oTk0hufSx9GdcQ8yeM0f8/n3Mc4j0lXYKD0+QtHJO8DULvxevnoiQUwU5t3zV4K1JeH1AfPHmsg7HT15a4AwxMpxk/N9HIeMZOcxw= 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 1584378112354855.2624096776395; Mon, 16 Mar 2020 10:01:52 -0700 (PDT) Received: from localhost ([::1]:43000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDt7e-0004kw-RC for importer@patchew.org; Mon, 16 Mar 2020 13:01:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54725) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDqlb-0000cN-Dk for qemu-devel@nongnu.org; Mon, 16 Mar 2020 10:30:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDqlZ-00074U-Q1 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 10:30:55 -0400 Received: from charlie.dont.surf ([128.199.63.193]:48840) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDqlQ-0003sJ-V0; Mon, 16 Mar 2020 10:30:45 -0400 Received: from apples.local (80-62-117-52-mobile.dk.customer.tdc.net [80.62.117.52]) by charlie.dont.surf (Postfix) with ESMTPSA id 34A52BFA96; Mon, 16 Mar 2020 14:29:54 +0000 (UTC) From: Klaus Jensen To: qemu-block@nongnu.org Subject: [PATCH v6 37/42] nvme: refactor identify active namespace id list Date: Mon, 16 Mar 2020 07:29:23 -0700 Message-Id: <20200316142928.153431-38-its@irrelevant.dk> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200316142928.153431-1-its@irrelevant.dk> References: <20200316142928.153431-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 , 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 b89b96990f52..bf9fb500842a 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1505,16 +1505,16 @@ static uint16_t nvme_identify_nslist(NvmeCtrl *n, N= vmeIdentify *c, 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.25.1