Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3339289rdb; Wed, 13 Sep 2023 09:05:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEVacoX3cuxXfYlhY84csQjQONSqmHe+iHgYZGNxP6cnqiV7QXMw6rLr77sf3/7YSooQ1/ X-Received: by 2002:a17:902:f801:b0:1c3:f572:6701 with SMTP id ix1-20020a170902f80100b001c3f5726701mr856058plb.45.1694621134225; Wed, 13 Sep 2023 09:05:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694621134; cv=none; d=google.com; s=arc-20160816; b=tE9RP8arHkAweAejXL7vSE/W9AezF6ecPBnHR105k2ocW4vtc/1sY8ZnTAlGoZKJIe 6CDRpVctKXIIvO06f9w1ttl/is/NFPKHSqleCEsJHngjLZqB9bzmzj2/VcnbmbnF5mgZ tKU0typIycmSn6c+zdnqTmLYwx0yPm1DcI3v7aNj7Rc109CEWsdgClhFnbrbo4GFNSjn xPUJ0ZdMZ0Q/Wf//1h8ZgqKCkU5lBcyRjhqnyTySRUypvC5Krw2ncqlxGye1VU3V4Zhm 9QKMI+aKZAdQhjrgGnzCy/HwgJftXrnVFkOpzuqbp4xbIODZpV541w4949L6/UfsbaQY Ucmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LqGLJOXO5bR3TOdCilEfQtXqdvwCC4z7Oxex9EjtBO8=; fh=XdSfvJR/mwCCAGJ+aChl0i/ET52bZK8oRPQQ0PkCURo=; b=gjGrcduXHCT9j5liHlOybnnWXeCdfJbBH//qDpyciQr1FXWsyNXbDZDwhAFvPZV4bj mo/+8H3/4inLNtm5jlD7IiIEv0HQ8r+g7ww7G/0b2QPVp8JYNJcJ/MEtFbFVKmqv92nK 3FuVYDgPUxsgGqmbsD6S6SZAp7Z7MHm0m52mD0SCTOz+oPaqtQoMHlz3RpKrfrk1YYTy WX/f1r7PL7z3PGMRXPUai1kEEwzyUHTyQbj1Gi31Zjew/UFkSEtTSLCG/ecHsOhY80ec ZA3q5wiVP6ZDZ5B/lE4bDXNu9n/S/mntWbPMpdrW/lKh2RFaeQi6jIoB9xU9h/yj4cu9 fiyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="YQ6g3k5/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id y16-20020a170902b49000b001b5fc11ea09si10367695plr.94.2023.09.13.09.05.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 09:05:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="YQ6g3k5/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8F85A82CFA7F; Wed, 13 Sep 2023 01:38:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238933AbjIMIi4 (ORCPT + 99 others); Wed, 13 Sep 2023 04:38:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239020AbjIMIir (ORCPT ); Wed, 13 Sep 2023 04:38:47 -0400 Received: from m12.mail.163.com (m12.mail.163.com [220.181.12.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 825E719A9 for ; Wed, 13 Sep 2023 01:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=LqGLJ OXO5bR3TOdCilEfQtXqdvwCC4z7Oxex9EjtBO8=; b=YQ6g3k5/Re66qHo9slAZ1 4QwceUzWNIqWFSJg63uHdIGdygqL6nWo7AZ6BAPIv2XeVk4LI8Py/BWZRvEysoN1 74ugaDQCXjd4KDFE9d0xJRDLOp6GaRnzXB1nVGCJ0ewCRrgwZxHkfjE6IUEaeFUA iIYrTPYyTD0Ajak7JfjLYE= Received: from localhost.localdomain (unknown [223.166.237.2]) by zwqz-smtp-mta-g1-1 (Coremail) with SMTP id _____wAnln7QdAFli8i+Bw--.56942S6; Wed, 13 Sep 2023 16:38:00 +0800 (CST) From: Ping Gan To: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, kch@nvidia.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Cc: ping_gan@dell.com, jacky_gam_2001@163.com Subject: [PATCH 4/4] nvme-core: Get lowlevel disk for target polling queue task Date: Wed, 13 Sep 2023 16:36:44 +0800 Message-Id: <006b6aefe94d73ee64931c769af4a908616439ad.1694592708.git.jacky_gam_2001@163.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: _____wAnln7QdAFli8i+Bw--.56942S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7Cr4UWF48ZryrKw47Cw4xtFb_yoW8Xw4DpF yDXF98Ar4xGF12gFsrZF4UArsxKw10g3WUCF9rA3s0qr9xKrZ5uFySkF1YyFZ3tFWDWFW7 Xa4UKr13Gr1rCF7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0pio7KsUUUUU= X-Originating-IP: [223.166.237.2] X-CM-SenderInfo: 5mdfy55bjdzsisqqiqqrwthudrp/xtbBog7pKVaEJdIJmgAAsa 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 (howler.vger.email [0.0.0.0]); Wed, 13 Sep 2023 01:38:58 -0700 (PDT) When enabling multipath, if the block device of nvmet is a nvme_ns_head disk, then we should get the lowlevel block device to do bio split. Signed-off-by: Ping Gan --- drivers/nvme/host/multipath.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 0a88d7bdc5e3..f6063600e06e 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -371,6 +371,25 @@ static bool nvme_available_path(struct nvme_ns_head *head) return false; } +//for polling queue task to get lowlevel block device +struct block_device *nvme_mpath_get_bdev(struct block_device *bdev) +{ + struct nvme_ns_head *head = bdev->bd_disk->private_data; + int srcu_idx; + struct nvme_ns *ns; + struct block_device *ret = NULL; + + if (!multipath) + return NULL; + srcu_idx = srcu_read_lock(&head->srcu); + ns = nvme_find_path(head); + if (likely(ns)) + ret = ns->disk->part0; + srcu_read_unlock(&head->srcu, srcu_idx); + return ret; +} +EXPORT_SYMBOL_GPL(nvme_mpath_get_bdev); + static void nvme_ns_head_submit_bio(struct bio *bio) { struct nvme_ns_head *head = bio->bi_bdev->bd_disk->private_data; @@ -452,6 +471,7 @@ const struct block_device_operations nvme_ns_head_ops = { .report_zones = nvme_ns_head_report_zones, .pr_ops = &nvme_pr_ops, }; +EXPORT_SYMBOL_GPL(nvme_ns_head_ops); static inline struct nvme_ns_head *cdev_to_ns_head(struct cdev *cdev) { -- 2.26.2