From patchwork Fri Jan 23 18:41:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 3813 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0NIbKkp006493 for ; Fri, 23 Jan 2009 10:37:20 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753071AbZAWSl4 (ORCPT ); Fri, 23 Jan 2009 13:41:56 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756174AbZAWSl4 (ORCPT ); Fri, 23 Jan 2009 13:41:56 -0500 Received: from mx2.redhat.com ([66.187.237.31]:37024 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753071AbZAWSlz (ORCPT ); Fri, 23 Jan 2009 13:41:55 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0NIfsBQ007846 for ; Fri, 23 Jan 2009 13:41:54 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0NIfsGr017190; Fri, 23 Jan 2009 13:41:54 -0500 Received: from blackpad.localdomain (vpn-10-13.bos.redhat.com [10.16.10.13]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0NIfsnC010611; Fri, 23 Jan 2009 13:41:54 -0500 Received: by blackpad.localdomain (Postfix, from userid 500) id 7058368068A; Fri, 23 Jan 2009 16:41:35 -0200 (BRST) From: Eduardo Habkost To: Avi Kivity Cc: kvm@vger.kernel.org, Eduardo Habkost Subject: [PATCH 2/3] Use native anon_inodes on RHEL5 if available Date: Fri, 23 Jan 2009 16:41:34 -0200 Message-Id: <1232736095-26244-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1232736095-26244-1-git-send-email-ehabkost@redhat.com> References: <1232736095-26244-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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 -#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,