[Devel] [PATCH rh7 3/3] ext4: rename fallocate(FALLOC_FL_CONVERT_AND_EXTEND)

Dmitry Monakhov dmonakhov at openvz.org
Thu Mar 10 05:47:56 PST 2016


Maxim Patlasov <mpatlasov at virtuozzo.com> writes:

> The feature doesn't extend i_size anymore. Let's rename it properly:
>
> s/convert_and_extend/convert_unwritten
> s/CONVERT_AND_EXTEND/CONVERT_UNWRITTEN
>
> https://jira.sw.ru/browse/PSBM-22381
Ack-by: dmonakhov at openvz.org
>
> Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
> ---
>  fs/ext4/extents.c           |   10 +++++-----
>  fs/open.c                   |    6 +++---
>  include/uapi/linux/falloc.h |    3 +--
>  3 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index cf248ce..71b4b620 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -4666,8 +4666,8 @@ retry:
>  	ext4_std_error(inode->i_sb, err);
>  }
>  
> -static int ext4_convert_and_extend(struct inode *inode, loff_t offset,
> -				   loff_t len)
> +static int ext4_convert_unwritten(struct inode *inode, loff_t offset,
> +				  loff_t len)
>  {
>  	int err;
>  
> @@ -4938,7 +4938,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
>  	/* Return error if mode is not supported */
>  	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
>  		     FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
> -		     FALLOC_FL_CONVERT_AND_EXTEND))
> +		     FALLOC_FL_CONVERT_UNWRITTEN))
>  		return -EOPNOTSUPP;
>  
>  	/* If data is about to change we must drop csum */
> @@ -4949,8 +4949,8 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
>  	if (mode & FALLOC_FL_PUNCH_HOLE)
>  		return ext4_punch_hole(inode, offset, len);
>  
> -	if (mode & FALLOC_FL_CONVERT_AND_EXTEND)
> -		return ext4_convert_and_extend(inode, offset, len);
> +	if (mode & FALLOC_FL_CONVERT_UNWRITTEN)
> +		return ext4_convert_unwritten(inode, offset, len);
>  
>  	ret = ext4_convert_inline_data(inode);
>  	if (ret)
> diff --git a/fs/open.c b/fs/open.c
> index 22b9699..bc60c05 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -233,7 +233,7 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
>  	/* Return error if mode is not supported */
>  	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
>  		     FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
> -		     FALLOC_FL_CONVERT_AND_EXTEND))
> +		     FALLOC_FL_CONVERT_UNWRITTEN))
>  		return -EOPNOTSUPP;
>  
>  	/* Punch hole and zero range are mutually exclusive */
> @@ -252,8 +252,8 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
>  		return -EINVAL;
>  
>  	/* Convert-and-extend should only be used exclusively. */
> -	if ((mode & FALLOC_FL_CONVERT_AND_EXTEND) &&
> -	    (mode & ~FALLOC_FL_CONVERT_AND_EXTEND))
> +	if ((mode & FALLOC_FL_CONVERT_UNWRITTEN) &&
> +	    (mode & ~FALLOC_FL_CONVERT_UNWRITTEN))
>  		return -EINVAL;
>  
>  	if (!(file->f_mode & FMODE_WRITE))
> diff --git a/include/uapi/linux/falloc.h b/include/uapi/linux/falloc.h
> index 9461043..10cccca 100644
> --- a/include/uapi/linux/falloc.h
> +++ b/include/uapi/linux/falloc.h
> @@ -4,8 +4,7 @@
>  #define FALLOC_FL_KEEP_SIZE	0x01 /* default is extend size */
>  #define FALLOC_FL_PUNCH_HOLE	0x02 /* de-allocates range */
>  #define FALLOC_FL_NO_HIDE_STALE	0x04 /* reserved codepoint */
> -#define FALLOC_FL_CONVERT_AND_EXTEND 0x100 /* mark extents as initialized
> -					    * and extend i_size */
> +#define FALLOC_FL_CONVERT_UNWRITTEN 0x100 /* mark extents as initialized */
>  
>  
>  /*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/devel/attachments/20160310/a507f0fc/attachment-0001.sig>


More information about the Devel mailing list