Re: [PATCH 1/2] vfs: move generic_remap_checks out of mm

From: Matthew Wilcox
Date: Thu Oct 15 2020 - 07:38:38 EST


On Wed, Oct 14, 2020 at 05:31:21PM -0700, Darrick J. Wong wrote:
> I would like to move all the generic helpers for the vfs remap range
> functionality (aka clonerange and dedupe) into a separate file so that
> they won't be scattered across the vfs and the mm subsystems. The
> eventual goal is to be able to deselect remap_range.c if none of the
> filesystems need that code, but the tricky part here is picking a
> stable(ish) part of the merge window to rearrange code.

This makes sense to me. There's nothing page-cache about this function.

> diff --git a/mm/filemap.c b/mm/filemap.c
> index 99c49eeae71b..cf20e5aeb11b 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -3098,8 +3098,7 @@ EXPORT_SYMBOL(read_cache_page_gfp);
> * LFS limits. If pos is under the limit it becomes a short access. If it
> * exceeds the limit we return -EFBIG.
> */
> -static int generic_write_check_limits(struct file *file, loff_t pos,
> - loff_t *count)
> +int generic_write_check_limits(struct file *file, loff_t pos, loff_t *count)
> {
> struct inode *inode = file->f_mapping->host;
> loff_t max_size = inode->i_sb->s_maxbytes;

I wonder if generic_write_check_limits should be in fs/read_write.c --
it has nothing to do with the pagecache either.