Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp173050rwi; Wed, 12 Oct 2022 18:05:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6xnzstJHnWFGYTmQaQDFOiIlEq9ja/5jUuLMbFnjnHaOe/7K7kZAAIn8l4g1tw3XI53kgj X-Received: by 2002:a05:6402:410:b0:451:ea13:4ed7 with SMTP id q16-20020a056402041000b00451ea134ed7mr30902125edv.262.1665623121032; Wed, 12 Oct 2022 18:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665623121; cv=none; d=google.com; s=arc-20160816; b=UI3El8XdMT6I4qYLe3wT+OL9nc8Ms/SIWggE61ZbgwRXsgOGzKJdEGhKu8KskxoDiR owVquGVL2b4KL9Atwn8PcgyszRwfapbVkdSalGT7i75vP0OD40UroyIgJAoLp5Lbt6Ia QLxkgsYeBxPcxdRsOiAyk18+2qBmJi5bYHYUEe0xLKg6D5xW6jbJQ/77ehwSxgZJkRPs imoGbwnfmdKkax/5FHCB+ciq0wUZRpFaIJ1eooTRMu0178AOJnS/TYF6AYWKADTwtcOG aZkYUm7T8EVW88xGBQ5dDfymbgQWUq7sY3KHiZcZvpkv8c5RFdlm0ay/jeEBuPZqJ2v7 hHMw== 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=mGIiQBGHwTq4LZPZIgfpEn1kPNmljOkNPrnhhyYBktM=; b=K3F6DjjIeZG6+IUNYGSdKvN/Xam5hvwMu65z22Yvm3ptjqOrOJk8Yy8ilSqorKHv+p bSU7X2Jf/ZkdzZT8w0ZPIFD9rqMopO5mFTTx/BxkjAppUx4gtJpWtoVuPcD8nVZhGa9c zCLqLBB8VI7qR+lcqekxVqWCpQTbqUplbgMFPRWrSFWgwjIH/+bQHC+xLSfMkZ+y3K+J JAZLOB4oi4tBasOhOhF8UEwoyvsW0wMK6uSbuYzXBg85F5uEamALKavH5bKnOLIWk5T6 Ok7ggNvH5a/EJRlUo1IXaeiCiT9TFt16NuZlYqzGQStQ3j9AX1ZTSFgGxFs1tfVNiXkU FWEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dZaX5GcV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id st11-20020a170907c08b00b0078d44c5da0esi13439876ejc.667.2022.10.12.18.04.55; Wed, 12 Oct 2022 18:05:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dZaX5GcV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231235AbiJMA0q (ORCPT + 99 others); Wed, 12 Oct 2022 20:26:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230056AbiJMAXG (ORCPT ); Wed, 12 Oct 2022 20:23:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CD132CDF1; Wed, 12 Oct 2022 17:19:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 39DE7616B6; Thu, 13 Oct 2022 00:18:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8BD7C43470; Thu, 13 Oct 2022 00:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620295; bh=a1NmIaOeyYaTxwOAA1EU/07zKuDViUH5GJZYzsjpOSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZaX5GcVuv8kvLOf1N2bj4mr1Tko+b5F9R7nbezPiNGW7A8Xgr7/6WBmTITUIK8Tl 0CFLePSWbRYxzaq1gcEXFL3kDcgnRtRXIy5ypfbMAlM46VftGj0g1OnVFQSyCEoTHm M/ViZdCuYNqYNm/EYggsTP9NZ23eND23CGi6y9SJe1v3bCNCSuIjqyfkgi2RO0lovB cyqMcmFZLEQbau5evwKQ7A9BOKkt4Ishiebsp09337D9A1yyKInB0ShXNmDLga7v8T tYNRMIMmD451swUCznTU3ptTdxlNlB3bvJMt6Z9sdBw7A811UAIu8SHuP4do1FvGx/ Uy2hRzJCrwB8Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , Keith Busch , Sasha Levin , sagi@grimberg.me, kch@nvidia.com, linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 6.0 59/67] nvmet: don't look at the request_queue in nvmet_bdev_set_limits Date: Wed, 12 Oct 2022 20:15:40 -0400 Message-Id: <20221013001554.1892206-59-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013001554.1892206-1-sashal@kernel.org> References: <20221013001554.1892206-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig [ Upstream commit 84fe64f898913ef69f70a8d91aea613b5722b63b ] nvmet is a consumer of the block layer and should not directly look at the request_queue. Use the bdev_ helpers to retrieve the device limits instead. Signed-off-by: Christoph Hellwig Reviewed-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/target/io-cmd-bdev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/target/io-cmd-bdev.c b/drivers/nvme/target/io-cmd-bdev.c index 2dc1c1035626..77c20c0db9d5 100644 --- a/drivers/nvme/target/io-cmd-bdev.c +++ b/drivers/nvme/target/io-cmd-bdev.c @@ -12,11 +12,9 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) { - const struct queue_limits *ql = &bdev_get_queue(bdev)->limits; - /* Number of logical blocks per physical block. */ - const u32 lpp = ql->physical_block_size / ql->logical_block_size; /* Logical blocks per physical block, 0's based. */ - const __le16 lpp0b = to0based(lpp); + const __le16 lpp0b = to0based(bdev_physical_block_size(bdev) / + bdev_logical_block_size(bdev)); /* * For NVMe 1.2 and later, bit 1 indicates that the fields NAWUN, @@ -42,11 +40,12 @@ void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) /* NPWA = Namespace Preferred Write Alignment. 0's based */ id->npwa = id->npwg; /* NPDG = Namespace Preferred Deallocate Granularity. 0's based */ - id->npdg = to0based(ql->discard_granularity / ql->logical_block_size); + id->npdg = to0based(bdev_discard_granularity(bdev) / + bdev_logical_block_size(bdev)); /* NPDG = Namespace Preferred Deallocate Alignment */ id->npda = id->npdg; /* NOWS = Namespace Optimal Write Size */ - id->nows = to0based(ql->io_opt / ql->logical_block_size); + id->nows = to0based(bdev_io_opt(bdev) / bdev_logical_block_size(bdev)); } void nvmet_bdev_ns_disable(struct nvmet_ns *ns) -- 2.35.1