i=adilger,zam
Use single place for mount count, unify mntdev getting, introduce
obt_magic to make sure obt is correct.
13 files changed:
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 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);
/* all quota proc functions */
extern int lprocfs_quota_rd_bunit(char *page, char **start, off_t off, int count,
int *eof, void *data);
cfs_spinlock_t lut_client_bitmap_lock;
/** Bitmap of known clients */
unsigned long *lut_client_bitmap;
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,
};
typedef void (*lut_cb_t)(struct lu_target *lut, __u64 transno,
{
struct obd_device *obd = ctxt->loc_exp->exp_obd;
{
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++;
}
ctxt->loc_gen.mnt_cnt = obd->u.obt.obt_mount_count;
ctxt->loc_gen.conn_cnt++;
}
+#define OBT_MAGIC 0xBDDECEAE
/* hold common fields for "target" device */
struct obd_device_target {
/* hold common fields for "target" device */
struct obd_device_target {
struct super_block *obt_sb;
/** last_rcvd file */
struct file *obt_rcvd_filp;
struct super_block *obt_sb;
/** last_rcvd file */
struct file *obt_rcvd_filp;
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;
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);
fsfilt_setup(obd, obd->u.obt.obt_sb);
OBD_SET_CTXT_MAGIC(&obd->obd_lvfs_ctxt);
#include "mds_internal.h"
#ifdef LPROCFS
#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)
{
static int lprocfs_mds_rd_evictostnids(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
{ "filestotal", lprocfs_rd_filestotal, 0, 0 },
{ "filesfree", lprocfs_rd_filesfree, 0, 0 },
{ "fstype", lprocfs_rd_fstype, 0, 0 },
{ "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 },
{ "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 },
m->mdt_max_mdsize, m->mdt_max_cookiesize);
mdt_allow_cli(m, CONFIG_SYNC);
if (data)
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);
break;
case MD_NO_TRANS:
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
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_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;
ma->ma_attr.la_valid &= LA_ATIME | LA_MTIME | LA_CTIME;
} else {
ma->ma_som->msd_ioepoch = IOEPOCH_INVAL;
obd->obd_last_committed = mdt->mdt_lut.lut_last_transno;
cfs_spin_unlock(&mdt->mdt_lut.lut_translock);
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);
/* save it, so mount count and last_transno is current */
rc = mdt_server_data_update(env, mdt);
RETURN(PTR_ERR(th));
CDEBUG(D_SUPER, "MDS mount_count is "LPU64", last_transno is "LPU64"\n",
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;
cfs_spin_lock(&mdt->mdt_lut.lut_translock);
mdt->mdt_lut.lut_lsd.lsd_last_transno = mdt->mdt_lut.lut_last_transno;
}
EXPORT_SYMBOL(lprocfs_obd_wr_recovery_time_hard);
}
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);
EXPORT_SYMBOL(lprocfs_register);
EXPORT_SYMBOL(lprocfs_srch);
EXPORT_SYMBOL(lprocfs_remove);
obd->obd_last_committed = le64_to_cpu(lsd->lsd_last_transno);
out:
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);
/* save it, so mount count and last_transno is current */
rc = filter_update_server_data(obd);
obd->u.obt.obt_vfsmnt = mnt;
obd->u.obt.obt_sb = mnt->mnt_sb;
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);
filter->fo_fstype = mnt->mnt_sb->s_type->name;
CDEBUG(D_SUPER, "%s: mnt = %p\n", filter->fo_fstype, mnt);
return snprintf(page, count, LPU64"\n", obd->u.filter.fo_tot_pending);
}
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)
{
static int lprocfs_filter_rd_last_id(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
{ "filesfree", lprocfs_rd_filesfree, 0, 0 },
{ "filegroups", lprocfs_filter_rd_groups, 0, 0 },
{ "fstype", lprocfs_rd_fstype, 0, 0 },
{ "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 },
{ "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 },
CDEBUG(D_SUPER,
"%s: mount_count is "LPU64", last_transno is "LPU64"\n",
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);
lut->lut_last_transno);
cfs_spin_lock(&lut->lut_translock);