Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2547458rdb; Sun, 3 Dec 2023 23:51:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyYBUUu/Q+Aqq6aFFx+u8dkbxF4vPaCBonfPYzSZ0pNXOgnUX9tXvh4COk6neUGc/7Px/o X-Received: by 2002:a92:c74e:0:b0:35d:5995:7989 with SMTP id y14-20020a92c74e000000b0035d59957989mr4872673ilp.35.1701676311601; Sun, 03 Dec 2023 23:51:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701676311; cv=none; d=google.com; s=arc-20160816; b=nD+Y0x7/Byfxoqu7M05T9Se4MSntFlNjAZFb0ZVu/2BWss/V7oXimy//+vwXwRxblg Aw3n90kPg4kOatlgf58ih5au5bHei9kzSQr7yKes8MA+o1q9PgMeyV4ZKMTkvojbT320 CrAhargDGsGLf1NCkTfa8HtB5dcEUxWe/QZ0fQtR8O/IZr17APUQvSXdHrfR9vuw175w gvcA5SFvE/7BIdhHPxQkfrd+OyL8zprd2Mo8kxAQ2N0tUOFXJ5Dk+4+5KogP0SCOatIN rXSdJtZK6wM6JWnAnoF8yvAfh4PRNE4m1klIxHAFt2srUH43pYL2qsDUA3G2vB51JDVY cWjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=CeX7pmIQi39nmgyPP/8r+ftr2w2xEYA7NtS9twyibkc=; fh=JWieladFfeaIwBj69e66MtYgIw576fUcTLVAEUXiV9w=; b=SBpAeLV2IOxnpH/EXGdVZU/j3HcDBQQfR/8OezjVdwe21jpM8pXaHVD0GKeg827Q30 zXj4HVC7WuVehhD/jVJK6GbxnJlDdhxcQp/j+MVJi8Qb6LcLrO4+e0bYuaohZ9Y4zNRp FPa4Yvsir852gn6MaTJ/QgIoMfuWeKxrF7x4SF1PeuNnJvLvri5e9r/LAwoH077CNNcP zywQC8F/1SAKckJrGuoQFMf09ZPVrgSw61naxlOEfgVkGi/wqw24Uz3uMyXa9IC2oL4Z 78JnfK1ztbAPafSUED2mQ/+hUF+XU1UPzFyi4IfijCHjvUBHZxdt7BtBT0zKdhtK2rdY pWfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id a17-20020a656411000000b005c65d0dd99fsi3611941pgv.505.2023.12.03.23.51.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 23:51:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 1F095806AA01; Sun, 3 Dec 2023 23:51:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbjLDHvf (ORCPT + 99 others); Mon, 4 Dec 2023 02:51:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230025AbjLDHvd (ORCPT ); Mon, 4 Dec 2023 02:51:33 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2D02FF for ; Sun, 3 Dec 2023 23:51:38 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id EC0DA227A8E; Mon, 4 Dec 2023 08:51:34 +0100 (CET) Date: Mon, 4 Dec 2023 08:51:34 +0100 From: Christoph Hellwig To: Daniel Wagner Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Keith Busch , Christoph Hellwig , Sagi Grimberg , Hannes Reinecke Subject: Re: [RFC v2 2/3] nvme: move ns id info to struct nvme_ns_head Message-ID: <20231204075134.GB29377@lst.de> References: <20231201092735.28592-1-dwagner@suse.de> <20231201092735.28592-3-dwagner@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231201092735.28592-3-dwagner@suse.de> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 03 Dec 2023 23:51:49 -0800 (PST) > + if (head) { > pr_err_ratelimited("%s: %s(0x%x) @ LBA %llu, %llu blocks, %s (sct 0x%x / sc 0x%x) %s%s\n", > - ns->disk ? ns->disk->disk_name : "?", > + head->disk ? head->disk->disk_name : "?", > nvme_get_opcode_str(nr->cmd->common.opcode), > nr->cmd->common.opcode, > - (unsigned long long)nvme_sect_to_lba(ns, blk_rq_pos(req)), > - (unsigned long long)blk_rq_bytes(req) >> ns->lba_shift, > + (unsigned long long)nvme_sect_to_lba(head, blk_rq_pos(req)), Please avoid the overly long line here. Best done by removing the pointless unsigned long long casts, as u64 is always an unsigned long long in the kernel these days. > - u64 slba = nvme_sect_to_lba(ns, bio->bi_iter.bi_sector); > - u32 nlb = bio->bi_iter.bi_size >> ns->lba_shift; > + u64 slba = nvme_sect_to_lba(head, bio->bi_iter.bi_sector); Please avoid the overly long line here as well. > +static void nvme_set_ref_tag(struct nvme_ns_head *head, struct nvme_command *cmnd, .. and here. I'm going to stop now, please also fix up all other places. > void nvme_failover_req(struct request *req) > { > - struct nvme_ns *ns = req->q->queuedata; > + struct nvme_ns_head *head = req->q->queuedata; > + struct nvme_ctrl *ctrl = nvme_req(req)->ctrl; > + struct nvme_ns *ns; > u16 status = nvme_req(req)->status & 0x7ff; > unsigned long flags; > struct bio *bio; > > - nvme_mpath_clear_current_path(ns); > + nvme_mpath_clear_current_path(head); > > /* > * If we got back an ANA error, we know the controller is alive but not > * ready to serve this namespace. Kick of a re-read of the ANA > * information page, and just try any other available path for now. > */ > - if (nvme_is_ana_error(status) && ns->ctrl->ana_log_buf) { > + if (nvme_is_ana_error(status) && ctrl->ana_log_buf) { > + ns = nvme_find_get_ns(ctrl, head->ns_id); This looks unrelated. > -bool nvme_mpath_clear_current_path(struct nvme_ns *ns) > +bool nvme_mpath_clear_current_path(struct nvme_ns_head *head) > { > - struct nvme_ns_head *head = ns->head; > bool changed = false; > int node; > > @@ -181,7 +183,7 @@ bool nvme_mpath_clear_current_path(struct nvme_ns *ns) > goto out; > > for_each_node(node) { > - if (ns == rcu_access_pointer(head->current_path[node])) { > + if (head == rcu_access_pointer(head->current_path[node])->head) { and this can't work. We need to check the actual ns for the path selection, as that's kindof the point.