From nobody Fri Apr 4 05:06:35 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=1740648808; cv=none; d=zohomail.com; s=zohoarc; b=b6zuPmwwvCTsIDFYhQ0TAczrgomJoG06sP3gFm0B/0YRLJuZuO5FdfvDruzcbG84FOnmgwpYWhS12aaQj2yu5CdW39MYuejY5gws+pqGGFUz9+YXc/N8Fk+Qk30HcVxbvIVL0b0G7n29CjuOr7GfmKSorQwa9kYZF9XNugcYyg8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740648808; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Ek139Gu4a814lUKETN8ffYGAAziBjZAe8RnGBT11S9U=; b=mp0jHwYpKou5C2nBvi69ZmZ89B8EXS92R2+5uFIWW44Mkr/zMoHklsWkRCzeZ1MCgLOdpBJ+L6wFe2FX6dHFdhJjUOqTsFWQVDtBKKKjw2NR4f1/b/KdEchqJPbzs2wk5aZMT2OMgKTqY6+aqtENziqiKaW0EEtiLpE361w6SR8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1740648808130117.39567985028577; Thu, 27 Feb 2025 01:33:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tnaEx-0000o5-NJ; Thu, 27 Feb 2025 04:31:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnaEG-00088s-Bo; Thu, 27 Feb 2025 04:30:55 -0500 Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnaED-0008JC-2K; Thu, 27 Feb 2025 04:30:52 -0500 Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id 92EE61382F81; Thu, 27 Feb 2025 04:30:45 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Thu, 27 Feb 2025 04:30:45 -0500 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Feb 2025 04:30:44 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1740648645; x= 1740735045; bh=Ek139Gu4a814lUKETN8ffYGAAziBjZAe8RnGBT11S9U=; b=G fVJvOGt+iaDrFn8MzzN5UDNeUZS9fFp83eRweFGolG1DMiv9YkjCPR1vorlyZ0Bi D7Aa1dgfNsZuUY1XcXJwKaH7H+4uYQ8yTF8hMuR6y3+EhXNSx4yYpaiZmrRl1T/D smLuqlExs3LgT6xD1qSQ0AiIZa9/fiYELsi9NRP1aiHwKSe6jhUacmDu+y0XESES +BwLiwSjVkZihMribkuPYZeYw+0Lw+SqiCKGy0Z6YmIiyk2H4EDNZnOnTvCNFb1P pXvmGsDnN7JguNYPmFyq/Y2FOwIW+O4eXOK918DvGEoKVcL2SRnfpnjsIK4IGMVC uZV8eUn4xiq+D9JcoUBUw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1740648645; x=1740735045; bh=E k139Gu4a814lUKETN8ffYGAAziBjZAe8RnGBT11S9U=; b=HxNfXZOY6422hdno0 SiAInBPWlv4rMcMMo8DgZXdzv8DvH3f1rHw+CemKZZ43yUzpXTI6JBSJ4a+JepGW 2GoXU/8e+G9ewqG5XyqQWV8Ge1Lspty6GW8aHzZ7qHhqt1ZAlptUjllpzfvkNVdo QCPK1yzJTTsNQLWi2pWK+hvKSWb9h9UtG9BhdgK6ejYEeycfNCPdkX2/rjI1nJQx WBnACrGjRaNvMPGNdy5X8CgRv7M4LwCkTRNVaLoWZSkF3270jlOod5YW3IozUKh3 egmKWLc578W+fk5isMfznyBhDmDBIYgbl0pBT0YJ2JqWazApAlRZ7jz4pjnUphkQ Sd9Bg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekjeduudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddt necuhfhrohhmpefmlhgruhhsucflvghnshgvnhcuoehithhssehirhhrvghlvghvrghnth drughkqeenucggtffrrghtthgvrhhnpeejgfeilefgieevheekueevheehkeefveegiefg heefgfejjeehffefgedujedugeenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmh epmhgrihhlfhhrohhmpehithhssehirhhrvghlvghvrghnthdrughkpdhnsggprhgtphht thhopeejpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehqvghmuhdquggvvhgvlh esnhhonhhgnhhurdhorhhgpdhrtghpthhtohepphgvthgvrhdrmhgrhiguvghllheslhhi nhgrrhhordhorhhgpdhrtghpthhtohepkhdrjhgvnhhsvghnsehsrghmshhunhhgrdgtoh hmpdhrtghpthhtohepfhhoshhsseguvghfmhgrtghrohdrihhtpdhrtghpthhtohepkhgs uhhstghhsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehithhssehirhhrvghlvghvrg hnthdrughkpdhrtghpthhtohepqhgvmhhuqdgslhhotghksehnohhnghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: idc91472f:Fastmail From: Klaus Jensen To: qemu-devel@nongnu.org Cc: Peter Maydell , Klaus Jensen , Jesper Wendel Devantier , Keith Busch , Klaus Jensen , qemu-block@nongnu.org Subject: [PULL 10/10] hw/nvme: remove nvme_aio_err() Date: Thu, 27 Feb 2025 10:30:17 +0100 Message-ID: <20250227093018.11262-11-its@irrelevant.dk> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250227093018.11262-1-its@irrelevant.dk> References: <20250227093018.11262-1-its@irrelevant.dk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=103.168.172.149; envelope-from=its@irrelevant.dk; helo=fout-a6-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @irrelevant.dk) X-ZM-MESSAGEID: 1740648809919019000 Content-Type: text/plain; charset="utf-8" From: Klaus Jensen nvme_rw_complete_cb() is the only remaining user of nvme_aio_err(), so open code the status code setting instead. Reviewed-by: Jesper Wendel Devantier Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 60 +++++++++++++++++++------------------------------- 1 file changed, 23 insertions(+), 37 deletions(-) diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index b7222fd9ac02..e62c6a358828 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -1762,42 +1762,6 @@ static uint16_t nvme_check_dulbe(NvmeNamespace *ns, = uint64_t slba, return NVME_SUCCESS; } =20 -static void nvme_aio_err(NvmeRequest *req, int ret) -{ - uint16_t status =3D NVME_SUCCESS; - Error *local_err =3D NULL; - - switch (req->cmd.opcode) { - case NVME_CMD_READ: - status =3D NVME_UNRECOVERED_READ; - break; - case NVME_CMD_WRITE: - case NVME_CMD_WRITE_ZEROES: - case NVME_CMD_ZONE_APPEND: - case NVME_CMD_COPY: - status =3D NVME_WRITE_FAULT; - break; - default: - status =3D NVME_INTERNAL_DEV_ERROR; - break; - } - - trace_pci_nvme_err_aio(nvme_cid(req), strerror(-ret), status); - - error_setg_errno(&local_err, -ret, "aio failed"); - error_report_err(local_err); - - /* - * Set the command status code to the first encountered error but allo= w a - * subsequent Internal Device Error to trump it. - */ - if (req->status && status !=3D NVME_INTERNAL_DEV_ERROR) { - return; - } - - req->status =3D status; -} - static inline uint32_t nvme_zone_idx(NvmeNamespace *ns, uint64_t slba) { return ns->zone_size_log2 > 0 ? slba >> ns->zone_size_log2 : @@ -2182,8 +2146,30 @@ void nvme_rw_complete_cb(void *opaque, int ret) trace_pci_nvme_rw_complete_cb(nvme_cid(req), blk_name(blk)); =20 if (ret) { + Error *err =3D NULL; + block_acct_failed(stats, acct); - nvme_aio_err(req, ret); + + switch (req->cmd.opcode) { + case NVME_CMD_READ: + req->status =3D NVME_UNRECOVERED_READ; + break; + + case NVME_CMD_WRITE: + case NVME_CMD_WRITE_ZEROES: + case NVME_CMD_ZONE_APPEND: + req->status =3D NVME_WRITE_FAULT; + break; + + default: + req->status =3D NVME_INTERNAL_DEV_ERROR; + break; + } + + trace_pci_nvme_err_aio(nvme_cid(req), strerror(-ret), req->status); + + error_setg_errno(&err, -ret, "aio failed"); + error_report_err(err); } else { block_acct_done(stats, acct); } --=20 2.47.2