Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2652351pxb; Sun, 17 Oct 2021 21:41:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4n9FiqIg9ceqx5y+jZvzGki8dn51L/uSVEoDCJmJP0o+NHJfmnxBXrLtQ9YqIfZZPdrbp X-Received: by 2002:a63:2b03:: with SMTP id r3mr21867381pgr.188.1634532119273; Sun, 17 Oct 2021 21:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634532119; cv=none; d=google.com; s=arc-20160816; b=DrhZv4hhXyZs6RPTDYI6E67dwWL/RbK+rKW7nq8Im8WTNLuPcclOL9wTP5iSggEb9V a3jjyevtQsC/otcJqfQyPgvoaBJ66FIhupu35KcBlr+b8+NvKL/ewEj/wXy5dSmKmVxR YwWwC0DD+O2BmibP3gQVoJMv9rIGTNdSUPe/yaS96+c6XqzKD+Xa6pa4EEslT1vtJ9uQ 0rgfzk6LYZfO1kvvWvl0H4Psz2nfzOtT+AZd/41F0ijjlhikvxriCCrqxLzyklzPVG+t 6Ni4QiLykx2Wm9RqZEatLCbwMLedbkYl56qYIB+bHjhtZV+e61c2ussMx8HEKwq253p2 noaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=uLDzNdvlUbSBrRvj7vTZ1yPi5zMIqLpGLzeD42SrdLE=; b=TXupGIf6cesLSU2koRUTCv+gJYC3mBnx+Reo0iMFYGDaULafezkX92fufIVFsh+3HK XBaYuXZrRpWNZ9pShYDEhpFkoVNZwdHeRgbr4pKtqeVPT2KQ86HYJ41gRd0cN7pLYRBQ O98i7g9x1rUalxnP1m8Ruw3bgTirKefi3E4s8rKTviyvNyTkHecsTw0C5MMJa/a4hL7D f1VpPoOY9zhKJJ7n87gYp5wsd/u5oiLCEzJSTpt5YdGNFCxY3KL0dBaXA+UjYRZ5C1cb pCF5GGZJBwcegZ7ipaQ1XGKb7K/g7v31fPIWsdpb4uA5uPFFEqJL/iMqlylgnyQXT1v2 MlDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20210309 header.b=0LfreBwX; 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 f16si12454247pgb.585.2021.10.17.21.41.46; Sun, 17 Oct 2021 21:41:59 -0700 (PDT) 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=fail header.i=@infradead.org header.s=bombadil.20210309 header.b=0LfreBwX; 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 S230091AbhJREnz (ORCPT + 99 others); Mon, 18 Oct 2021 00:43:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230128AbhJREnv (ORCPT ); Mon, 18 Oct 2021 00:43:51 -0400 Received: from bombadil.infradead.org (unknown [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65870C06161C; Sun, 17 Oct 2021 21:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=uLDzNdvlUbSBrRvj7vTZ1yPi5zMIqLpGLzeD42SrdLE=; b=0LfreBwXIkRrDhpgGOavc0Sbac u8D5ZpvkjcMW8tJZH/vGcwrYnvFPYF4DfR5bj3rFCMQZeNjyi8QzpTni2uL7Qs6KlEMxLAXGyHKYs QxVDuo8VxPGqHIVcQz8xSMzWFpWnqcc4t+IrQhfe0Qzhme7PYaVw1T8faWgtU8MBSIRH74P5cx9BP hU6Y67KbQUztMWj0YayZNS0KmMdfS5lb8KTvW8iwZPJhlY2xUUBsQAjGNulA/lftPFaVgLOyxHFIZ apoMSzbK7QjtRmJuHmP8EguhMZcUEzbemOQzieUE9j0OxDv+dHd+qtJbN65P8BGF30FOc7ZmeAjXD O0v9tbGg==; Received: from 089144211028.atnat0020.highway.a1.net ([89.144.211.28] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mcKSr-00E3VA-5M; Mon, 18 Oct 2021 04:41:33 +0000 From: Christoph Hellwig Cc: Dan Williams , 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 11/11] dax: move bdev_dax_pgoff to fs/dax.c Date: Mon, 18 Oct 2021 06:40:54 +0200 Message-Id: <20211018044054.1779424-12-hch@lst.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211018044054.1779424-1-hch@lst.de> References: <20211018044054.1779424-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org No functional changet, but this will allow for a tighter integration with the iomap code, including possible passing the partition offset in the iomap in the future. For now it mostly avoids growing more callers outside of fs/dax.c. Signed-off-by: Christoph Hellwig --- drivers/dax/super.c | 14 -------------- fs/dax.c | 13 +++++++++++++ include/linux/dax.h | 1 - 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 803942586d1b6..c0910687fbcb2 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -67,20 +67,6 @@ void dax_remove_host(struct gendisk *disk) } EXPORT_SYMBOL_GPL(dax_remove_host); -int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, - pgoff_t *pgoff) -{ - sector_t start_sect = bdev ? get_start_sect(bdev) : 0; - phys_addr_t phys_off = (start_sect + sector) * 512; - - if (pgoff) - *pgoff = PHYS_PFN(phys_off); - if (phys_off % PAGE_SIZE || size % PAGE_SIZE) - return -EINVAL; - return 0; -} -EXPORT_SYMBOL(bdev_dax_pgoff); - /** * dax_get_by_host() - temporary lookup mechanism for filesystem-dax * @bdev: block device to find a dax_device for diff --git a/fs/dax.c b/fs/dax.c index 4e3e5a283a916..eb715363fd667 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -709,6 +709,19 @@ int dax_invalidate_mapping_entry_sync(struct address_space *mapping, return __dax_invalidate_entry(mapping, index, false); } +static int bdev_dax_pgoff(struct block_device *bdev, sector_t sector, size_t size, + pgoff_t *pgoff) +{ + sector_t start_sect = bdev ? get_start_sect(bdev) : 0; + phys_addr_t phys_off = (start_sect + sector) * 512; + + if (pgoff) + *pgoff = PHYS_PFN(phys_off); + if (phys_off % PAGE_SIZE || size % PAGE_SIZE) + return -EINVAL; + return 0; +} + static int copy_cow_page_dax(struct block_device *bdev, struct dax_device *dax_dev, sector_t sector, struct page *to, unsigned long vaddr) { diff --git a/include/linux/dax.h b/include/linux/dax.h index 439c3c70e347b..324363b798ecd 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -107,7 +107,6 @@ static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, #endif struct writeback_control; -int bdev_dax_pgoff(struct block_device *, sector_t, size_t, pgoff_t *pgoff); #if IS_ENABLED(CONFIG_FS_DAX) int dax_add_host(struct dax_device *dax_dev, struct gendisk *disk); void dax_remove_host(struct gendisk *disk); -- 2.30.2