From 68cf17efb9ccb01a7842368dd307c6f00d3a7ac2 Mon Sep 17 00:00:00 2001 From: yangsheng Date: Sun, 23 Dec 2012 04:14:49 +0800 Subject: [PATCH] LU-2148 mount: Kernel update for latest FC18 kernel 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 Change-Id: I53c6b56cee8276afc2a5ebc61d9199fbef1edfc9 Reviewed-on: http://review.whamcloud.com/4741 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Peng Tao Reviewed-by: Bob Glossman Reviewed-by: Andreas Dilger Reviewed-by: James Simmons --- lustre/autoconf/lustre-core.m4 | 35 ---------------------------------- lustre/include/linux/lustre_compat25.h | 31 ------------------------------ lustre/include/lustre_disk.h | 1 + lustre/obdclass/lprocfs_status.c | 11 ++++++++--- lustre/osd-ldiskfs/osd_handler.c | 4 ++++ lustre/osd-ldiskfs/osd_internal.h | 1 + lustre/osd-ldiskfs/osd_lproc.c | 4 +--- 7 files changed, 15 insertions(+), 72 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 4cc4bbf..bbecaf8 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 - #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 - #include - #include - ],[ - ((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], @@ -2324,7 +2290,6 @@ AC_DEFUN([LC_PROG_LINUX], LC_KERNEL_LOCKED # 2.6.38 - LC_ATOMIC_MNT_COUNT LC_BLKDEV_GET_BY_DEV LC_GENERIC_PERMISSION LC_QUOTA_ON_USE_PATH diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 53e6a8f..ae8dc0d 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -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 -#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) diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index dc49759..7913938 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -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_mntdev_name(sb) (s2lsi(sb)->lsi_lmd->lmd_dev) #endif /* __KERNEL__ */ diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 5d4b3fb..cfc7bcc 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -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; + struct lustre_mount_info *lmi; + const char *dev_name; 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; - 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); diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index c0e5a91..e2575f0 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -4376,6 +4376,10 @@ static int osd_mount(const struct lu_env *env, 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"); diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index e67bd62..5b28869 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -296,6 +296,7 @@ struct osd_device { /* 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; diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index 90494b6..6be8b90 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -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; - LASSERT(mnt_get_devname(osd->od_mnt)); *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, -- 1.8.3.1