From patchwork Fri Jan 26 13:28:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13532565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43B71C48260 for ; Fri, 26 Jan 2024 13:29:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C183F6B0078; Fri, 26 Jan 2024 08:29:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA0026B007B; Fri, 26 Jan 2024 08:29:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F2446B0080; Fri, 26 Jan 2024 08:29:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8C2B56B0078 for ; Fri, 26 Jan 2024 08:29:20 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 35A0680F91 for ; Fri, 26 Jan 2024 13:29:20 +0000 (UTC) X-FDA: 81721543680.10.F28934F Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf01.hostedemail.com (Postfix) with ESMTP id 7E8AB40012 for ; Fri, 26 Jan 2024 13:29:18 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=J1H+EZdm; dmarc=none; spf=none (imf01.hostedemail.com: domain of BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706275758; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=V10/A/+wNuc0NlJNXVGAXChnWVFO1SMkrJedGiK3O78=; b=syMTkXBPiv4hzZL60UM3MKEmkGiw73Siu+RLis3mm90WNNSW4xvvLaNO1DWPltU6ul3xWJ Gr+BLgCKJf75mDtS4x0FFi1SODaRtsuoX3Sl5/pnLBq9UnP5qBmt/T1HmI3fMcWn0ymZ7G +90Xc5ZRrDpmZl+1FVLQJbepVrcpIm4= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=J1H+EZdm; dmarc=none; spf=none (imf01.hostedemail.com: domain of BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+8230b42af99c397292d7+7460+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706275758; a=rsa-sha256; cv=none; b=bgkAInsle/NVc/SrERS77RDKtIL+oxHz+qG2D6DCRloSqmXG7VstzLzaKmFWHDGbqwh5Y9 3o63nUMbkpB+JI8/mL8qv+NyaKL9VQUbY9Qp5iJ3gZ9fuKhPKb44FVrZ/dHsfWhPzXlkjl MNDhJRC7RkFOAqToFWJv4wTFwevzJvg= 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=V10/A/+wNuc0NlJNXVGAXChnWVFO1SMkrJedGiK3O78=; b=J1H+EZdm9VT6WaQwDXIf7WQzZ2 neIrk7Ry57Zndr0qGsUVy5pE45VTLlH/vAX+Hri7DcR5uYvqhIjnA4oj/M4Op+o/UO6K9nJ/BU1SP vQPu0W5B1jY51UZ7HmnKd6k0U9R+Ijlm//w9apBs8DwZCQ8OKQhjdXc+jBCWxobWhA9XM7GEFRZey I68z+53WHEgykpnFPVyGUGhDW4HNMNWj+EsuAssuhkXhWj0Yypc7FEiXzkFvvN87YjJuxfWmRq6Zf v2LXSDN4FRsJ1fHUGZrE52Ep7LKpIkmQv3o50EV/DIPMquQ9kIetFBIBHDVIHMPMXt8gW2+SZyLqk GmmjBzTg==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTMGh-00000004CaT-1noG; Fri, 26 Jan 2024 13:29:16 +0000 From: Christoph Hellwig To: Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 02/21] shmem: move shmem_mapping out of line Date: Fri, 26 Jan 2024 14:28:44 +0100 Message-Id: <20240126132903.2700077-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240126132903.2700077-1-hch@lst.de> References: <20240126132903.2700077-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 7E8AB40012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: nm4sya519rdqmucgtj53k3s1gbc9xmy6 X-HE-Tag: 1706275758-463078 X-HE-Meta: U2FsdGVkX18Ykfd22XjLmDuBVDLQl0q9jV29cwBm81CKA4adild/YsizuuBN0JnR5amaeokPfdfSMMvuUthjs/oFZ8hzR3uAY7zWFnIWEVfU5VD5gQ8Jc2piiFBl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kMdOxxu0Y5pYHYZhnQN5qFTEt2zwVxhgvyA1efzLumiky3418AHRZWYiDjzJGCPDqDhdjLP6wK6bofT9au4bJdaMWLpbamjD68lXepZRJJOM+TK86t8ftMLfSU+ntJMRwBELM7qB8MwgdWDA9mxDoSqQoCd5wNh7UiLuba/dNkzocxwtUT7lgC8kClumqnAsSG3epRoRmZpONQa8z7exb3Ht9UepPd86deOcJbLsZ3yYtPwgPUIBE0NfeaV8PyhLmRg9JU7g= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: shmem_aops really should not be exported to the world. Move shmem_mapping and export it as internal for the one semi-legitimate modular user in udmabuf. Signed-off-by: Christoph Hellwig Reviewed-by: Matthew Wilcox (Oracle) --- include/linux/shmem_fs.h | 6 +----- mm/shmem.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 2caa6b86106aa3..6b96a87e4bc80a 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -97,11 +97,7 @@ extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); extern int shmem_lock(struct file *file, int lock, struct ucounts *ucounts); #ifdef CONFIG_SHMEM -extern const struct address_space_operations shmem_aops; -static inline bool shmem_mapping(struct address_space *mapping) -{ - return mapping->a_ops == &shmem_aops; -} +bool shmem_mapping(struct address_space *mapping); #else static inline bool shmem_mapping(struct address_space *mapping) { diff --git a/mm/shmem.c b/mm/shmem.c index d7c84ff621860b..f607b0cab7e4e2 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -254,7 +254,7 @@ static void shmem_inode_unacct_blocks(struct inode *inode, long pages) } static const struct super_operations shmem_ops; -const struct address_space_operations shmem_aops; +static const struct address_space_operations shmem_aops; static const struct file_operations shmem_file_operations; static const struct inode_operations shmem_inode_operations; static const struct inode_operations shmem_dir_inode_operations; @@ -263,6 +263,12 @@ static const struct vm_operations_struct shmem_vm_ops; static const struct vm_operations_struct shmem_anon_vm_ops; static struct file_system_type shmem_fs_type; +bool shmem_mapping(struct address_space *mapping) +{ + return mapping->a_ops == &shmem_aops; +} +EXPORT_SYMBOL_GPL(shmem_mapping); + bool vma_is_anon_shmem(struct vm_area_struct *vma) { return vma->vm_ops == &shmem_anon_vm_ops; @@ -4466,7 +4472,7 @@ static int shmem_error_remove_folio(struct address_space *mapping, return 0; } -const struct address_space_operations shmem_aops = { +static const struct address_space_operations shmem_aops = { .writepage = shmem_writepage, .dirty_folio = noop_dirty_folio, #ifdef CONFIG_TMPFS @@ -4478,7 +4484,6 @@ const struct address_space_operations shmem_aops = { #endif .error_remove_folio = shmem_error_remove_folio, }; -EXPORT_SYMBOL(shmem_aops); static const struct file_operations shmem_file_operations = { .mmap = shmem_mmap,