Whamcloud - gitweb
LU-1756 kernel: cleanup lustre_compat25.h
authorPeng Tao <tao.peng@emc.com>
Thu, 16 Aug 2012 07:59:21 +0000 (15:59 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 20 Sep 2012 20:49:09 +0000 (16:49 -0400)
1. SEEK_XXX is always defined
2. page_private exists since v2.6.15
3. Page_Uptodate should be replaced with PageUptodate
4. unused functions:
   ll_kernel_locked(), ll_redirty_page(), KDEVT_INIT()
   ll_path_lookup(), try_lock_page()

Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: I90af2e5c4678738752e0f4cade5d4302f3d1fac7
Reviewed-on: http://review.whamcloud.com/3685
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
lustre/include/linux/lustre_compat25.h
lustre/llite/rw.c
lustre/llite/vvp_page.c

index b7dcb60..6a9c060 100644 (file)
 
 #include <linux/lustre_patchless_compat.h>
 
 
 #include <linux/lustre_patchless_compat.h>
 
-/* Some old kernels (like 2.6.9) may not define such SEEK_XXX. So the
- * definition allows to compile lustre client on more OS platforms. */
-#ifndef SEEK_SET
- #define SEEK_SET 0
- #define SEEK_CUR 1
- #define SEEK_END 2
-#endif
-
 #ifdef HAVE_FS_STRUCT_RWLOCK
 # define LOCK_FS_STRUCT(fs)   cfs_write_lock(&(fs)->lock)
 # define UNLOCK_FS_STRUCT(fs) cfs_write_unlock(&(fs)->lock)
 #ifdef HAVE_FS_STRUCT_RWLOCK
 # define LOCK_FS_STRUCT(fs)   cfs_write_lock(&(fs)->lock)
 # define UNLOCK_FS_STRUCT(fs) cfs_write_unlock(&(fs)->lock)
@@ -111,13 +103,6 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #define current_ngroups current_cred()->group_info->ngroups
 #define current_groups current_cred()->group_info->small_block
 
 #define current_ngroups current_cred()->group_info->ngroups
 #define current_groups current_cred()->group_info->small_block
 
-#ifndef page_private
-#define page_private(page) ((page)->private)
-#define set_page_private(page, v) ((page)->private = (v))
-#endif
-
-#define ll_kernel_locked()      kernel_locked()
-
 /*
  * OBD need working random driver, thus all our
  * initialization routines must be called after device
 /*
  * OBD need working random driver, thus all our
  * initialization routines must be called after device
@@ -128,18 +113,11 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
 #define module_init(a)     late_initcall(a)
 #endif
 
 #define module_init(a)     late_initcall(a)
 #endif
 
-/* XXX our code should be using the 2.6 calls, not the other way around */
-#ifdef HAVE_TRYLOCK_PAGE
-#define TestSetPageLocked(page)         (!trylock_page(page))
+#ifndef HAVE_TRYLOCK_PAGE
+#define trylock_page(page)             (!TestSetPageLocked(page))
 #endif
 
 #endif
 
-#define Page_Uptodate(page)             PageUptodate(page)
-#define ll_redirty_page(page)           set_page_dirty(page)
-
-#define KDEVT_INIT(val)                 (val)
-
 #define LTIME_S(time)                   (time.tv_sec)
 #define LTIME_S(time)                   (time.tv_sec)
-#define ll_path_lookup                  path_lookup
 
 #ifdef HAVE_EXPORT_INODE_PERMISSION
 #define ll_permission(inode,mask,nd)    inode_permission(inode,mask)
 
 #ifdef HAVE_EXPORT_INODE_PERMISSION
 #define ll_permission(inode,mask,nd)    inode_permission(inode,mask)
index 310cf45..8079d29 100644 (file)
@@ -500,10 +500,10 @@ static int cl_read_ahead_page(const struct lu_env *env, struct cl_io *io,
 
         rc = 0;
         cl_page_assume(env, io, page);
 
         rc = 0;
         cl_page_assume(env, io, page);
-        lu_ref_add(&page->cp_reference, "ra", cfs_current());
-        cp = cl2ccc_page(cl_page_at(page, &vvp_device_type));
-        if (!cp->cpg_defer_uptodate && !Page_Uptodate(vmpage)) {
-                rc = cl_page_is_under_lock(env, io, page);
+       lu_ref_add(&page->cp_reference, "ra", cfs_current());
+       cp = cl2ccc_page(cl_page_at(page, &vvp_device_type));
+       if (!cp->cpg_defer_uptodate && !PageUptodate(vmpage)) {
+               rc = cl_page_is_under_lock(env, io, page);
                 if (rc == -EBUSY) {
                         cp->cpg_defer_uptodate = 1;
                         cp->cpg_ra_used = 0;
                 if (rc == -EBUSY) {
                         cp->cpg_defer_uptodate = 1;
                         cp->cpg_ra_used = 0;
@@ -513,9 +513,10 @@ static int cl_read_ahead_page(const struct lu_env *env, struct cl_io *io,
                         cl_page_delete(env, page);
                         rc = -ENOLCK;
                 }
                         cl_page_delete(env, page);
                         rc = -ENOLCK;
                 }
-        } else
-                /* skip completed pages */
-                cl_page_unassume(env, io, page);
+       } else {
+               /* skip completed pages */
+               cl_page_unassume(env, io, page);
+       }
         lu_ref_del(&page->cp_reference, "ra", cfs_current());
         cl_page_put(env, page);
         RETURN(rc);
         lu_ref_del(&page->cp_reference, "ra", cfs_current());
         cl_page_put(env, page);
         RETURN(rc);
index b428744..c07cb29 100644 (file)
@@ -86,10 +86,10 @@ static int vvp_page_own(const struct lu_env *env,
         struct ccc_page *vpg    = cl2ccc_page(slice);
         cfs_page_t      *vmpage = vpg->cpg_page;
 
         struct ccc_page *vpg    = cl2ccc_page(slice);
         cfs_page_t      *vmpage = vpg->cpg_page;
 
-        LASSERT(vmpage != NULL);
-        if (nonblock) {
-                if (TestSetPageLocked(vmpage))
-                        return -EAGAIN;
+       LASSERT(vmpage != NULL);
+       if (nonblock) {
+               if (!trylock_page(vmpage))
+                       return -EAGAIN;
 
                 if (unlikely(PageWriteback(vmpage))) {
                         unlock_page(vmpage);
 
                 if (unlikely(PageWriteback(vmpage))) {
                         unlock_page(vmpage);