Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp86011pxh; Tue, 9 Nov 2021 07:42:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyrXRKVFhCjFHCEezzlN1GLJyKoN8wWm5krowmoCX7Xtkofs80z6dddsh1/KHfWRIgm/mWg X-Received: by 2002:a05:6402:2688:: with SMTP id w8mr11346078edd.368.1636472521882; Tue, 09 Nov 2021 07:42:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636472521; cv=none; d=google.com; s=arc-20160816; b=cy1sbWRc2Z9V+nH7phH2juq6tkWfkpMBN7lAvJS6NRDf7/4ajMdPBBBVNHnxKgy2IE NjVQ5BhOvXeal4bgSDvboSXE8jnUxPBAqIyR5J580cikW4G9vcrVXa5rtJjjZTDj93HR pWWBcF1DulgYWhH5tSt//wzlq+H+ocmuoTnQTzD9JC1mFVzSaxMFvlXqWKIf2yGAQ2P7 uKqzDep8Usrd7iEPv+ueXwcQZ+THrkuQBVuy9XeYYKhIYaSPdLbBhc/+ugPXkoeYNHKa lGz196OWyyvw7moXpaoNyVEOKF7/JV9d6Xvq/rG1juJ+1cz60Yp6f6m3u5VABO02Kkey YZ6g== 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=jSKGrxUZLaYd3xMk2S2xH457WrAHkLgVZbJriQpBpNE=; b=IeBgPH8nJ2Uq7oUXMjDGocwM9bezdilieAuNRN1zb4xa04U+gz9jSB2sINDBMlTzux 1UB+t1LI0HQjt4ijkElT7xz16yipKnVeqeXRl+yWk48ojnVEUX9d0gQQo9xfZqwtM0Ca DmfGur2Yew35WnL55PINNMamLXvrnLOwxOrenxYskRK/BV3fcINJ8JwXsK/YsAv1aV4A WxIgJM/JZV/jVrylV26Hv1DKxEcRrRFWEGqIQNW2Rn4Els08iqFvtRdp0ci3PAY1G2sA AGJrGpCVW1HuJg+yet+MFsJwnp+OnjK8Jpnr8TWJjNKoaOCleNTA4p3x23Oio/wPn2gy 0R1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=D6Qw81O+; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mp1si6772636ejc.609.2021.11.09.07.41.33; Tue, 09 Nov 2021 07:42:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=D6Qw81O+; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244152AbhKIIgT (ORCPT + 99 others); Tue, 9 Nov 2021 03:36:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244124AbhKIIgQ (ORCPT ); Tue, 9 Nov 2021 03:36:16 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D6BBC061766; Tue, 9 Nov 2021 00:33:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=jSKGrxUZLaYd3xMk2S2xH457WrAHkLgVZbJriQpBpNE=; b=D6Qw81O+aGHdSGLIg3S1q7rPKD R/sWFABcNQF3AaOMWnHmnIZRzu37fjd2u/pIqQY8s6H/uib2W7f9hKQS2xALeqBy9Z/8wRU+hn1De sRX2ZJYcFFNwtq8BoBYJ9YFiXucGevDveM1fubg49CT5eel8Mtzd/y4fMaTvd2rD2T3+SaVC1rcRR XnBnxu1DevPWVNoseeq5kimfTYRxWAd2eeCepAKvQcani/qsgLIg3qsH9CAdj6CAXbwBNsVDBSRo7 yY9ibo9efoKhptJSrdNP1b86IS3i2PjvFiHQMlTkKl4s4rSb2GTwHR7nWpa8ExhI3CSg5fudf2lSm XbJXksuw==; Received: from [2001:4bb8:19a:7ee7:fb46:2fe1:8652:d9d4] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkMZG-000ryb-Kt; Tue, 09 Nov 2021 08:33:23 +0000 From: Christoph Hellwig To: Dan Williams Cc: Mike Snitzer , Ira Weiny , dm-devel@redhat.com, linux-xfs@vger.kernel.org, nvdimm@lists.linux.dev, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: [PATCH 05/29] dax: remove the pgmap sanity checks in generic_fsdax_supported Date: Tue, 9 Nov 2021 09:32:45 +0100 Message-Id: <20211109083309.584081-6-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211109083309.584081-1-hch@lst.de> References: <20211109083309.584081-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Drivers that register a dax_dev should make sure it works, no need to double check from the file system. Signed-off-by: Christoph Hellwig --- drivers/dax/super.c | 49 +-------------------------------------------- 1 file changed, 1 insertion(+), 48 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 9383c11b21853..04fc680542e8d 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -107,13 +107,9 @@ bool generic_fsdax_supported(struct dax_device *dax_dev, struct block_device *bdev, int blocksize, sector_t start, sector_t sectors) { - bool dax_enabled = false; pgoff_t pgoff, pgoff_end; - void *kaddr, *end_kaddr; - pfn_t pfn, end_pfn; sector_t last_page; - long len, len2; - int err, id; + int err; if (blocksize != PAGE_SIZE) { pr_info("%pg: error: unsupported blocksize for dax\n", bdev); @@ -138,49 +134,6 @@ bool generic_fsdax_supported(struct dax_device *dax_dev, return false; } - id = dax_read_lock(); - len = dax_direct_access(dax_dev, pgoff, 1, &kaddr, &pfn); - len2 = dax_direct_access(dax_dev, pgoff_end, 1, &end_kaddr, &end_pfn); - - if (len < 1 || len2 < 1) { - pr_info("%pg: error: dax access failed (%ld)\n", - bdev, len < 1 ? len : len2); - dax_read_unlock(id); - return false; - } - - if (IS_ENABLED(CONFIG_FS_DAX_LIMITED) && pfn_t_special(pfn)) { - /* - * An arch that has enabled the pmem api should also - * have its drivers support pfn_t_devmap() - * - * This is a developer warning and should not trigger in - * production. dax_flush() will crash since it depends - * on being able to do (page_address(pfn_to_page())). - */ - WARN_ON(IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API)); - dax_enabled = true; - } else if (pfn_t_devmap(pfn) && pfn_t_devmap(end_pfn)) { - struct dev_pagemap *pgmap, *end_pgmap; - - pgmap = get_dev_pagemap(pfn_t_to_pfn(pfn), NULL); - end_pgmap = get_dev_pagemap(pfn_t_to_pfn(end_pfn), NULL); - if (pgmap && pgmap == end_pgmap && pgmap->type == MEMORY_DEVICE_FS_DAX - && pfn_t_to_page(pfn)->pgmap == pgmap - && pfn_t_to_page(end_pfn)->pgmap == pgmap - && pfn_t_to_pfn(pfn) == PHYS_PFN(__pa(kaddr)) - && pfn_t_to_pfn(end_pfn) == PHYS_PFN(__pa(end_kaddr))) - dax_enabled = true; - put_dev_pagemap(pgmap); - put_dev_pagemap(end_pgmap); - - } - dax_read_unlock(id); - - if (!dax_enabled) { - pr_info("%pg: error: dax support not enabled\n", bdev); - return false; - } return true; } EXPORT_SYMBOL_GPL(generic_fsdax_supported); -- 2.30.2