start centralizing kernel compat mess
PATCH 1/1 start centralizing kernel compat mess
inode.c +2 -8
@@ -33,6 +33,8 @@#include "inc/ocfs.h" #include "inc/ocfs_journal.h" +#include "kcompat.h" +#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_INODEextern struct semaphore recovery_list_sem;
@@ -790,11 +792,7 @@memcpy (kaddr, symname, len -1 ); mapping->a_ops->commit_write (NULL , page,0 , len -1 ); err = mapping->a_ops->readpage (NULL , page); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )wait_on_page_locked (page); -#else -wait_on_page (page); -#endif page_cache_release (page);if (err <0 ) goto fail;
@@ -802,11 +800,7 @@return 0 ; fail_map: -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )unlock_page (page); -#else -UnlockPage (page); -#endif page_cache_release (page); fail:return err;
symlink.c +2 -8
@@ -34,10 +34,11 @@#include <linux/types.h> #include <linux/slab.h> +#include <linux/utsname.h> #include "inc/ocfs_log.h" #include "inc/ocfs.h" -#include <linux/utsname.h> +#include "kcompat.h" #define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_SYMLINK
@@ -160,15 +161,8 @@ NULL);if (IS_ERR (page)) goto sync_fail; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )wait_on_page_locked (page);if (!PageUptodate (page)) - -#else -wait_on_page (page); - if (!Page_Uptodate(page)) - -#endif goto async_fail; *ppage = page;return kmap (page);
kcompat.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef _KCOMPAT_H +#define _KCOMPAT_H + +#include <linux/version.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,0 ) +#define wait_on_page_locked (p) wait_on_page(p) +#define unlock_page (p) UnlockPage(p) +#define Page_Uptodate (p) PageUptodate(p) +#endif + +#endif /* _KCOMPAT_H */
PATCH 1/1 start centralizing kernel compat mess
Committed all your patches posted today to trunk, except for this one, which went on the format-changes branch since we have an ocfs_compat.h in place there already. Thanks!
-Manish
Quoted 86 lines · Christoph Hellwig
Index:
src/inode.c
===================================================================inode.c +2
-8@@ -33,6 +33,8 @@#include "inc/ocfs.h" #include "inc/ocfs_journal.h" +#include "kcompat.h" +#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_INODEextern struct semaphore recovery_list_sem;@@ -790,11 +792,7 @@memcpy (kaddr, symname, len -1 ); mapping->a_ops->commit_write (NULL , page,0 , len -1 ); err = mapping->a_ops->readpage (NULL , page); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )wait_on_page_locked (page); -#else -wait_on_page (page); -#endif page_cache_release (page);if (err <0 ) goto fail;@@ -802,11 +800,7 @@return 0 ; fail_map: -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )unlock_page (page); -#else -UnlockPage (page); -#endif page_cache_release (page); fail:return err;Index:
src/symlink.c
===================================================================symlink.c +2
-8@@ -34,10 +34,11 @@#include <linux/types.h> #include <linux/slab.h> +#include <linux/utsname.h> #include "inc/ocfs_log.h" #include "inc/ocfs.h" -#include <linux/utsname.h> +#include "kcompat.h" #define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_SYMLINK@@ -160,15 +161,8 @@ NULL);if (IS_ERR (page)) goto sync_fail; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,0 )wait_on_page_locked (page);if (!PageUptodate (page)) - -#else -wait_on_page (page); - if (!Page_Uptodate(page)) - -#endif goto async_fail; *ppage = page;return kmap (page);kcompat.h new file +12
-0@@ -0,0 +1,12 @@ +#ifndef _KCOMPAT_H +#define _KCOMPAT_H + +#include <linux/version.h> + +#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,0 ) +#define wait_on_page_locked (p) wait_on_page(p) +#define unlock_page (p) UnlockPage(p) +#define Page_Uptodate (p) PageUptodate(p) +#endif + +#endif /* _KCOMPAT_H */