diff mbox series

[08/22] xfs: use VM_NORESERVE in xfile_create

Message ID 20240219062730.3031391-9-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
xfile_create creates a (potentially large) sparse file.  Pass
VM_NORESERVE to shmem_file_setup to not account for the entire file size
at file creation time.

Reported-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/scrub/xfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Dave Chinner Feb. 20, 2024, 11:55 p.m. UTC | #1
On Mon, Feb 19, 2024 at 07:27:16AM +0100, Christoph Hellwig wrote:
> xfile_create creates a (potentially large) sparse file.  Pass
> VM_NORESERVE to shmem_file_setup to not account for the entire file size
> at file creation time.
> 
> Reported-by: Hugh Dickins <hughd@google.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/scrub/xfile.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c
> index 090c3ead43fdf1..1cf4b239bdbbd7 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, 0);
> +	xf->file = shmem_file_setup(description, isize, VM_NORESERVE);
>  	if (!xf->file)
>  		goto out_xfile;
>  	if (IS_ERR(xf->file)) {

Make sense.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff mbox series

Patch

diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c
index 090c3ead43fdf1..1cf4b239bdbbd7 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, 0);
+	xf->file = shmem_file_setup(description, isize, VM_NORESERVE);
 	if (!xf->file)
 		goto out_xfile;
 	if (IS_ERR(xf->file)) {