From 99db5fe5f3e301a37bd3576a02f15f96ba6e0eb9 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost <ehabkost@redhat.com> Date: Tue, 3 Mar 2009 16:44:08 -0300 Subject: [PATCH 2/3] kvm: external module: backward compatibility for compound_head() (cherry picked from commit 5ccf827b6347c04db6b779365b249a17fef62675) [ehabkost: solved conflicts manually on cherry-picking] Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> RH-Upstream-status: applied(kvm/master) Bugzilla: 488727 Acked-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Andrea Arcangeli <aarcange@redhat.com> --- kernel/external-module-compat-comm.h | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/kernel/external-module-compat-comm.h b/kernel/external-module-compat-comm.h index b86ed61..c1fc866 100644 --- a/kernel/external-module-compat-comm.h +++ b/kernel/external-module-compat-comm.h @@ -738,3 +738,16 @@ static inline void cpumask_clear_cpu(int cpu, cpumask_var_t mask) #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28) #define marker_synchronize_unregister() synchronize_sched() #endif + +/* compound_head() was introduced in 2.6.22 */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) + +static inline struct page *compound_head(struct page *page) +{ + if (PageCompound(page)) + page = (struct page *)page_private(page); + return page; +} + +#endif -- 1.6.1