From: Mikhail Pershin Date: Fri, 2 Jul 2010 13:14:30 +0000 (+0400) Subject: b=15936 minor fixes noted in inspection X-Git-Tag: 2.0.0.51~48 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=049b0a621a9bb4186af11aea4ebd9c6430052f13 b=15936 minor fixes noted in inspection i=adilger,zam Use single place for mount count, unify mntdev getting, introduce obt_magic to make sure obt is correct. --- diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index 228ca9f..4555343 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -659,7 +659,8 @@ int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off, int count, int *eof, void *data); int lprocfs_obd_wr_recovery_time_hard(struct file *file, const char *buffer, unsigned long count, void *data); - +int lprocfs_obd_rd_mntdev(char *page, char **start, off_t off, + int count, int *eof, void *data); /* all quota proc functions */ extern int lprocfs_quota_rd_bunit(char *page, char **start, off_t off, int count, int *eof, void *data); diff --git a/lustre/include/lu_target.h b/lustre/include/lu_target.h index 19bf8ff..1ec6e66 100644 --- a/lustre/include/lu_target.h +++ b/lustre/include/lu_target.h @@ -57,8 +57,6 @@ struct lu_target { cfs_spinlock_t lut_client_bitmap_lock; /** Bitmap of known clients */ unsigned long *lut_client_bitmap; - /** Number of mounts */ - __u64 lut_mount_count; }; typedef void (*lut_cb_t)(struct lu_target *lut, __u64 transno, diff --git a/lustre/include/lustre_log.h b/lustre/include/lustre_log.h index 8c0845d..634a19b 100644 --- a/lustre/include/lustre_log.h +++ b/lustre/include/lustre_log.h @@ -389,6 +389,9 @@ static inline void llog_gen_init(struct llog_ctxt *ctxt) { struct obd_device *obd = ctxt->loc_exp->exp_obd; + LASSERTF(obd->u.obt.obt_magic == OBT_MAGIC, + "%s: wrong obt magic %#x\n", + obd->obd_name, obd->u.obt.obt_magic); ctxt->loc_gen.mnt_cnt = obd->u.obt.obt_mount_count; ctxt->loc_gen.conn_cnt++; } diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 1938cb1..79674c1 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -228,8 +228,10 @@ struct brw_page { struct ost_server_data; +#define OBT_MAGIC 0xBDDECEAE /* hold common fields for "target" device */ struct obd_device_target { + __u32 obt_magic; struct super_block *obt_sb; /** last_rcvd file */ struct file *obt_rcvd_filp; diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 7fd6ec0..7430bb6 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -318,7 +318,7 @@ static void mds_init_ctxt(struct obd_device *obd, struct vfsmount *mnt) mds->mds_obt.obt_vfsmnt = mnt; /* why not mnt->mnt_sb instead of mnt->mnt_root->d_inode->i_sb? */ obd->u.obt.obt_sb = mnt->mnt_root->d_inode->i_sb; - + obd->u.obt.obt_magic = OBT_MAGIC; fsfilt_setup(obd, obd->u.obt.obt_sb); OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt); diff --git a/lustre/mds/lproc_mds.c b/lustre/mds/lproc_mds.c index 102e790..25ca6b6 100644 --- a/lustre/mds/lproc_mds.c +++ b/lustre/mds/lproc_mds.c @@ -43,18 +43,6 @@ #include "mds_internal.h" #ifdef LPROCFS -static int lprocfs_mds_rd_mntdev(char *page, char **start, off_t off, int count, - int *eof, void *data) -{ - struct obd_device* obd = (struct obd_device *)data; - - LASSERT(obd != NULL); - LASSERT(obd->u.obt.obt_vfsmnt->mnt_devname); - *eof = 1; - - return snprintf(page, count, "%s\n",obd->u.obt.obt_vfsmnt->mnt_devname); -} - static int lprocfs_mds_rd_evictostnids(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -173,7 +161,7 @@ struct lprocfs_vars lprocfs_mds_obd_vars[] = { { "filestotal", lprocfs_rd_filestotal, 0, 0 }, { "filesfree", lprocfs_rd_filesfree, 0, 0 }, { "fstype", lprocfs_rd_fstype, 0, 0 }, - { "mntdev", lprocfs_mds_rd_mntdev, 0, 0 }, + { "mntdev", lprocfs_obd_rd_mntdev, 0, 0 }, { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 }, { "hash_stats", lprocfs_obd_rd_hash, 0, 0 }, { "evict_client", 0, lprocfs_mds_wr_evict_client, 0 }, diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index bf0f760..47502fc 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5245,7 +5245,8 @@ static int mdt_upcall(const struct lu_env *env, struct md_device *md, m->mdt_max_mdsize, m->mdt_max_cookiesize); mdt_allow_cli(m, CONFIG_SYNC); if (data) - (*(__u64 *)data) = m->mdt_lut.lut_mount_count; + (*(__u64 *)data) = + m->mdt_lut.lut_obd->u.obt.obt_mount_count; break; case MD_NO_TRANS: mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 2aef7e7..9de4773 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -230,7 +230,7 @@ static int mdt_som_attr_set(struct mdt_thread_info *info, ma->ma_som->msd_size = la->la_valid & LA_SIZE ? la->la_size : 0; ma->ma_som->msd_blocks = la->la_valid & LA_BLOCKS ? la->la_blocks : 0; - ma->ma_som->msd_mountid = mdt->mdt_lut.lut_mount_count; + ma->ma_som->msd_mountid = mdt->mdt_lut.lut_obd->u.obt.obt_mount_count; ma->ma_attr.la_valid &= LA_ATIME | LA_MTIME | LA_CTIME; } else { ma->ma_som->msd_ioepoch = IOEPOCH_INVAL; diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index bf658e0..61721c0 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -472,8 +472,8 @@ static int mdt_server_data_init(const struct lu_env *env, obd->obd_last_committed = mdt->mdt_lut.lut_last_transno; cfs_spin_unlock(&mdt->mdt_lut.lut_translock); - mdt->mdt_lut.lut_mount_count = mount_count + 1; - lsd->lsd_mount_count = mdt->mdt_lut.lut_mount_count; + obd->u.obt.obt_mount_count = mount_count + 1; + lsd->lsd_mount_count = obd->u.obt.obt_mount_count; /* save it, so mount count and last_transno is current */ rc = mdt_server_data_update(env, mdt); @@ -503,7 +503,8 @@ static int mdt_server_data_update(const struct lu_env *env, RETURN(PTR_ERR(th)); CDEBUG(D_SUPER, "MDS mount_count is "LPU64", last_transno is "LPU64"\n", - mdt->mdt_lut.lut_mount_count, mdt->mdt_lut.lut_last_transno); + mdt->mdt_lut.lut_obd->u.obt.obt_mount_count, + mdt->mdt_lut.lut_last_transno); cfs_spin_lock(&mdt->mdt_lut.lut_translock); mdt->mdt_lut.lut_lsd.lsd_last_transno = mdt->mdt_lut.lut_last_transno; diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index e134215..1a83697 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -2305,6 +2305,19 @@ int lprocfs_obd_wr_recovery_time_hard(struct file *file, const char *buffer, } EXPORT_SYMBOL(lprocfs_obd_wr_recovery_time_hard); +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; + + LASSERT(obd != NULL); + LASSERT(obd->u.obt.obt_vfsmnt->mnt_devname); + *eof = 1; + return snprintf(page, count, "%s\n", + obd->u.obt.obt_vfsmnt->mnt_devname); +} +EXPORT_SYMBOL(lprocfs_obd_rd_mntdev); + EXPORT_SYMBOL(lprocfs_register); EXPORT_SYMBOL(lprocfs_srch); EXPORT_SYMBOL(lprocfs_remove); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 56d7b83..82dfe24 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -892,8 +892,8 @@ static int filter_init_server_data(struct obd_device *obd, struct file * filp) obd->obd_last_committed = le64_to_cpu(lsd->lsd_last_transno); out: - lut->lut_mount_count = mount_count + 1; - lsd->lsd_mount_count = cpu_to_le64(lut->lut_mount_count); + obd->u.obt.obt_mount_count = mount_count + 1; + lsd->lsd_mount_count = cpu_to_le64(obd->u.obt.obt_mount_count); /* save it, so mount count and last_transno is current */ rc = filter_update_server_data(obd); @@ -2019,6 +2019,7 @@ int filter_common_setup(struct obd_device *obd, struct lustre_cfg* lcfg, obd->u.obt.obt_vfsmnt = mnt; obd->u.obt.obt_sb = mnt->mnt_sb; + obd->u.obt.obt_magic = OBT_MAGIC; filter->fo_fstype = mnt->mnt_sb->s_type->name; CDEBUG(D_SUPER, "%s: mnt = %p\n", filter->fo_fstype, mnt); diff --git a/lustre/obdfilter/lproc_obdfilter.c b/lustre/obdfilter/lproc_obdfilter.c index 01bc378..92effc9 100644 --- a/lustre/obdfilter/lproc_obdfilter.c +++ b/lustre/obdfilter/lproc_obdfilter.c @@ -82,18 +82,6 @@ static int lprocfs_filter_rd_tot_pending(char *page, char **start, off_t off, return snprintf(page, count, LPU64"\n", obd->u.filter.fo_tot_pending); } -static int lprocfs_filter_rd_mntdev(char *page, char **start, off_t off, - int count, int *eof, void *data) -{ - struct obd_device *obd = (struct obd_device *)data; - - LASSERT(obd != NULL); - LASSERT(obd->u.obt.obt_vfsmnt->mnt_devname); - *eof = 1; - return snprintf(page, count, "%s\n", - obd->u.obt.obt_vfsmnt->mnt_devname); -} - static int lprocfs_filter_rd_last_id(char *page, char **start, off_t off, int count, int *eof, void *data) { @@ -376,7 +364,7 @@ static struct lprocfs_vars lprocfs_filter_obd_vars[] = { { "filesfree", lprocfs_rd_filesfree, 0, 0 }, { "filegroups", lprocfs_filter_rd_groups, 0, 0 }, { "fstype", lprocfs_rd_fstype, 0, 0 }, - { "mntdev", lprocfs_filter_rd_mntdev, 0, 0 }, + { "mntdev", lprocfs_obd_rd_mntdev, 0, 0 }, { "last_id", lprocfs_filter_rd_last_id,0, 0 }, { "tot_dirty", lprocfs_filter_rd_tot_dirty, 0, 0 }, { "tot_pending", lprocfs_filter_rd_tot_pending, 0, 0 }, diff --git a/lustre/ptlrpc/target.c b/lustre/ptlrpc/target.c index a1961b0..245c9dc 100644 --- a/lustre/ptlrpc/target.c +++ b/lustre/ptlrpc/target.c @@ -248,7 +248,7 @@ static int lut_server_data_update(const struct lu_env *env, CDEBUG(D_SUPER, "%s: mount_count is "LPU64", last_transno is "LPU64"\n", - lut->lut_lsd.lsd_uuid, lut->lut_mount_count, + lut->lut_lsd.lsd_uuid, lut->lut_obd->u.obt.obt_mount_count, lut->lut_last_transno); cfs_spin_lock(&lut->lut_translock);