diff mbox series

[10/22] xfs: use shmem_kernel_file_setup in xfile_create

Message ID 20240219062730.3031391-11-hch@lst.de (mailing list archive)
State New
Headers show
Series [01/22] mm: move mapping_set_update out of <linux/swap.h> | expand

Commit Message

Christoph Hellwig Feb. 19, 2024, 6:27 a.m. UTC
shmem_kernel_file_setup is equivalent to shmem_file_setup except that it
already sets the S_PRIVATE flag.  Use it instead of open coding the
logic.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/scrub/xfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Dave Chinner Feb. 20, 2024, 11:56 p.m. UTC | #1
On Mon, Feb 19, 2024 at 07:27:18AM +0100, Christoph Hellwig wrote:
> shmem_kernel_file_setup is equivalent to shmem_file_setup except that it
> already sets the S_PRIVATE flag.  Use it instead of open coding the
> logic.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/scrub/xfile.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c
> index e649558351bc5a..99a2b48f5662e6 100644
> --- a/fs/xfs/scrub/xfile.c
> +++ b/fs/xfs/scrub/xfile.c
> @@ -68,7 +68,7 @@ xfile_create(
>  	if (!xf)
>  		return -ENOMEM;
>  
> -	xf->file = shmem_file_setup(description, isize, VM_NORESERVE);
> +	xf->file = shmem_kernel_file_setup(description, isize, VM_NORESERVE);
>  	if (IS_ERR(xf->file)) {
>  		error = PTR_ERR(xf->file);
>  		goto out_xfile;
> @@ -85,7 +85,7 @@ xfile_create(
>  			    FMODE_LSEEK;
>  	xf->file->f_flags |= O_RDWR | O_LARGEFILE | O_NOATIME;
>  	inode = file_inode(xf->file);
> -	inode->i_flags |= S_PRIVATE | S_NOCMTIME | S_NOATIME;
> +	inode->i_flags |= S_NOCMTIME | S_NOATIME;
>  	inode->i_mode &= ~0177;
>  	inode->i_uid = GLOBAL_ROOT_UID;
>  	inode->i_gid = GLOBAL_ROOT_GID;

Looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Darrick J. Wong Feb. 21, 2024, 2:17 a.m. UTC | #2
On Mon, Feb 19, 2024 at 07:27:18AM +0100, Christoph Hellwig wrote:
> shmem_kernel_file_setup is equivalent to shmem_file_setup except that it
> already sets the S_PRIVATE flag.  Use it instead of open coding the
> logic.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/scrub/xfile.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c
> index e649558351bc5a..99a2b48f5662e6 100644
> --- a/fs/xfs/scrub/xfile.c
> +++ b/fs/xfs/scrub/xfile.c
> @@ -68,7 +68,7 @@ xfile_create(
>  	if (!xf)
>  		return -ENOMEM;
>  
> -	xf->file = shmem_file_setup(description, isize, VM_NORESERVE);
> +	xf->file = shmem_kernel_file_setup(description, isize, VM_NORESERVE);
>  	if (IS_ERR(xf->file)) {
>  		error = PTR_ERR(xf->file);
>  		goto out_xfile;
> @@ -85,7 +85,7 @@ xfile_create(
>  			    FMODE_LSEEK;
>  	xf->file->f_flags |= O_RDWR | O_LARGEFILE | O_NOATIME;
>  	inode = file_inode(xf->file);
> -	inode->i_flags |= S_PRIVATE | S_NOCMTIME | S_NOATIME;
> +	inode->i_flags |= S_NOCMTIME | S_NOATIME;
>  	inode->i_mode &= ~0177;
>  	inode->i_uid = GLOBAL_ROOT_UID;
>  	inode->i_gid = GLOBAL_ROOT_GID;
> -- 
> 2.39.2
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c
index e649558351bc5a..99a2b48f5662e6 100644
--- a/fs/xfs/scrub/xfile.c
+++ b/fs/xfs/scrub/xfile.c
@@ -68,7 +68,7 @@  xfile_create(
 	if (!xf)
 		return -ENOMEM;
 
-	xf->file = shmem_file_setup(description, isize, VM_NORESERVE);
+	xf->file = shmem_kernel_file_setup(description, isize, VM_NORESERVE);
 	if (IS_ERR(xf->file)) {
 		error = PTR_ERR(xf->file);
 		goto out_xfile;
@@ -85,7 +85,7 @@  xfile_create(
 			    FMODE_LSEEK;
 	xf->file->f_flags |= O_RDWR | O_LARGEFILE | O_NOATIME;
 	inode = file_inode(xf->file);
-	inode->i_flags |= S_PRIVATE | S_NOCMTIME | S_NOATIME;
+	inode->i_flags |= S_NOCMTIME | S_NOATIME;
 	inode->i_mode &= ~0177;
 	inode->i_uid = GLOBAL_ROOT_UID;
 	inode->i_gid = GLOBAL_ROOT_GID;