-----Original Message-----
From: Jรกn Tomko [mailto:jtomko@redhat.com]
Sent: Friday, January 16, 2015 10:21 PM
To: Chen, Hanxiao/้ ๆ้; libvir-list(a)redhat.com
Subject: Re: [libvirt] [PATCH 1/2] Introduce btrfsCloneFile for btrfs COW copy
On 01/13/2015 09:18 AM, Chen Hanxiao wrote:
> Signed-off-by: Chen Hanxiao <chenhanxiao(a)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 ?
We need to install btrfs-progs-devel for BTRFS_IOC_CLONE in
<btrfs/ioctl.h>.
So it should be easy to just define magic number and issue a ioctl,
than add a dependency on btrfs-progs-devel.
Do we need to add a LIBVIRT_CHECK_PKG for btrfs-progs-devel?
Thanks,
- Chen