Whamcloud - gitweb
LU-2148 mount: Kernel update for latest FC18 kernel
authoryangsheng <ys@whamcloud.com>
Sat, 22 Dec 2012 20:14:49 +0000 (04:14 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 4 Jan 2013 15:33:31 +0000 (10:33 -0500)
Upstream kernel has hidden the mount gut. So get rid
of mount.h dependence. Then we can build patchless
client using kernel-devel rpms for FC18.

Signed-off-by: yang sheng <ys@whamcloud.com>
Change-Id: I53c6b56cee8276afc2a5ebc61d9199fbef1edfc9
Reviewed-on: http://review.whamcloud.com/4741
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/include/lustre_disk.h
lustre/obdclass/lprocfs_status.c
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_lproc.c

index 4cc4bbf..bbecaf8 100644 (file)
@@ -1658,40 +1658,6 @@ AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
 ])
 
 #
 ])
 
 #
-# 2.6.38 vfsmount.mnt_count doesn't use atomic_t
-#
-# 3.3 starts hiding vfsmount guts series (move from include/linux/mount.h to
-# fs/mount.h, see kernel commit 7d6fec45a5131918b51dcd76da52f2ec86a85be6)
-#
-AC_DEFUN([LC_ATOMIC_MNT_COUNT],
-[AC_MSG_CHECKING([if vfsmount guts is hidden, or vfsmount.mnt_count is atomic_t.])
-LB_LINUX_TRY_COMPILE([
-       #include <linux/fs.h>
-       #include <../fs/mount.h>
-],[
-       struct mount *mnt =  real_mount((struct vfsmount *)0);
-],[
-       AC_DEFINE(HAVE_HIDE_VFSMOUNT_GUTS, 1,
-                 [hide vfsmount guts in fs/mount.h])
-       AC_MSG_RESULT([yes, hide vfsmount guts in fs/mount.h])
-],[
-       LB_LINUX_TRY_COMPILE([
-               #include <asm/atomic.h>
-               #include <linux/fs.h>
-               #include <linux/mount.h>
-       ],[
-               ((struct vfsmount *)0)->mnt_count = ((atomic_t) { 0 });
-       ],[
-               AC_DEFINE(HAVE_ATOMIC_MNT_COUNT, 1,
-                       [vfsmount.mnt_count is atomic_t])
-               AC_MSG_RESULT([yes, vfsmount.mnt_count is atomic_t])
-       ],[
-               AC_MSG_RESULT([no])
-       ])
-])
-])
-
-#
 # 2.6.38 use path as 4th parameter in quota_on.
 #
 AC_DEFUN([LC_QUOTA_ON_USE_PATH],
 # 2.6.38 use path as 4th parameter in quota_on.
 #
 AC_DEFUN([LC_QUOTA_ON_USE_PATH],
@@ -2324,7 +2290,6 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_KERNEL_LOCKED
 
          # 2.6.38
          LC_KERNEL_LOCKED
 
          # 2.6.38
-         LC_ATOMIC_MNT_COUNT
          LC_BLKDEV_GET_BY_DEV
          LC_GENERIC_PERMISSION
          LC_QUOTA_ON_USE_PATH
          LC_BLKDEV_GET_BY_DEV
          LC_GENERIC_PERMISSION
          LC_QUOTA_ON_USE_PATH
index 53e6a8f..ae8dc0d 100644 (file)
@@ -180,37 +180,6 @@ static inline struct file *ll_dentry_open(struct dentry *dentry,
 # define inode_dio_done(i)             up_read(&(i)->i_alloc_sem)
 #endif
 
 # define inode_dio_done(i)             up_read(&(i)->i_alloc_sem)
 #endif
 
-#ifdef HAVE_HIDE_VFSMOUNT_GUTS
-# include <../fs/mount.h>
-#else
-# define real_mount(mnt)       (mnt)
-#endif
-
-static inline const char *mnt_get_devname(struct vfsmount *mnt)
-{
-       return real_mount(mnt)->mnt_devname;
-}
-
-#ifndef HAVE_ATOMIC_MNT_COUNT
-static inline unsigned int mnt_get_count(struct vfsmount *mnt)
-{
-#ifdef CONFIG_SMP
-       unsigned int count = 0;
-       int cpu;
-
-       for_each_possible_cpu(cpu) {
-               count += per_cpu_ptr(real_mount(mnt)->mnt_pcp, cpu)->mnt_count;
-       }
-
-       return count;
-#else
-       return real_mount(mnt)->mnt_count;
-#endif
-}
-#else
-# define mnt_get_count(mnt)      cfs_atomic_read(&(real_mount(mnt)->mnt_count))
-#endif
-
 #ifdef HAVE_RW_TREE_LOCK
 #define TREE_READ_LOCK_IRQ(mapping)    read_lock_irq(&(mapping)->tree_lock)
 #define TREE_READ_UNLOCK_IRQ(mapping)  read_unlock_irq(&(mapping)->tree_lock)
 #ifdef HAVE_RW_TREE_LOCK
 #define TREE_READ_LOCK_IRQ(mapping)    read_lock_irq(&(mapping)->tree_lock)
 #define TREE_READ_UNLOCK_IRQ(mapping)  read_unlock_irq(&(mapping)->tree_lock)
index dc49759..7913938 100644 (file)
@@ -509,6 +509,7 @@ struct lustre_sb_info {
 
 #define     get_profile_name(sb)   (s2lsi(sb)->lsi_lmd->lmd_profile)
 #define            get_mount_flags(sb)    (s2lsi(sb)->lsi_lmd->lmd_flags)
 
 #define     get_profile_name(sb)   (s2lsi(sb)->lsi_lmd->lmd_profile)
 #define            get_mount_flags(sb)    (s2lsi(sb)->lsi_lmd->lmd_flags)
+#define            get_mntdev_name(sb)    (s2lsi(sb)->lsi_lmd->lmd_dev)
 
 #endif /* __KERNEL__ */
 
 
 #endif /* __KERNEL__ */
 
index 5d4b3fb..cfc7bcc 100644 (file)
@@ -48,6 +48,7 @@
 #include <lprocfs_status.h>
 #include <lustre_fsfilt.h>
 #include <lustre_log.h>
 #include <lprocfs_status.h>
 #include <lustre_fsfilt.h>
 #include <lustre_log.h>
+#include <lustre_disk.h>
 #include <lustre/lustre_idl.h>
 #include <dt_object.h>
 
 #include <lustre/lustre_idl.h>
 #include <dt_object.h>
 
@@ -2638,12 +2639,16 @@ int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off,
                           int count, int *eof, void *data)
 {
        struct obd_device *obd = (struct obd_device *)data;
                           int count, int *eof, void *data)
 {
        struct obd_device *obd = (struct obd_device *)data;
+       struct lustre_mount_info *lmi;
+       const char *dev_name;
 
        LASSERT(obd != NULL);
 
        LASSERT(obd != NULL);
-       LASSERT(mnt_get_devname(obd->u.obt.obt_vfsmnt));
+       lmi = server_get_mount_2(obd->obd_name);
+       dev_name = get_mntdev_name(lmi->lmi_sb);
+       LASSERT(dev_name != NULL);
        *eof = 1;
        *eof = 1;
-       return snprintf(page, count, "%s\n",
-                       mnt_get_devname(obd->u.obt.obt_vfsmnt));
+       server_put_mount_2(obd->obd_name, lmi->lmi_mnt);
+       return snprintf(page, count, "%s\n", dev_name);
 }
 EXPORT_SYMBOL(lprocfs_obd_rd_mntdev);
 
 }
 EXPORT_SYMBOL(lprocfs_obd_rd_mntdev);
 
index c0e5a91..e2575f0 100644 (file)
@@ -4376,6 +4376,10 @@ static int osd_mount(const struct lu_env *env,
        if (o->od_mnt != NULL)
                RETURN(0);
 
        if (o->od_mnt != NULL)
                RETURN(0);
 
+       if (strlen(dev) >= sizeof(o->od_mntdev))
+               RETURN(-E2BIG);
+       strcpy(o->od_mntdev, dev);
+
         o->od_fsops = fsfilt_get_ops(mt_str(LDD_MT_LDISKFS));
         if (o->od_fsops == NULL) {
                 CERROR("Can't find fsfilt_ldiskfs\n");
         o->od_fsops = fsfilt_get_ops(mt_str(LDD_MT_LDISKFS));
         if (o->od_fsops == NULL) {
                 CERROR("Can't find fsfilt_ldiskfs\n");
index e67bd62..5b28869 100644 (file)
@@ -296,6 +296,7 @@ struct osd_device {
 
        /* service name associated with the osd device */
        char                      od_svname[MAX_OBD_NAME];
 
        /* service name associated with the osd device */
        char                      od_svname[MAX_OBD_NAME];
+       char                      od_mntdev[MAX_OBD_NAME];
 
        /* quota slave instance */
        struct qsd_instance      *od_quota_slave;
 
        /* quota slave instance */
        struct qsd_instance      *od_quota_slave;
index 90494b6..6be8b90 100644 (file)
@@ -329,11 +329,9 @@ static int lprocfs_osd_rd_mntdev(char *page, char **start, off_t off, int count,
        if (unlikely(osd->od_mnt == NULL))
                 return -EINPROGRESS;
 
        if (unlikely(osd->od_mnt == NULL))
                 return -EINPROGRESS;
 
-       LASSERT(mnt_get_devname(osd->od_mnt));
        *eof = 1;
 
        *eof = 1;
 
-       return snprintf(page, count, "%s\n",
-                       mnt_get_devname(osd->od_mnt));
+       return snprintf(page, count, "%s\n", osd->od_mntdev);
 }
 
 static int lprocfs_osd_rd_cache(char *page, char **start, off_t off,
 }
 
 static int lprocfs_osd_rd_cache(char *page, char **start, off_t off,