[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140218045138.GI13997@dastard>
Date: Tue, 18 Feb 2014 15:51:38 +1100
From: Dave Chinner <david@...morbit.com>
To: Lukas Czerner <lczerner@...hat.com>
Cc: linux-ext4@...r.kernel.org, tytso@....edu,
linux-fsdevel@...r.kernel.org, xfs@....sgi.com
Subject: Re: [PATCH 6/6] xfs: Add support for FALLOC_FL_ZERO_RANGE
On Mon, Feb 17, 2014 at 04:08:23PM +0100, Lukas Czerner wrote:
> Introduce new FALLOC_FL_ZERO_RANGE flag for fallocate. This has the same
> functionality as xfs ioctl XFS_IOC_ZERO_RANGE.
>
> We can also preallocate blocks past EOF in the same was as with
> fallocate. Flag FALLOC_FL_KEEP_SIZE will cause the inode size to remain
> the same even if we preallocate blocks past EOF.
>
> It uses the same code to zero range as it is used by the
> XFS_IOC_ZERO_RANGE ioctl.
>
> Signed-off-by: Lukas Czerner <lczerner@...hat.com>
> ---
> fs/xfs/xfs_file.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 64b48ea..aec5f64 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -823,7 +823,8 @@ xfs_file_fallocate(
>
> if (!S_ISREG(inode->i_mode))
> return -EINVAL;
> - if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
> + if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
> + FALLOC_FL_ZERO_RANGE))
> return -EOPNOTSUPP;
>
> xfs_ilock(ip, XFS_IOLOCK_EXCL);
> @@ -840,8 +841,11 @@ xfs_file_fallocate(
> goto out_unlock;
> }
>
> - error = xfs_alloc_file_space(ip, offset, len,
> - XFS_BMAPI_PREALLOC);
> + if (mode & FALLOC_FL_ZERO_RANGE)
> + error = xfs_zero_file_space(ip, offset, len);
> + else
> + error = xfs_alloc_file_space(ip, offset, len,
> + XFS_BMAPI_PREALLOC);
> if (error)
> goto out_unlock;
> }
Looks OK.
Reviewed-by: Dave Chinner <dchinner@...hat.com>
--
Dave Chinner
david@...morbit.com
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists