[libvirt] [PATCH] storage_util: Prefer generic FICLONE over btrfs/xfs defines

Michal Privoznik posted 1 patch 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/c711914cccf9067cf7c75f6c6f31ed730ca81c61.1531148374.git.mprivozn@redhat.com
Test syntax-check passed
src/storage/storage_util.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

[libvirt] [PATCH] storage_util: Prefer generic FICLONE over btrfs/xfs defines

Posted by Michal Privoznik 1 week ago
After my change to the original patch that resulted in commit
8ed874b39b3 it was brought to my attention that all three defines
are the same: FICLONE = BTRFS_IOC_CLONE = XFS_IOC_CLONE.
Therefore we should prefer generic FICLONE over 'specific'
defines for btrfs/xfs.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/storage/storage_util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index da99043e0a..715d5c2f88 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -46,14 +46,14 @@
 # include <selinux/selinux.h>
 #endif
 
-#if HAVE_LINUX_BTRFS_H
+#ifdef FICLONE
+# define REFLINK_IOC_CLONE FICLONE
+#elif HAVE_LINUX_BTRFS_H
 # include <linux/btrfs.h>
 # define REFLINK_IOC_CLONE BTRFS_IOC_CLONE
 #elif HAVE_XFS_XFS_H
 # include <xfs/xfs.h>
 # define REFLINK_IOC_CLONE XFS_IOC_CLONE
-#elif defined(FICLONE)
-# define REFLINK_IOC_CLONE FICLONE
 #endif
 
 #include "datatypes.h"
-- 
2.16.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] storage_util: Prefer generic FICLONE over btrfs/xfs defines

Posted by Andrea Bolognani 1 week ago
On Mon, 2018-07-09 at 16:59 +0200, Michal Privoznik wrote:
> After my change to the original patch that resulted in commit
> 8ed874b39b3 it was brought to my attention that all three defines
> are the same: FICLONE = BTRFS_IOC_CLONE = XFS_IOC_CLONE.

I'd mention that this is documented in ioctl_ficlone(2), just
for completeness' sake.

It's pretty weird that *_IOC_CLONE have not been redefined in
terms of FICLONE once the latter had been introduced. Oh well.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list