# Re: \[PATCH v5 8/9\] vfs: Add vfs\_copy\_file\_range() support for pagecache copies

- From: Neil Brown \<hidden\>
- Date: 2015-10-08 03:08:26 
- List: linux-api
- Page: https://ratatoskr.run/linux-api/2015/10/100430
- Thread: https://ratatoskr.run/linux-nfs/2015/09/100093/t.md

```text
Anna Schumaker [ref] writes:

> @@ -1338,34 +1362,26 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
>  			    struct file *file_out, loff_t pos_out,
>  			    size_t len, unsigned int flags)
>  {
> -	struct inode *inode_in;
> -	struct inode *inode_out;
>  	ssize_t ret;
>  
> -	if (flags)
> +	/* Flags should only be used exclusively. */
> +	if ((flags & COPY_FR_COPY) && (flags & ~COPY_FR_COPY))
> +		return -EINVAL;
> +	if ((flags & COPY_FR_REFLINK) && (flags & ~COPY_FR_REFLINK))
> +		return -EINVAL;
> +	if ((flags & COPY_FR_DEDUP) && (flags & ~COPY_FR_DEDUP))
>  		return -EINVAL;
>  

Do you also need:

   if (flags & ~(COPY_FR_COPY | COPY_FR_REFLINK | COPY_FR_DEDUP))
   	return -EINVAL;

so that future user-space can test if the kernel supports new flags?

NeilBrown
```

## Attachments

- [signature.asc](https://ratatoskr.run/linux-api/2015/10/100430/attachment/0) (application/pgp-signature, 818 bytes)
