Commit aefacb20 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Chandan Babu R

shmem: move shmem_mapping out of line

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.

This effectively reverts commit 30e6a51d ("mm/shmem.c: make
shmem_mapping() inline"). which added a bogus shmem_aops non-GPL export
for no reason whatsoever as there as no shmem_mapping call outside of
core MM code at that point.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatar"Matthew Wilcox (Oracle)" <willy@infradead.org>
Signed-off-by: default avatarChandan Babu R <chandanbabu@kernel.org>
parent b64e74e9
...@@ -97,11 +97,7 @@ extern unsigned long shmem_get_unmapped_area(struct file *, unsigned long addr, ...@@ -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); unsigned long len, unsigned long pgoff, unsigned long flags);
extern int shmem_lock(struct file *file, int lock, struct ucounts *ucounts); extern int shmem_lock(struct file *file, int lock, struct ucounts *ucounts);
#ifdef CONFIG_SHMEM #ifdef CONFIG_SHMEM
extern const struct address_space_operations shmem_aops; bool shmem_mapping(struct address_space *mapping);
static inline bool shmem_mapping(struct address_space *mapping)
{
return mapping->a_ops == &shmem_aops;
}
#else #else
static inline bool shmem_mapping(struct address_space *mapping) static inline bool shmem_mapping(struct address_space *mapping)
{ {
......
...@@ -254,7 +254,7 @@ static void shmem_inode_unacct_blocks(struct inode *inode, long pages) ...@@ -254,7 +254,7 @@ static void shmem_inode_unacct_blocks(struct inode *inode, long pages)
} }
static const struct super_operations shmem_ops; 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 file_operations shmem_file_operations;
static const struct inode_operations shmem_inode_operations; static const struct inode_operations shmem_inode_operations;
static const struct inode_operations shmem_dir_inode_operations; static const struct inode_operations shmem_dir_inode_operations;
...@@ -263,6 +263,12 @@ static const struct vm_operations_struct shmem_vm_ops; ...@@ -263,6 +263,12 @@ static const struct vm_operations_struct shmem_vm_ops;
static const struct vm_operations_struct shmem_anon_vm_ops; static const struct vm_operations_struct shmem_anon_vm_ops;
static struct file_system_type shmem_fs_type; 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) bool vma_is_anon_shmem(struct vm_area_struct *vma)
{ {
return vma->vm_ops == &shmem_anon_vm_ops; return vma->vm_ops == &shmem_anon_vm_ops;
...@@ -4466,7 +4472,7 @@ static int shmem_error_remove_folio(struct address_space *mapping, ...@@ -4466,7 +4472,7 @@ static int shmem_error_remove_folio(struct address_space *mapping,
return 0; return 0;
} }
const struct address_space_operations shmem_aops = { static const struct address_space_operations shmem_aops = {
.writepage = shmem_writepage, .writepage = shmem_writepage,
.dirty_folio = noop_dirty_folio, .dirty_folio = noop_dirty_folio,
#ifdef CONFIG_TMPFS #ifdef CONFIG_TMPFS
...@@ -4478,7 +4484,6 @@ const struct address_space_operations shmem_aops = { ...@@ -4478,7 +4484,6 @@ const struct address_space_operations shmem_aops = {
#endif #endif
.error_remove_folio = shmem_error_remove_folio, .error_remove_folio = shmem_error_remove_folio,
}; };
EXPORT_SYMBOL(shmem_aops);
static const struct file_operations shmem_file_operations = { static const struct file_operations shmem_file_operations = {
.mmap = shmem_mmap, .mmap = shmem_mmap,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment