[PATCH 2/3] Use native anon_inodes on RHEL5 if available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Seom RHEL5 kernel versions include anon_inodes. Detect this case and
use the native anon_inodes implementation when available.

This patch also applies to the maint/2.6.29 branch.

Signed-off-by: Eduardo Habkost <ehabkost@xxxxxxxxxx>
---
 kernel/anon_inodes.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/kernel/anon_inodes.c b/kernel/anon_inodes.c
index 510303f..135adae 100644
--- a/kernel/anon_inodes.c
+++ b/kernel/anon_inodes.c
@@ -21,7 +21,14 @@
 
 #include <asm/uaccess.h>
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+/* anon_inodes on RHEL >= 5.2 is equivalent to 2.6.27 version */
+#ifdef RHEL_RELEASE_CODE
+#  if (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5,2)) && defined(CONFIG_ANON_INODES)
+#    define RHEL_ANON_INODES
+#  endif
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) && !defined(RHEL_ANON_INODES)
 
 static struct vfsmount *anon_inode_mnt __read_mostly;
 static struct inode *anon_inode_inode;
@@ -228,7 +235,7 @@ void kvm_exit_anon_inodes(void)
 
 #undef anon_inode_getfd
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) && !defined(RHEL_ANON_INODES)
 
 int kvm_anon_inode_getfd(const char *name,
 			 const struct file_operations *fops,
@@ -245,7 +252,7 @@ int kvm_anon_inode_getfd(const char *name,
 	return fd;
 }
 
-#elif LINUX_VERSION_CODE == KERNEL_VERSION(2,6,26)
+#elif LINUX_VERSION_CODE == KERNEL_VERSION(2,6,26) && !defined(RHEL_ANON_INODES)
 
 int kvm_anon_inode_getfd(const char *name,
 			 const struct file_operations *fops,
-- 
1.6.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux