Whamcloud - gitweb
LU-709 build: cleanup VFS_KERN_MOUNT/INVALIDATEPAGE_RETURN_INT
authorPeng Tao <tao.peng@emc.com>
Sat, 25 Feb 2012 04:20:49 +0000 (12:20 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 25 Apr 2012 16:21:04 +0000 (12:21 -0400)
1. vfs_kern_mount is added since v2.6.18
2. invalidatepage returns void since v2.6.17

Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: I9926072d2d519c64ef927e02a13a6e9b0c72f2af
Reviewed-on: http://review.whamcloud.com/2320
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/llite/rw26.c
lustre/obdclass/obd_mount.c
lustre/obdfilter/filter.c

index b1ef9c2..b0dcb51 100644 (file)
@@ -840,45 +840,6 @@ LB_LINUX_TRY_COMPILE([
 EXTRA_KCFLAGS="$tmp_flags"
 ])
 
-#
-# LC_VFS_KERN_MOUNT
-# starting from 2.6.18 kernel don't export do_kern_mount
-# and want to use vfs_kern_mount instead.
-#
-AC_DEFUN([LC_VFS_KERN_MOUNT],
-[AC_MSG_CHECKING([vfs_kern_mount exist in kernel])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/mount.h>
-],[
-        vfs_kern_mount(NULL, 0, NULL, NULL);
-],[
-        AC_DEFINE(HAVE_VFS_KERN_MOUNT, 1,
-                [vfs_kern_mount exist in kernel])
-        AC_MSG_RESULT([yes])
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
-#
-# LC_INVALIDATEPAGE_RETURN_INT
-# 2.6.17 changes return type for invalidatepage to 'void' from 'int'
-#
-AC_DEFUN([LC_INVALIDATEPAGE_RETURN_INT],
-[AC_MSG_CHECKING([invalidatepage has return int])
-LB_LINUX_TRY_COMPILE([
-        #include <linux/buffer_head.h>
-],[
-       int rc = block_invalidatepage(NULL, 0);
-],[
-       AC_MSG_RESULT(yes)
-       AC_DEFINE(HAVE_INVALIDATEPAGE_RETURN_INT, 1,
-               [Define if return type of invalidatepage should be int])
-],[
-       AC_MSG_RESULT(no)
-])
-])
-
 # LC_UMOUNTBEGIN_HAS_VFSMOUNT
 # after 2.6.18 umount_begin has different parameters
 AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
@@ -2179,8 +2140,6 @@ AC_DEFUN([LC_PROG_LINUX],
          # 2.6.18
          LC_NR_PAGECACHE
          LC_STATFS_DENTRY_PARAM
-         LC_VFS_KERN_MOUNT
-         LC_INVALIDATEPAGE_RETURN_INT
          LC_UMOUNTBEGIN_HAS_VFSMOUNT
          LC_SEQ_LOCK
          LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
index d2939b5..d6d46e4 100644 (file)
@@ -385,22 +385,6 @@ int filemap_fdatawrite_range(struct address_space *mapping,
                              loff_t start, loff_t end);
 #endif /* HAVE_FILEMAP_FDATAWRITE_RANGE */
 
-#ifdef HAVE_VFS_KERN_MOUNT
-static inline struct vfsmount *
-ll_kern_mount(const char *fstype, int flags, const char *name, void *data)
-{
-        struct file_system_type *type = get_fs_type(fstype);
-        struct vfsmount *mnt;
-        if (!type)
-                return ERR_PTR(-ENODEV);
-        mnt = vfs_kern_mount(type, flags, name, data);
-        cfs_module_put(type->owner);
-        return mnt;
-}
-#else
-#define ll_kern_mount(fstype, flags, name, data) do_kern_mount((fstype), (flags), (name), (data))
-#endif
-
 #ifndef HAVE_ATOMIC_MNT_COUNT
 static inline unsigned int mnt_get_count(struct vfsmount *mnt)
 {
index 4577bc8..4e0a189 100644 (file)
  * aligned truncate). Lustre leaves partially truncated page in the cache,
  * relying on struct inode::i_size to limit further accesses.
  */
-static int cl_invalidatepage(struct page *vmpage, unsigned long offset)
+static void ll_invalidatepage(struct page *vmpage, unsigned long offset)
 {
         struct inode     *inode;
         struct lu_env    *env;
         struct cl_page   *page;
         struct cl_object *obj;
 
-        int result;
         int refcheck;
 
         LASSERT(PageLocked(vmpage));
@@ -97,7 +96,6 @@ static int cl_invalidatepage(struct page *vmpage, unsigned long offset)
          * below because they are run with page locked and all our io is
          * happening with locked page too
          */
-        result = 0;
         if (offset == 0) {
                 env = cl_env_get(&refcheck);
                 if (!IS_ERR(env)) {
@@ -109,7 +107,6 @@ static int cl_invalidatepage(struct page *vmpage, unsigned long offset)
                                         lu_ref_add(&page->cp_reference,
                                                    "delete", vmpage);
                                         cl_page_delete(env, page);
-                                        result = 1;
                                         lu_ref_del(&page->cp_reference,
                                                    "delete", vmpage);
                                         cl_page_put(env, page);
@@ -119,20 +116,7 @@ static int cl_invalidatepage(struct page *vmpage, unsigned long offset)
                         cl_env_put(env, &refcheck);
                 }
         }
-        return result;
-}
-
-#ifdef HAVE_INVALIDATEPAGE_RETURN_INT
-static int ll_invalidatepage(struct page *page, unsigned long offset)
-{
-        return cl_invalidatepage(page, offset);
-}
-#else /* !HAVE_INVALIDATEPAGE_RETURN_INT */
-static void ll_invalidatepage(struct page *page, unsigned long offset)
-{
-        cl_invalidatepage(page, offset);
 }
-#endif
 
 #ifdef HAVE_RELEASEPAGE_WITH_INT
 #define RELEASEPAGE_ARG_TYPE int
index fe9de98..c57916b 100644 (file)
@@ -1405,6 +1405,7 @@ static struct vfsmount *server_kernel_mount(struct super_block *sb)
         struct lustre_disk_data *ldd;
         struct lustre_mount_data *lmd = lsi->lsi_lmd;
         struct vfsmount *mnt;
+        struct file_system_type *type;
         char *options = NULL;
         unsigned long page, s_flags;
         struct page *__page;
@@ -1436,7 +1437,13 @@ static struct vfsmount *server_kernel_mount(struct super_block *sb)
 
         /* Pre-mount ldiskfs to read the MOUNT_DATA_FILE */
         CDEBUG(D_MOUNT, "Pre-mount ldiskfs %s\n", lmd->lmd_dev);
-        mnt = ll_kern_mount("ldiskfs", s_flags, lmd->lmd_dev, (void *)options);
+        type = get_fs_type("ldiskfs");
+        if (!type) {
+                CERROR("premount failed: cannot find ldiskfs module\n");
+                GOTO(out_free, rc = -ENODEV);
+        }
+        mnt = vfs_kern_mount(type, s_flags, lmd->lmd_dev, (void *)options);
+        cfs_module_put(type->owner);
         if (IS_ERR(mnt)) {
                 rc = PTR_ERR(mnt);
                 CERROR("premount %s:%#lx ldiskfs failed: %d "
@@ -1482,11 +1489,16 @@ static struct vfsmount *server_kernel_mount(struct super_block *sb)
 
         CDEBUG(D_MOUNT, "kern_mount: %s %s %s\n",
                MT_STR(ldd), lmd->lmd_dev, options);
-        mnt = ll_kern_mount(MT_STR(ldd), s_flags, lmd->lmd_dev,
-                            (void *)options);
+        type = get_fs_type(MT_STR(ldd));
+        if (!type) {
+                CERROR("get_fs_type failed\n");
+                GOTO(out_free, rc = -ENODEV);
+        }
+        mnt = vfs_kern_mount(type, s_flags, lmd->lmd_dev, (void *)options);
+        cfs_module_put(type->owner);
         if (IS_ERR(mnt)) {
                 rc = PTR_ERR(mnt);
-                CERROR("ll_kern_mount failed: rc = %d\n", rc);
+                CERROR("vfs_kern_mount failed: rc = %d\n", rc);
                 GOTO(out_free, rc);
         }
 
index 527b02f..9dc6584 100644 (file)
@@ -1969,6 +1969,7 @@ int filter_common_setup(struct obd_device *obd, struct lustre_cfg* lcfg,
 {
         struct filter_obd *filter = &obd->u.filter;
         struct vfsmount *mnt;
+        struct file_system_type *type;
         struct lustre_mount_info *lmi;
         struct obd_uuid uuid;
         __u8 *uuid_ptr;
@@ -1993,9 +1994,14 @@ int filter_common_setup(struct obd_device *obd, struct lustre_cfg* lcfg,
         } else {
                 /* old path - used by lctl */
                 CERROR("Using old MDS mount method\n");
-                mnt = ll_kern_mount(lustre_cfg_string(lcfg, 2),
-                                    MS_NOATIME|MS_NODIRATIME,
-                                    lustre_cfg_string(lcfg, 1), option);
+                type = get_fs_type(lustre_cfg_string(lcfg, 2));
+                if (!type) {
+                        CERROR("get_fs_type failed\n");
+                        RETURN(-ENODEV);
+                }
+                mnt = vfs_kern_mount(type, MS_NOATIME|MS_NODIRATIME,
+                                     lustre_cfg_string(lcfg, 1), option);
+                cfs_module_put(type->owner);
                 if (IS_ERR(mnt)) {
                         rc = PTR_ERR(mnt);
                         LCONSOLE_ERROR_MSG(0x135, "Can't mount disk %s (%d)\n",