[libvirt] [PATCH 1/2] Introduce btrfsCloneFile for btrfs COW copy

Ján Tomko jtomko at redhat.com
Fri Jan 16 14:21:22 UTC 2015


On 01/13/2015 09:18 AM, Chen Hanxiao wrote:
> Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
> ---
>  src/storage/storage_backend.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index b990a82..5ce3566 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c
> @@ -156,6 +156,32 @@ enum {
>  #define READ_BLOCK_SIZE_DEFAULT  (1024 * 1024)
>  #define WRITE_BLOCK_SIZE_DEFAULT (4 * 1024)
>  
> +/*
> + * Perform the O(1) btrfs clone operation, if possible.
> + * Upon success, return 0.  Otherwise, return -1 and set errno.
> + */
> +#if !defined(BTRFS_IOCTL_MAGIC)
> +# define BTRFS_IOCTL_MAGIC 0x94
> +#endif
> +
> +#define BTRFS_IOC_CLONE _IOW (BTRFS_IOCTL_MAGIC, 9, int)
> +

Instead of redefining the constants, can we check for btrfs.h at configure
time and wrap the function in #ifdef BTRFS_IOC_CLONE ?

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150116/a5f70a20/attachment-0001.sig>


More information about the libvir-list mailing list