Re: [PATCH 02/20] shmem: move shmem_mapping out of line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 29 Jan 2024, Christoph Hellwig wrote:

> 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 <hch@xxxxxx>
> Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>

I'm okay with this change, but let's be polite and Cc the author
of the change which this reverts - v5.11's commit 30e6a51dbb05
("mm/shmem.c: make shmem_mapping() inline").

Interesting to notice that commit did EXPORT_SYMBOL(shmem_aops),
whereas shmem_mapping() had not been exported before; you're now
exporting it _GPL(), like other examples in mm/shmem.c: agreed.

Hugh

> ---
>  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,
> -- 
> 2.39.2
> 
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux