extern void lprocfs_free_stats(struct lprocfs_stats **stats);
extern void lprocfs_init_ops_stats(int num_private_stats,
struct lprocfs_stats *stats);
+extern void lprocfs_init_mps_stats(int num_private_stats,
+ struct lprocfs_stats *stats);
extern void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats);
extern int lprocfs_alloc_obd_stats(struct obd_device *obddev,
unsigned int num_private_stats);
static inline void lprocfs_init_ops_stats(int num_private_stats,
struct lprocfs_stats *stats)
{ return; }
+static inline void lprocfs_init_mps_stats(int num_private_stats,
+ struct lprocfs_stats *stats)
+{ return; }
static inline void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
{ return; }
static inline int lprocfs_alloc_obd_stats(struct obd_device *obddev,
#define EXP_MD_COUNTER_INCREMENT(exp, op)
#endif
-static inline int lprocfs_nid_ldlm_stats_init(struct nid_stat* tmp) {
+static inline int lprocfs_nid_ldlm_stats_init(struct nid_stat* tmp)
+{
/* Always add in ldlm_stats */
tmp->nid_ldlm_stats = lprocfs_alloc_stats(LDLM_LAST_OPC - LDLM_FIRST_OPC
,LPROCFS_STATS_FLAG_NOPERCPU);
{ 0 }
};
-struct lprocfs_vars lprocfs_mdt_module_vars[] = {
- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
- { 0 }
-};
-
-void mds_counter_incr(struct obd_export *exp, int opcode)
-{
- if (exp->exp_obd && exp->exp_obd->obd_stats)
- lprocfs_counter_incr(exp->exp_obd->obd_stats, opcode);
- if (exp->exp_nid_stats && exp->exp_nid_stats->nid_stats != NULL)
- lprocfs_counter_incr(exp->exp_nid_stats->nid_stats, opcode);
-
-}
-
-void mds_stats_counter_init(struct lprocfs_stats *stats)
-{
- lprocfs_counter_init(stats, LPROC_MDS_OPEN, 0, "open", "reqs");
- lprocfs_counter_init(stats, LPROC_MDS_CLOSE, 0, "close", "reqs");
- lprocfs_counter_init(stats, LPROC_MDS_MKNOD, 0, "mknod", "reqs");
- lprocfs_counter_init(stats, LPROC_MDS_LINK, 0, "link", "reqs");
- lprocfs_counter_init(stats, LPROC_MDS_UNLINK, 0, "unlink", "reqs");
- lprocfs_counter_init(stats, LPROC_MDS_MKDIR, 0, "mkdir", "reqs");
- lprocfs_counter_init(stats, LPROC_MDS_RMDIR, 0, "rmdir", "reqs");
- lprocfs_counter_init(stats, LPROC_MDS_RENAME, 0, "rename", "reqs");
- lprocfs_counter_init(stats, LPROC_MDS_GETXATTR, 0, "getxattr", "reqs");
- lprocfs_counter_init(stats, LPROC_MDS_SETXATTR, 0, "setxattr", "reqs");
-}
-
void lprocfs_mds_init_vars(struct lprocfs_static_vars *lvars)
{
lvars->module_vars = lprocfs_mds_module_vars;
lvars->obd_vars = lprocfs_mds_obd_vars;
}
-void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars)
-{
- lvars->module_vars = lprocfs_mdt_module_vars;
- lvars->obd_vars = lprocfs_mdt_obd_vars;
-}
#endif
extern struct lvfs_callback_ops mds_lvfs_ops;
/* mds/lproc_mds.c */
-enum {
- LPROC_MDS_OPEN = 0,
- LPROC_MDS_CLOSE,
- LPROC_MDS_MKNOD,
- LPROC_MDS_LINK,
- LPROC_MDS_UNLINK,
- LPROC_MDS_MKDIR,
- LPROC_MDS_RMDIR,
- LPROC_MDS_RENAME,
- LPROC_MDS_GETXATTR,
- LPROC_MDS_SETXATTR,
- LPROC_MDS_LAST,
-};
-void mds_counter_incr(struct obd_export *exp, int opcode);
-void mds_stats_counter_init(struct lprocfs_stats *stats);
void lprocfs_mds_init_vars(struct lprocfs_static_vars *lvars);
-void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars);
#endif /* _MDS_INTERNAL_H */
RETURN(rc);
}
if (newnid) {
- rc = lprocfs_nid_ldlm_stats_init(exp->exp_nid_stats);
+ struct nid_stat *tmp = exp->exp_nid_stats;
+ int num_stats;
+
+ num_stats = (sizeof(*obd->obd_type->typ_md_ops) / sizeof(void *)) +
+ LPROC_MDT_LAST;
+ tmp->nid_stats = lprocfs_alloc_stats(num_stats,
+ LPROCFS_STATS_FLAG_NOPERCPU);
+ if (tmp->nid_stats == NULL)
+ return -ENOMEM;
+ lprocfs_init_mps_stats(LPROC_MDT_LAST, tmp->nid_stats);
+ mdt_stats_counter_init(tmp->nid_stats);
+ rc = lprocfs_register_stats(tmp->nid_proc, "stats",
+ tmp->nid_stats);
+ if (rc)
+ GOTO(clean, rc);
+ rc = lprocfs_nid_ldlm_stats_init(tmp);
if (rc)
GOTO(clean, rc);
}
int mdt_hsm_copytool_send(struct obd_export *exp);
/* lprocfs stuff */
+enum {
+ LPROC_MDT_OPEN = 0,
+ LPROC_MDT_CLOSE,
+ LPROC_MDT_MKNOD,
+ LPROC_MDT_LINK,
+ LPROC_MDT_UNLINK,
+ LPROC_MDT_MKDIR,
+ LPROC_MDT_RMDIR,
+ LPROC_MDT_RENAME,
+ LPROC_MDT_GETXATTR,
+ LPROC_MDT_SETXATTR,
+ LPROC_MDT_LAST,
+};
+void mdt_counter_incr(struct obd_export *exp, int opcode);
+void mdt_stats_counter_init(struct lprocfs_stats *stats);
void lprocfs_mdt_init_vars(struct lprocfs_static_vars *lvars);
int mdt_procfs_init(struct mdt_device *mdt, const char *name);
int mdt_procfs_fini(struct mdt_device *mdt);
void mdt_time_start(const struct mdt_thread_info *info);
void mdt_time_end(const struct mdt_thread_info *info, int idx);
-enum {
- LPROC_MDT_NR
-};
-
/* Capability */
int mdt_ck_thread_start(struct mdt_device *mdt);
void mdt_ck_thread_stop(struct mdt_device *mdt);
#include "mdt_internal.h"
#include <lnet/lib-lnet.h>
+enum {
+ LPROC_MDT_NR
+};
static const char *mdt_proc_names[LPROC_MDT_NR] = {
};
lprocfs_add_simple(obd->obd_proc_exports_entry,
"clear", lprocfs_nid_stats_clear_read,
lprocfs_nid_stats_clear_write, obd, NULL);
- rc = lprocfs_alloc_md_stats(obd, LPROC_MDT_NR);
+ rc = lprocfs_alloc_md_stats(obd, LPROC_MDT_LAST);
RETURN(rc);
}
lvars->module_vars = lprocfs_mdt_module_vars;
lvars->obd_vars = lprocfs_mdt_obd_vars;
}
+
+void mdt_counter_incr(struct obd_export *exp, int opcode)
+{
+ if (exp->exp_obd && exp->exp_obd->obd_stats)
+ lprocfs_counter_incr(exp->exp_obd->obd_stats, opcode);
+ if (exp->exp_nid_stats && exp->exp_nid_stats->nid_stats != NULL)
+ lprocfs_counter_incr(exp->exp_nid_stats->nid_stats, opcode);
+
+}
+
+void mdt_stats_counter_init(struct lprocfs_stats *stats)
+{
+ lprocfs_counter_init(stats, LPROC_MDT_OPEN, 0, "open", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_CLOSE, 0, "close", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_MKNOD, 0, "mknod", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_LINK, 0, "link", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_UNLINK, 0, "unlink", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_MKDIR, 0, "mkdir", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_RMDIR, 0, "rmdir", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_RENAME, 0, "rename", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_GETXATTR, 0, "getxattr", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_SETXATTR, 0, "setxattr", "reqs");
+}
OBD_FAIL_TIMEOUT_ORSET(OBD_FAIL_MDS_PAUSE_OPEN, OBD_FAIL_ONCE,
(obd_timeout + 1) / 4);
+ mdt_counter_incr(req->rq_export, LPROC_MDT_OPEN);
repbody = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
ma->ma_lmm = req_capsule_server_get(info->mti_pill, &RMF_MDT_MD);
int rc, ret = 0;
ENTRY;
+ mdt_counter_incr(req->rq_export, LPROC_MDT_CLOSE);
/* Close may come with the Size-on-MDS update. Unpack it. */
rc = mdt_close_unpack(info);
if (rc)
static int mdt_reint_create(struct mdt_thread_info *info,
struct mdt_lock_handle *lhc)
{
- int rc;
+ struct ptlrpc_request *req = mdt_info_req(info);
+ int rc;
ENTRY;
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_CREATE))
switch (info->mti_attr.ma_attr.la_mode & S_IFMT) {
case S_IFDIR:{
/* Cross-ref case. */
+ /* TODO: we can add LPROC_MDT_CROSS for cross-ref stats */
if (info->mti_cross_ref) {
rc = mdt_md_mkobj(info);
- break;
+ } else {
+ LASSERT(info->mti_rr.rr_namelen > 0);
+ mdt_counter_incr(req->rq_export, LPROC_MDT_MKDIR);
+ rc = mdt_md_create(info);
}
+ break;
}
case S_IFREG:
case S_IFLNK:
case S_IFSOCK:{
/* Special file should stay on the same node as parent. */
LASSERT(info->mti_rr.rr_namelen > 0);
+ mdt_counter_incr(req->rq_export, LPROC_MDT_MKNOD);
rc = mdt_md_create(info);
break;
}
/*
* VBR: save parent version in reply and child version getting by its name.
- * Version of child is getting and checking during its lookup. If
+ * Version of child is getting and checking during its lookup. If
*/
static int mdt_reint_unlink(struct mdt_thread_info *info,
struct mdt_lock_handle *lhc)
if (rc == 0)
mdt_handle_last_unlink(info, mc, ma);
+ switch (ma->ma_attr.la_mode & S_IFMT) {
+ case S_IFDIR:
+ mdt_counter_incr(req->rq_export, LPROC_MDT_RMDIR);
+ break;
+ case S_IFREG:
+ case S_IFLNK:
+ case S_IFCHR:
+ case S_IFBLK:
+ case S_IFIFO:
+ case S_IFSOCK:
+ mdt_counter_incr(req->rq_export, LPROC_MDT_UNLINK);
+ break;
+ default:
+ CERROR("bad file type %o unlinking\n", ma->ma_attr.la_mode);
+ LBUG();
+ GOTO(out, rc = -EINVAL);
+ }
+
EXIT;
mdt_object_unlock_put(info, mc, child_lh, rc);
rc = mdo_link(info->mti_env, mdt_object_child(mp),
mdt_object_child(ms), lname, ma);
+ if (rc == 0)
+ mdt_counter_incr(req->rq_export, LPROC_MDT_LINK);
+
EXIT;
out_unlock_child:
mdt_object_unlock_put(info, ms, lhs, rc);
lname, ma);
/* handle last link of tgt object */
- if (rc == 0 && mnew)
- mdt_handle_last_unlink(info, mnew, ma);
+ if (rc == 0) {
+ mdt_counter_incr(req->rq_export, LPROC_MDT_RENAME);
+ if (mnew)
+ mdt_handle_last_unlink(info, mnew, ma);
+ }
EXIT;
out_unlock_new:
EXIT;
out:
if (rc >= 0) {
+ mdt_counter_incr(req->rq_export, LPROC_MDT_GETXATTR);
repbody->eadatasize = rc;
rc = 0;
}
rc = lustre_ext_acl_xattr_id2server(uc, med->med_idmap, header);
if (rc)
RETURN(rc);
-
+
rc = mo_xattr_get(info->mti_env, next, &LU_BUF_NULL, xattr_name);
if (rc == -ENODATA)
rc = 0;
CDEBUG(D_INFO, "valid bits: "LPX64"\n", valid);
rc = -EINVAL;
}
+ if (rc == 0)
+ mdt_counter_incr(req->rq_export, LPROC_MDT_SETXATTR);
+
EXIT;
out_unlock:
mdt_object_unlock_put(info, obj, lh, rc);
rc = 0;
RETURN(rc);
}
-
if (newnid) {
- rc = lprocfs_nid_ldlm_stats_init(exp->exp_nid_stats);
+ struct nid_stat *tmp = exp->exp_nid_stats;
+ int num_stats = 0;
+
+ num_stats = (sizeof(*obd->obd_type->typ_dt_ops) / sizeof(void *)) +
+ LPROC_MGS_LAST - 1;
+ tmp->nid_stats = lprocfs_alloc_stats(num_stats,
+ LPROCFS_STATS_FLAG_NOPERCPU);
+ if (tmp->nid_stats == NULL)
+ return -ENOMEM;
+ lprocfs_init_ops_stats(LPROC_MGS_LAST, tmp->nid_stats);
+ mgs_stats_counter_init(tmp->nid_stats);
+ rc = lprocfs_register_stats(tmp->nid_proc, "stats",
+ tmp->nid_stats);
+ if (rc)
+ GOTO(clean, rc);
+
+ rc = lprocfs_nid_ldlm_stats_init(tmp);
if (rc)
GOTO(clean, rc);
}
lprocfs_counter_init(stats, coffset, 0, #op, "reqs"); \
} while (0)
-int lprocfs_alloc_md_stats(struct obd_device *obd,
- unsigned num_private_stats)
+void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats)
{
- struct lprocfs_stats *stats;
- unsigned int num_stats;
- int rc, i;
-
- LASSERT(obd->md_stats == NULL);
- LASSERT(obd->obd_proc_entry != NULL);
- LASSERT(obd->md_cntr_base == 0);
-
- num_stats = 1 + MD_COUNTER_OFFSET(revalidate_lock) +
- num_private_stats;
- stats = lprocfs_alloc_stats(num_stats, 0);
- if (stats == NULL)
- return -ENOMEM;
-
LPROCFS_MD_OP_INIT(num_private_stats, stats, getstatus);
LPROCFS_MD_OP_INIT(num_private_stats, stats, change_cbdata);
LPROCFS_MD_OP_INIT(num_private_stats, stats, find_cbdata);
LPROCFS_MD_OP_INIT(num_private_stats, stats, get_remote_perm);
LPROCFS_MD_OP_INIT(num_private_stats, stats, intent_getattr_async);
LPROCFS_MD_OP_INIT(num_private_stats, stats, revalidate_lock);
+}
+
+int lprocfs_alloc_md_stats(struct obd_device *obd,
+ unsigned num_private_stats)
+{
+ struct lprocfs_stats *stats;
+ unsigned int num_stats;
+ int rc, i;
+
+ LASSERT(obd->md_stats == NULL);
+ LASSERT(obd->obd_proc_entry != NULL);
+ LASSERT(obd->md_cntr_base == 0);
+
+ num_stats = 1 + MD_COUNTER_OFFSET(revalidate_lock) +
+ num_private_stats;
+ stats = lprocfs_alloc_stats(num_stats, 0);
+ if (stats == NULL)
+ return -ENOMEM;
+
+ lprocfs_init_mps_stats(num_private_stats, stats);
for (i = num_private_stats; i < num_stats; i++) {
if (stats->ls_percpu[0]->lp_cntr[i].lc_name == NULL) {
EXPORT_SYMBOL(lprocfs_clear_stats);
EXPORT_SYMBOL(lprocfs_register_stats);
EXPORT_SYMBOL(lprocfs_init_ops_stats);
+EXPORT_SYMBOL(lprocfs_init_mps_stats);
EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
EXPORT_SYMBOL(lprocfs_alloc_obd_stats);
EXPORT_SYMBOL(lprocfs_alloc_md_stats);
int lu_time_init(struct lprocfs_stats **stats, cfs_proc_dir_entry_t *entry,
const char **names, int nr)
{
- return lu_time_named_init(stats, "stats", entry, names, nr);
+ return lu_time_named_init(stats, "lu_stats", entry, names, nr);
}
EXPORT_SYMBOL(lu_time_init);