From patchwork Mon Jan 29 14:34: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: 13535760 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 A191BC47DB3 for ; Mon, 29 Jan 2024 14:35:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71BFB6B00A2; Mon, 29 Jan 2024 09:35:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A3006B00A3; Mon, 29 Jan 2024 09:35:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F8756B00A4; Mon, 29 Jan 2024 09:35:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2CF2A6B00A2 for ; Mon, 29 Jan 2024 09:35:18 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0B53C80A74 for ; Mon, 29 Jan 2024 14:35:18 +0000 (UTC) X-FDA: 81732596316.26.E935A56 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf27.hostedemail.com (Postfix) with ESMTP id 8640940011 for ; Mon, 29 Jan 2024 14:35:16 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=o0WIyZ8V; dmarc=none; spf=none (imf27.hostedemail.com: domain of BATV+95c35c30fd22f84c25d9+7463+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+95c35c30fd22f84c25d9+7463+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=1706538916; 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=nnaIGoG1q9qfUz3HCpUPzAYpM+4OPI2B6Bp4snlIbvg=; b=cz0s0gELAcAowf6HLOyK82uosW4lgOBEMF9C5cRH2Yk8LufszCorJCZKQ7dInp73OPPbD+ 7rUY+GXgCrEjFgs5toXU93eFbDn7D19v0Rg11flbtjtYgKpdmfSvDw/9r0VPqxJvwtkzuA 7OtxB5qoYfT+fBbmhA8VKoc89Ol6HpQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=o0WIyZ8V; dmarc=none; spf=none (imf27.hostedemail.com: domain of BATV+95c35c30fd22f84c25d9+7463+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+95c35c30fd22f84c25d9+7463+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706538916; a=rsa-sha256; cv=none; b=ZkCcRMjLXAeq/SDSvbKFJ3TcNdZei/lm/4/9yeYGf4y2gA0a2z/n3dwQ/nd59jDNg3Yo+w viy9bovMWupxwpCAcxriKhPQAklc1X6vVIVlpaoflc/w8fzgX2WbkaDOttpN5iLacWVkd2 VCsJkrnBYK6X76xeB7oZA1GL/pCmsY4= 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=nnaIGoG1q9qfUz3HCpUPzAYpM+4OPI2B6Bp4snlIbvg=; b=o0WIyZ8VynAr1Xcm+mMkaMz+sV SItf+DLeOV8R04PtqoOb6bQJw/5IbegZytSrH46ei+cEalfXeMP9Q3AwG84JA/p7W30jjRahB7b6I I0i2y8Vg9255nLLDHqydZ8IPeIv5Obptbgmk4ZOi2X3mIyII6WC/etqw0sNEDffUTdGllpy8TamYv 9rnUAdut6OLyVtun3mjYIYdmC3ftiQ5POh1ohTdFNZk8+SVewkyXtssI5AaHowWd2/A04iYP2t16O jtPse0UbmgdWQMA7Yk8S8knqnUJh4rQYMDwsnK79LQAAD0HDc830QSITk6iZ/6Qs7bC6E/llYyO/Y fQJ6PvYQ==; Received: from [2001:4bb8:182:6550:c70:4a89:bc61:3] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUSjA-0000000D65Y-2kjA; Mon, 29 Jan 2024 14:35:13 +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, Matthew Wilcox Subject: [PATCH 02/20] shmem: move shmem_mapping out of line Date: Mon, 29 Jan 2024 15:34:44 +0100 Message-Id: <20240129143502.189370-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129143502.189370-1-hch@lst.de> References: <20240129143502.189370-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: 8640940011 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: u8rraqbgecgu5fdd6su95cca9nxednj5 X-HE-Tag: 1706538916-24914 X-HE-Meta: U2FsdGVkX18dypMIm04vk0Z6+7ebyqxct6gNYtUlR87NHIOaTQw2lw934ydnWIL/k2T18cngPV4YOFuTjxRGHoZTHnFG1d/r41LhXZKt0zTqHkL1b+jx527Ddp7/8vd+ju6PNY8MI6cd4phGVBHsVxdM5K1OZuKlcXj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: 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,