The server side has a exports proc directory with several entries.
Upstreaming requires Lustre not to use the proc directory so
we can move the exports directory to debugfs. This is server side
so the root only issue should be limited. This step will make
more of the stats Netlink work much easier.
Change-Id: I73e38813f049cf563cdc7e277e4fadecd5a94e98
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57013
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
extern void lprocfs_free_per_client_stats(struct obd_device *obd);
#ifdef HAVE_SERVER_SUPPORT
extern ssize_t
-lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
- size_t count, loff_t *off);
+ldebugfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
+ size_t count, loff_t *off);
extern int lprocfs_nid_stats_clear_seq_show(struct seq_file *file, void *data);
#endif
extern int lprocfs_stats_register(struct proc_dir_entry *root, const char *name,
}
#ifdef HAVE_SERVER_SUPPORT
-static inline
-ssize_t lprocfs_nid_stats_seq_write(struct file *file,
- const char __user *buffer,
- size_t count, loff_t *off)
-{
- return 0;
-}
-
-static inline int lprocfs_nid_stats_clear_seq_show(struct seq_file *m,
- void *data)
-{
- return 0;
-}
-
static inline int lprocfs_exp_setup(struct obd_export *exp,
struct lnet_nid *peer_nid)
{
struct hlist_node nid_hash;
struct list_head nid_list;
struct obd_device *nid_obd;
- struct proc_dir_entry *nid_proc;
+ struct dentry *nid_debugfs;
struct lprocfs_stats *nid_stats;
struct lprocfs_stats *nid_ldlm_stats;
/* for obd_nid_stats_hash exp_nid_stats */
#define exp_filter_data u.eu_filter_data
#define exp_ec_data u.eu_ec_data
+static inline int lprocfs_nid_ldlm_stats_init(struct nid_stat *tmp)
+{
+ /* Always add in ldlm_stats */
+ tmp->nid_ldlm_stats =
+ lprocfs_stats_alloc(LDLM_LAST_OPC - LDLM_FIRST_OPC,
+ LPROCFS_STATS_FLAG_NOPERCPU);
+ if (!tmp->nid_ldlm_stats)
+ return -ENOMEM;
+
+ lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
+
+ debugfs_create_file("ldlm_stats", 0644, tmp->nid_debugfs,
+ tmp->nid_stats, &ldebugfs_stats_seq_fops);
+
+ return 0;
+}
+
static inline __u64 *exp_connect_flags_ptr(struct obd_export *exp)
{
return &exp->exp_connect_data.ocd_connect_flags;
struct dentry *obd_debugfs_entry;
struct dentry *obd_debugfs_gss_dir;
struct proc_dir_entry *obd_proc_entry;
- struct proc_dir_entry *obd_proc_exports_entry;
+ struct dentry *obd_debugfs_exports;
struct dentry *obd_svc_debugfs_entry;
- struct lprocfs_stats *obd_svc_stats;
+ struct lprocfs_stats *obd_svc_stats;
const struct attribute **obd_attrs;
struct lprocfs_vars *obd_vars;
struct ldebugfs_vars *obd_debugfs_vars;
} \
} while (0)
-
-static inline int lprocfs_nid_ldlm_stats_init(struct nid_stat* tmp)
-{
- /* Always add in ldlm_stats */
- tmp->nid_ldlm_stats =
- lprocfs_stats_alloc(LDLM_LAST_OPC - LDLM_FIRST_OPC,
- LPROCFS_STATS_FLAG_NOPERCPU);
- if (tmp->nid_ldlm_stats == NULL)
- return -ENOMEM;
-
- lprocfs_init_ldlm_stats(tmp->nid_ldlm_stats);
-
- return lprocfs_stats_register(tmp->nid_proc, "ldlm_stats",
- tmp->nid_ldlm_stats);
-}
-
static inline int exp_check_ops(struct obd_export *exp)
{
if (exp == NULL) {
#include <libcfs/linux/linux-fs.h>
#include "mdt_internal.h"
-static const struct proc_ops mdt_open_files_seq_fops = {
- PROC_OWNER(THIS_MODULE)
- .proc_open = lprocfs_mdt_open_files_seq_open,
- .proc_read = seq_read,
- .proc_lseek = seq_lseek,
- .proc_release = single_release,
+static const struct file_operations mdt_open_files_seq_fops = {
+ .owner = THIS_MODULE,
+ .open = ldebugfs_mdt_open_files_seq_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
};
/**
void *localdata)
{
struct lnet_nid *client_nid = localdata;
+ char param[MAX_OBD_NAME * 4];
struct nid_stat *stats;
int rc;
- ENTRY;
+ ENTRY;
rc = lprocfs_exp_setup(exp, client_nid);
if (rc != 0)
RETURN(rc == -EALREADY ? 0 : rc);
stats = exp->exp_nid_stats;
- stats->nid_stats = lprocfs_stats_alloc(LPROC_MDT_LAST,
+ scnprintf(param, sizeof(param), "mdt.%s.exports.%s.stats",
+ obd->obd_name, libcfs_nidstr(client_nid));
+ stats->nid_stats = ldebugfs_stats_alloc(LPROC_MDT_LAST, param,
+ stats->nid_debugfs,
LPROCFS_STATS_FLAG_NOPERCPU);
- if (stats->nid_stats == NULL)
+ if (!stats->nid_stats)
RETURN(-ENOMEM);
mdt_stats_counter_init(stats->nid_stats, 0, LPROCFS_CNTR_HISTOGRAM);
- rc = lprocfs_stats_register(stats->nid_proc, "stats", stats->nid_stats);
- if (rc != 0) {
- lprocfs_stats_free(&stats->nid_stats);
- GOTO(out, rc);
- }
-
rc = lprocfs_nid_ldlm_stats_init(stats);
if (rc != 0)
GOTO(out, rc);
- rc = lprocfs_seq_create(stats->nid_proc, "open_files",
- 0444, &mdt_open_files_seq_fops, stats);
- if (rc != 0) {
- CWARN("%s: error adding the open_files file: rc = %d\n",
- obd->obd_name, rc);
- GOTO(out, rc);
- }
+ debugfs_create_file("open_files", 0444, stats->nid_debugfs, stats,
+ &mdt_open_files_seq_fops);
out:
RETURN(rc);
}
void mdt_tunables_fini(struct mdt_device *mdt);
/* lustre/mdt_mdt_lproc.c */
-int lprocfs_mdt_open_files_seq_open(struct inode *inode,
- struct file *file);
+int ldebugfs_mdt_open_files_seq_open(struct inode *inode,
+ struct file *file);
void mdt_rename_counter_tally(struct mdt_thread_info *info,
struct mdt_device *mdt,
struct ptlrpc_request *req,
LPROC_SEQ_FOPS_RO_TYPE(mdt, hash);
LPROC_SEQ_FOPS_WR_ONLY(mdt, mds_evict_client);
LPROC_SEQ_FOPS_RW_TYPE(mdt, checksum_dump);
+LPROC_SEQ_FOPS_RO_TYPE(mdt, recovery_status);
+/* belongs to export directory */
+LDEBUGFS_SEQ_FOPS_RW_TYPE(mdt, nid_stats_clear);
+
LUSTRE_RW_ATTR(job_cleanup_interval);
LUSTRE_RW_ATTR(job_xattr);
-LPROC_SEQ_FOPS_RW_TYPE(mdt, nid_stats_clear);
LUSTRE_RW_ATTR(hsm_control);
-LPROC_SEQ_FOPS_RO_TYPE(mdt, recovery_status);
LUSTRE_RW_ATTR(recovery_time_hard);
LUSTRE_RW_ATTR(recovery_time_soft);
LUSTRE_RW_ATTR(ir_factor);
};
static int
-lprocfs_mdt_print_open_files(struct obd_export *exp, void *v)
+ldebugfs_mdt_print_open_files(struct obd_export *exp, void *v)
{
struct seq_file *seq = v;
return 0;
}
-static int lprocfs_mdt_open_files_seq_show(struct seq_file *seq, void *v)
+static int ldebugfs_mdt_open_files_seq_show(struct seq_file *seq, void *v)
{
struct nid_stat *stats = seq->private;
return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
- lprocfs_mdt_print_open_files, seq);
+ ldebugfs_mdt_print_open_files, seq);
}
-int lprocfs_mdt_open_files_seq_open(struct inode *inode, struct file *file)
+int ldebugfs_mdt_open_files_seq_open(struct inode *inode, struct file *file)
{
struct seq_file *seq;
int rc;
- rc = single_open(file, &lprocfs_mdt_open_files_seq_show, NULL);
+ rc = single_open(file, &ldebugfs_mdt_open_files_seq_show, NULL);
if (rc != 0)
return rc;
seq = file->private_data;
- seq->private = pde_data(inode);
+ seq->private = inode->i_private;
return 0;
}
obd->obd_debugfs_gss_dir = debugfs_create_dir("gss",
obd->obd_debugfs_entry);
- if (obd->obd_debugfs_gss_dir)
- ldebugfs_add_vars(obd->obd_debugfs_gss_dir,
- ldebugfs_mdt_gss_vars, obd);
+ if (IS_ERR(obd->obd_debugfs_gss_dir))
+ obd->obd_debugfs_gss_dir = NULL;
+
+ ldebugfs_add_vars(obd->obd_debugfs_gss_dir,
+ ldebugfs_mdt_gss_vars, obd);
+
+ obd->obd_debugfs_exports = debugfs_create_dir("exports",
+ obd->obd_debugfs_entry);
+ if (IS_ERR(obd->obd_debugfs_exports))
+ obd->obd_debugfs_exports = NULL;
- obd->obd_proc_exports_entry = proc_mkdir("exports",
- obd->obd_proc_entry);
- if (obd->obd_proc_exports_entry)
- lprocfs_add_simple(obd->obd_proc_exports_entry, "clear",
- obd, &mdt_nid_stats_clear_fops);
+ debugfs_create_file("clear", 0644, obd->obd_debugfs_exports,
+ obd, &mdt_nid_stats_clear_fops);
rc = lprocfs_alloc_md_stats(obd, ARRAY_SIZE(mdt_stats));
if (rc)
{
struct obd_device *obd = mdt2obd_dev(mdt);
- if (obd->obd_proc_exports_entry != NULL) {
- lprocfs_remove_proc_entry("clear", obd->obd_proc_exports_entry);
- obd->obd_proc_exports_entry = NULL;
- }
-
lprocfs_free_per_client_stats(obd);
/* hsm_cdt_tunables is disabled earlier than this to avoid
* coordinator restart.
LPROC_SEQ_FOPS_RO_TYPE(mgs, hash);
LPROC_SEQ_FOPS_WR_ONLY(mgs, evict_client);
LPROC_SEQ_FOPS_RW_TYPE(mgs, ir_timeout);
-LPROC_SEQ_FOPS_RW_TYPE(mgs, nid_stats_clear);
+/* belongs to export directory */
+LDEBUGFS_SEQ_FOPS_RW_TYPE(mgs, nid_stats_clear);
static struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
{ .name = "hash_stats",
obd->obd_debugfs_gss_dir = debugfs_create_dir("gss",
obd->obd_debugfs_entry);
- if (obd->obd_debugfs_gss_dir)
- ldebugfs_add_vars(obd->obd_debugfs_gss_dir,
- ldebugfs_ofd_gss_vars, obd);
-
- obd->obd_proc_exports_entry = lprocfs_register("exports",
- obd->obd_proc_entry,
- NULL, NULL);
- if (IS_ERR(obd->obd_proc_exports_entry)) {
- rc = PTR_ERR(obd->obd_proc_exports_entry);
- obd->obd_proc_exports_entry = NULL;
- GOTO(out, rc);
- }
- if (obd->obd_proc_exports_entry)
- lprocfs_add_simple(obd->obd_proc_exports_entry, "clear",
- obd, &mgs_nid_stats_clear_fops);
+ if (IS_ERR(obd->obd_debugfs_gss_dir))
+ obd->obd_debugfs_gss_dir = NULL;
+
+ ldebugfs_add_vars(obd->obd_debugfs_gss_dir,
+ ldebugfs_ofd_gss_vars, obd);
+
+ obd->obd_debugfs_exports = debugfs_create_dir("exports",
+ obd->obd_debugfs_entry);
+ if (IS_ERR(obd->obd_debugfs_exports))
+ obd->obd_debugfs_exports = NULL;
+
+ debugfs_create_file("clear", 0644, obd->obd_debugfs_exports,
+ obd, &mgs_nid_stats_clear_fops);
rc = sysfs_create_link(&obd->obd_kset.kobj, &mgs->mgs_bottom->dd_kobj,
"osd");
void *localdata)
{
struct lnet_nid *client_nid = localdata;
+ char param[MAX_OBD_NAME * 4];
struct nid_stat *stats;
int rc;
ENTRY;
-
rc = lprocfs_exp_setup(exp, client_nid);
if (rc != 0)
- /* Mask error for already created /proc entries */
+ /* Mask error for already created /sysfs entries */
RETURN(rc == -EALREADY ? 0 : rc);
stats = exp->exp_nid_stats;
- stats->nid_stats = lprocfs_stats_alloc(LPROC_MGS_LAST,
- LPROCFS_STATS_FLAG_NOPERCPU);
- if (stats->nid_stats == NULL)
+ scnprintf(param, sizeof(param), "mgs.MGS.exports.%s.stats",
+ libcfs_nidstr(client_nid));
+ stats->nid_stats = ldebugfs_stats_alloc(LPROC_MGS_LAST, param,
+ stats->nid_debugfs,
+ LPROCFS_STATS_FLAG_NOPERCPU);
+ if (!stats->nid_stats)
RETURN(-ENOMEM);
mgs_stats_counter_init(stats->nid_stats);
- rc = lprocfs_stats_register(stats->nid_proc, "stats", stats->nid_stats);
- if (rc != 0) {
- lprocfs_stats_free(&stats->nid_stats);
- GOTO(out, rc);
- }
-
rc = lprocfs_nid_ldlm_stats_init(stats);
- if (rc != 0)
- GOTO(out, rc);
-
-out:
RETURN(rc);
}
debugfs_remove_recursive(obd->obd_debugfs_gss_dir);
obd->obd_debugfs_gss_dir = NULL;
-
- if (obd->obd_proc_exports_entry) {
- /* Should be no exports left */
- lprocfs_remove(&obd->obd_proc_exports_entry);
- obd->obd_proc_exports_entry = NULL;
- }
-
+#ifdef HAVE_SERVER_SUPPORT
+ /* Should be no exports left */
+ debugfs_remove_recursive(obd->obd_debugfs_exports);
+ obd->obd_debugfs_exports = NULL;
+#endif
if (obd->obd_proc_entry) {
lprocfs_remove(&obd->obd_proc_entry);
obd->obd_proc_entry = NULL;
}
EXPORT_SYMBOL(lprocfs_free_md_stats);
-void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
-{
- lprocfs_counter_init(ldlm_stats, LDLM_ENQUEUE - LDLM_FIRST_OPC,
- LPROCFS_TYPE_REQS, "ldlm_enqueue");
- lprocfs_counter_init(ldlm_stats, LDLM_CONVERT - LDLM_FIRST_OPC,
- LPROCFS_TYPE_REQS, "ldlm_convert");
- lprocfs_counter_init(ldlm_stats, LDLM_CANCEL - LDLM_FIRST_OPC,
- LPROCFS_TYPE_REQS, "ldlm_cancel");
- lprocfs_counter_init(ldlm_stats, LDLM_BL_CALLBACK - LDLM_FIRST_OPC,
- LPROCFS_TYPE_REQS, "ldlm_bl_callback");
- lprocfs_counter_init(ldlm_stats, LDLM_CP_CALLBACK - LDLM_FIRST_OPC,
- LPROCFS_TYPE_REQS, "ldlm_cp_callback");
- lprocfs_counter_init(ldlm_stats, LDLM_GL_CALLBACK - LDLM_FIRST_OPC,
- LPROCFS_TYPE_REQS, "ldlm_gl_callback");
-}
-EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
-
__s64 lprocfs_read_helper(struct lprocfs_counter *lc,
struct lprocfs_counter_header *header,
enum lprocfs_stats_flags flags,
return 0;
}
+void lprocfs_init_ldlm_stats(struct lprocfs_stats *ldlm_stats)
+{
+ lprocfs_counter_init(ldlm_stats, LDLM_ENQUEUE - LDLM_FIRST_OPC,
+ LPROCFS_TYPE_REQS, "ldlm_enqueue");
+ lprocfs_counter_init(ldlm_stats, LDLM_CONVERT - LDLM_FIRST_OPC,
+ LPROCFS_TYPE_REQS, "ldlm_convert");
+ lprocfs_counter_init(ldlm_stats, LDLM_CANCEL - LDLM_FIRST_OPC,
+ LPROCFS_TYPE_REQS, "ldlm_cancel");
+ lprocfs_counter_init(ldlm_stats, LDLM_BL_CALLBACK - LDLM_FIRST_OPC,
+ LPROCFS_TYPE_REQS, "ldlm_bl_callback");
+ lprocfs_counter_init(ldlm_stats, LDLM_CP_CALLBACK - LDLM_FIRST_OPC,
+ LPROCFS_TYPE_REQS, "ldlm_cp_callback");
+ lprocfs_counter_init(ldlm_stats, LDLM_GL_CALLBACK - LDLM_FIRST_OPC,
+ LPROCFS_TYPE_REQS, "ldlm_gl_callback");
+}
+EXPORT_SYMBOL(lprocfs_init_ldlm_stats);
+
static int
-lprocfs_exp_print_export_seq(struct obd_export *exp, void *cb_data)
+ldebugfs_exp_print_export_seq(struct obd_export *exp, void *cb_data)
{
struct seq_file *m = cb_data;
struct obd_device *obd;
/**
* RPC connections are composed of an import and an export. Using the
* lctl utility we can extract important information about the state.
- * The lprocfs_exp_export_seq_show routine displays the state information
+ * The ldebugfs_exp_export_seq_show routine displays the state information
* for the export.
*
* \param[in] m seq file
* export_flags: [ ... ]
*
*/
-static int lprocfs_exp_export_seq_show(struct seq_file *m, void *data)
+static int ldebugfs_exp_export_seq_show(struct seq_file *m, void *data)
{
struct nid_stat *stats = m->private;
return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
- lprocfs_exp_print_export_seq, m);
+ ldebugfs_exp_print_export_seq, m);
}
-LPROC_SEQ_FOPS_RO(lprocfs_exp_export);
+LDEBUGFS_SEQ_FOPS_RO(ldebugfs_exp_export);
static void lprocfs_free_client_stats(struct nid_stat *client_stat)
{
CDEBUG(D_CONFIG, "stat %p - data %p/%p\n", client_stat,
- client_stat->nid_proc, client_stat->nid_stats);
+ client_stat->nid_debugfs, client_stat->nid_stats);
LASSERTF(atomic_read(&client_stat->nid_exp_ref_count) == 0,
"nid %s:count %d\n", libcfs_nidstr(&client_stat->nid),
atomic_read(&client_stat->nid_exp_ref_count));
- if (client_stat->nid_proc)
- lprocfs_remove(&client_stat->nid_proc);
+ debugfs_remove_recursive(client_stat->nid_debugfs);
if (client_stat->nid_stats)
lprocfs_stats_free(&client_stat->nid_stats);
EXPORT_SYMBOL(lprocfs_free_per_client_stats);
static int
-lprocfs_exp_print_nodemap_seq(struct obd_export *exp, void *cb_data)
+ldebugfs_exp_print_nodemap_seq(struct obd_export *exp, void *cb_data)
{
struct lu_nodemap *nodemap = exp->exp_target_data.ted_nodemap;
struct seq_file *m = cb_data;
}
static int
-lprocfs_exp_nodemap_seq_show(struct seq_file *m, void *data)
+ldebugfs_exp_nodemap_seq_show(struct seq_file *m, void *data)
{
struct nid_stat *stats = m->private;
return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
- lprocfs_exp_print_nodemap_seq, m);
+ ldebugfs_exp_print_nodemap_seq, m);
}
-LPROC_SEQ_FOPS_RO(lprocfs_exp_nodemap);
+LDEBUGFS_SEQ_FOPS_RO(ldebugfs_exp_nodemap);
static int
-lprocfs_exp_print_uuid_seq(struct obd_export *exp, void *cb_data)
+ldebugfs_exp_print_uuid_seq(struct obd_export *exp, void *cb_data)
{
struct seq_file *m = cb_data;
return 0;
}
-static int lprocfs_exp_uuid_seq_show(struct seq_file *m, void *data)
+static int ldebugfs_exp_uuid_seq_show(struct seq_file *m, void *data)
{
struct nid_stat *stats = m->private;
return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
- lprocfs_exp_print_uuid_seq, m);
+ ldebugfs_exp_print_uuid_seq, m);
}
-LPROC_SEQ_FOPS_RO(lprocfs_exp_uuid);
+LDEBUGFS_SEQ_FOPS_RO(ldebugfs_exp_uuid);
#define HASH_NAME_LEN 16
}
static int
-lprocfs_exp_print_hash_seq(struct obd_export *exp, void *cb_data)
-
+ldebugfs_exp_print_hash_seq(struct obd_export *exp, void *cb_data)
{
struct obd_device *obd = exp->exp_obd;
struct seq_file *m = cb_data;
return 0;
}
-static int lprocfs_exp_hash_seq_show(struct seq_file *m, void *data)
+static int ldebugfs_exp_hash_seq_show(struct seq_file *m, void *data)
{
struct nid_stat *stats = m->private;
return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
- lprocfs_exp_print_hash_seq, m);
+ ldebugfs_exp_print_hash_seq, m);
}
-LPROC_SEQ_FOPS_RO(lprocfs_exp_hash);
+LDEBUGFS_SEQ_FOPS_RO(ldebugfs_exp_hash);
-static int lprocfs_exp_print_replydata_seq(struct obd_export *exp,
- void *cb_data)
+static int ldebugfs_exp_print_replydata_seq(struct obd_export *exp,
+ void *cb_data)
{
struct seq_file *m = cb_data;
return 0;
}
-static int lprocfs_exp_replydata_seq_show(struct seq_file *m, void *data)
+static int ldebugfs_exp_replydata_seq_show(struct seq_file *m, void *data)
{
struct nid_stat *stats = m->private;
return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
- lprocfs_exp_print_replydata_seq, m);
+ ldebugfs_exp_print_replydata_seq, m);
}
-LPROC_SEQ_FOPS_RO(lprocfs_exp_replydata);
+LDEBUGFS_SEQ_FOPS_RO(ldebugfs_exp_replydata);
-static int lprocfs_exp_print_fmd_count_seq(struct obd_export *exp,
- void *cb_data)
+static int ldebugfs_exp_print_fmd_count_seq(struct obd_export *exp,
+ void *cb_data)
{
struct seq_file *m = cb_data;
struct tg_export_data *ted = &exp->exp_target_data;
return 0;
}
-static int lprocfs_exp_fmd_count_seq_show(struct seq_file *m, void *data)
+static int ldebugfs_exp_fmd_count_seq_show(struct seq_file *m, void *data)
{
struct nid_stat *stats = m->private;
return obd_nid_export_for_each(stats->nid_obd, &stats->nid,
- lprocfs_exp_print_fmd_count_seq, m);
+ ldebugfs_exp_print_fmd_count_seq, m);
}
-LPROC_SEQ_FOPS_RO(lprocfs_exp_fmd_count);
+LDEBUGFS_SEQ_FOPS_RO(ldebugfs_exp_fmd_count);
int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
{
}
EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_show);
-static int lprocfs_nid_stats_clear_write_cb(void *obj, void *data)
+static int ldebugfs_nid_stats_clear_write_cb(void *obj, void *data)
{
struct nid_stat *stat = obj;
ENTRY;
}
ssize_t
-lprocfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
- size_t count, loff_t *off)
+ldebugfs_nid_stats_clear_seq_write(struct file *file, const char __user *buffer,
+ size_t count, loff_t *off)
{
struct seq_file *m = file->private_data;
struct obd_device *obd = m->private;
LIST_HEAD(free_list);
cfs_hash_cond_del(obd->obd_nid_stats_hash,
- lprocfs_nid_stats_clear_write_cb, &free_list);
+ ldebugfs_nid_stats_clear_write_cb, &free_list);
while (!list_empty(&free_list)) {
client_stat = list_first_entry(&free_list, struct nid_stat,
}
return count;
}
-EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_write);
+EXPORT_SYMBOL(ldebugfs_nid_stats_clear_seq_write);
+
+struct ldebugfs_vars ldebugfs_obd_exports_vars[] = {
+ { .name = "nodemap",
+ .fops = &ldebugfs_exp_nodemap_fops },
+ { .name = "uuid",
+ .fops = &ldebugfs_exp_uuid_fops },
+ { .name = "hash",
+ .fops = &ldebugfs_exp_hash_fops },
+ { .name = "export",
+ .fops = &ldebugfs_exp_export_fops },
+ { .name = "reply_data",
+ .fops = &ldebugfs_exp_replydata_fops },
+ { .name = "fmd_count",
+ .fops = &ldebugfs_exp_fmd_count_fops },
+ { NULL }
+};
int lprocfs_exp_setup(struct obd_export *exp, struct lnet_nid *nid)
{
struct nid_stat *new_stat, *old_stat;
struct obd_device *obd = NULL;
- struct proc_dir_entry *entry;
char nidstr[LNET_NIDSTR_SIZE];
int rc = 0;
- ENTRY;
- if (!exp || !exp->exp_obd || !exp->exp_obd->obd_proc_exports_entry ||
+ ENTRY;
+ if (!exp || !exp->exp_obd || !exp->exp_obd->obd_debugfs_exports ||
!exp->exp_obd->obd_nid_stats_hash)
RETURN(-EINVAL);
/* not test against zero because eric say:
* You may only test nid against another nid, or LNET_NID_ANY.
* Anything else is nonsense.*/
- if (nid == NULL || LNET_NID_IS_ANY(nid))
+ if (LNET_NID_IS_ANY(nid))
RETURN(-EALREADY);
libcfs_nidstr_r(nid, nidstr, sizeof(nidstr));
spin_unlock(&exp->exp_lock);
GOTO(destroy_new, rc = -EALREADY);
}
- /* not found - create */
- new_stat->nid_proc = lprocfs_register(nidstr,
- obd->obd_proc_exports_entry,
- NULL, NULL);
-
- if (IS_ERR(new_stat->nid_proc)) {
- rc = PTR_ERR(new_stat->nid_proc);
- new_stat->nid_proc = NULL;
- CERROR("%s: cannot create proc entry for export %s: rc = %d\n",
- obd->obd_name, nidstr, rc);
- GOTO(destroy_new_ns, rc);
- }
-
- entry = lprocfs_add_simple(new_stat->nid_proc, "nodemap", new_stat,
- &lprocfs_exp_nodemap_fops);
- if (IS_ERR(entry)) {
- rc = PTR_ERR(entry);
- CWARN("%s: error adding the nodemap file: rc = %d\n",
- obd->obd_name, rc);
- GOTO(destroy_new_ns, rc);
- }
- entry = lprocfs_add_simple(new_stat->nid_proc, "uuid", new_stat,
- &lprocfs_exp_uuid_fops);
- if (IS_ERR(entry)) {
- rc = PTR_ERR(entry);
- CWARN("%s: error adding the NID stats file: rc = %d\n",
- obd->obd_name, rc);
- GOTO(destroy_new_ns, rc);
- }
-
- entry = lprocfs_add_simple(new_stat->nid_proc, "hash", new_stat,
- &lprocfs_exp_hash_fops);
- if (IS_ERR(entry)) {
- rc = PTR_ERR(entry);
- CWARN("%s: error adding the hash file: rc = %d\n",
- obd->obd_name, rc);
- GOTO(destroy_new_ns, rc);
- }
-
- entry = lprocfs_add_simple(new_stat->nid_proc, "export",
- new_stat, &lprocfs_exp_export_fops);
- if (IS_ERR(entry)) {
- rc = PTR_ERR(entry);
- CWARN("%s: error adding the export file: rc = %d\n",
- obd->obd_name, rc);
- GOTO(destroy_new_ns, rc);
- }
+ /* not found - create */
+ new_stat->nid_debugfs = debugfs_create_dir(nidstr,
+ obd->obd_debugfs_exports);
+ if (IS_ERR(new_stat->nid_debugfs))
+ new_stat->nid_debugfs = NULL;
- entry = lprocfs_add_simple(new_stat->nid_proc, "reply_data", new_stat,
- &lprocfs_exp_replydata_fops);
- if (IS_ERR(entry)) {
- rc = PTR_ERR(entry);
- CWARN("%s: error adding the reply_data file: rc = %d\n",
- obd->obd_name, rc);
- GOTO(destroy_new_ns, rc);
- }
-
- entry = lprocfs_add_simple(new_stat->nid_proc, "fmd_count", new_stat,
- &lprocfs_exp_fmd_count_fops);
- if (IS_ERR(entry)) {
- rc = PTR_ERR(entry);
- CWARN("%s: error adding the fmd_count file: rc = %d\n",
- obd->obd_name, rc);
- GOTO(destroy_new_ns, rc);
- }
+ ldebugfs_add_vars(new_stat->nid_debugfs,
+ ldebugfs_obd_exports_vars, new_stat);
spin_lock(&exp->exp_lock);
exp->exp_nid_stats = new_stat;
RETURN(0);
-destroy_new_ns:
- if (new_stat->nid_proc != NULL)
- lprocfs_remove(&new_stat->nid_proc);
- cfs_hash_del(obd->obd_nid_stats_hash, &new_stat->nid,
- &new_stat->nid_hash);
-
destroy_new:
nidstat_putref(new_stat);
OBD_FREE_PTR(new_stat);
LPROCFS_TYPE_LATENCY & (~cntr_umask), "prealloc");
}
-LPROC_SEQ_FOPS(lprocfs_nid_stats_clear);
+/* belongs to export directory */
+LDEBUGFS_SEQ_FOPS_RW_TYPE(ofd, nid_stats_clear);
LUSTRE_OBD_UINT_PARAM_ATTR(at_min);
LUSTRE_OBD_UINT_PARAM_ATTR(at_max);
int ofd_tunables_init(struct ofd_device *ofd)
{
struct obd_device *obd = ofd_obd(ofd);
- struct proc_dir_entry *entry;
int rc = 0;
ENTRY;
obd->obd_debugfs_gss_dir = debugfs_create_dir("gss",
obd->obd_debugfs_entry);
- if (obd->obd_debugfs_gss_dir)
- ldebugfs_add_vars(obd->obd_debugfs_gss_dir,
- ldebugfs_ofd_gss_vars, obd);
-
- entry = lprocfs_register("exports", obd->obd_proc_entry, NULL, NULL);
- if (IS_ERR(entry)) {
- rc = PTR_ERR(entry);
- CERROR("%s: error %d setting up lprocfs for %s\n",
- obd->obd_name, rc, "exports");
- GOTO(obd_free_stats, rc);
- }
- obd->obd_proc_exports_entry = entry;
+ if (IS_ERR(obd->obd_debugfs_gss_dir))
+ obd->obd_debugfs_gss_dir = NULL;
- entry = lprocfs_add_simple(obd->obd_proc_exports_entry, "clear",
- obd, &lprocfs_nid_stats_clear_fops);
- if (IS_ERR(entry)) {
- rc = PTR_ERR(entry);
- CERROR("%s: add proc entry 'clear' failed: %d.\n",
- obd->obd_name, rc);
- GOTO(obd_free_stats, rc);
- }
+ ldebugfs_add_vars(obd->obd_debugfs_gss_dir,
+ ldebugfs_ofd_gss_vars, obd);
+
+ obd->obd_debugfs_exports = debugfs_create_dir("exports",
+ obd->obd_debugfs_entry);
+ if (IS_ERR(obd->obd_debugfs_exports))
+ obd->obd_debugfs_exports = NULL;
+
+ debugfs_create_file("clear", 0644, obd->obd_debugfs_exports,
+ obd, &ofd_nid_stats_clear_fops);
ofd_stats_counter_init(obd->obd_stats, 0, LPROCFS_CNTR_HISTOGRAM);
struct obd_export *exp,
struct lnet_nid *client_nid)
{
- struct obd_device *obd = ofd_obd(ofd);
- struct nid_stat *stats;
- int rc;
+ struct obd_device *obd = ofd_obd(ofd);
+ char param[MAX_OBD_NAME * 4];
+ struct nid_stat *stats;
+ int rc;
ENTRY;
-
if (obd_uuid_equals(&exp->exp_client_uuid, &obd->obd_uuid))
/* Self-export gets no proc entry */
RETURN(0);
RETURN(rc == -EALREADY ? 0 : rc);
stats = exp->exp_nid_stats;
- stats->nid_stats = lprocfs_stats_alloc(LPROC_OFD_STATS_LAST,
- LPROCFS_STATS_FLAG_NOPERCPU);
+ scnprintf(param, sizeof(param), "obdfilter.%s.exports.%s.stats",
+ obd->obd_name, libcfs_nidstr(client_nid));
+ stats->nid_stats = ldebugfs_stats_alloc(LPROC_OFD_STATS_LAST, param,
+ stats->nid_debugfs,
+ LPROCFS_STATS_FLAG_NOPERCPU);
if (!stats->nid_stats)
RETURN(-ENOMEM);
ofd_stats_counter_init(stats->nid_stats, 0, LPROCFS_CNTR_HISTOGRAM);
- rc = lprocfs_stats_register(stats->nid_proc, "stats", stats->nid_stats);
- if (rc != 0) {
- lprocfs_stats_free(&stats->nid_stats);
- GOTO(out, rc);
- }
-
rc = lprocfs_nid_ldlm_stats_init(stats);
- if (rc != 0)
- GOTO(out, rc);
-
-out:
RETURN(rc);
}