diff --git a/lustre/mds/handler.c b/lustre/mds/handler.c index 3a9919435f3be4688c16803adb9aa724acf546d6..05ea7a633ec528934de09ab789a9d884bacd6dae 100644 --- a/lustre/mds/handler.c +++ b/lustre/mds/handler.c @@ -1936,6 +1936,15 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) } ldlm_register_intent(obd->obd_namespace, mds_intent_policy); + lprocfs_init_vars(mds, &lvars); + if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 && + lprocfs_alloc_obd_stats(obd, LPROC_MDS_LAST) == 0) { + /* Init private stats here */ + mds_stats_counter_init(obd->obd_stats); + obd->obd_proc_exports = proc_mkdir("exports", + obd->obd_proc_entry); + } + rc = mds_fs_setup(obd, mnt); if (rc) { CERROR("%s: MDS filesystem method init failed: rc = %d\n", @@ -1986,15 +1995,6 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf) if (rc) GOTO(err_qctxt, rc); - lprocfs_init_vars(mds, &lvars); - if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 && - lprocfs_alloc_obd_stats(obd, LPROC_MDS_LAST) == 0) { - /* Init private stats here */ - mds_stats_counter_init(obd->obd_stats); - obd->obd_proc_exports = proc_mkdir("exports", - obd->obd_proc_entry); - } - uuid_ptr = fsfilt_uuid(obd, obd->u.obt.obt_sb); if (uuid_ptr != NULL) { class_uuid_unparse(uuid_ptr, &uuid); diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index eaacf9d23be9df36957e425901ea23fea70b5650..38b80ad62c6b0c0a51facdb51b4a146d26d6cee2 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -1775,13 +1775,10 @@ static int filter_setup(struct obd_device *obd, obd_count len, void *buf) if (!page) RETURN(-ENOMEM); - memcpy((void *)page, lustre_cfg_buf(lcfg, 4), - LUSTRE_CFG_BUFLEN(lcfg, 4)); - rc = filter_common_setup(obd, len, buf, (void *)page); - free_page(page); - + /* lprocfs must be setup before the filter so state can be safely added + * to /proc incrementally as the filter is setup */ lprocfs_init_vars(filter, &lvars); - if (rc == 0 && lprocfs_obd_setup(obd, lvars.obd_vars) == 0 && + if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 && lprocfs_alloc_obd_stats(obd, LPROC_FILTER_LAST) == 0) { /* Init obdfilter private stats here */ lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_READ_BYTES, @@ -1795,6 +1792,16 @@ static int filter_setup(struct obd_device *obd, obd_count len, void *buf) obd->obd_proc_entry); } + memcpy((void *)page, lustre_cfg_buf(lcfg, 4), + LUSTRE_CFG_BUFLEN(lcfg, 4)); + rc = filter_common_setup(obd, len, buf, (void *)page); + free_page(page); + + if (rc) { + lprocfs_obd_cleanup(obd); + lprocfs_free_obd_stats(obd); + } + return rc; } diff --git a/lustre/obdfilter/lproc_obdfilter.c b/lustre/obdfilter/lproc_obdfilter.c index a56bcffbfa527397863f5584eb8d9028819026c5..9d3b8e125f0effab564a8a264c6026198e6781ed 100644 --- a/lustre/obdfilter/lproc_obdfilter.c +++ b/lustre/obdfilter/lproc_obdfilter.c @@ -232,8 +232,7 @@ void filter_tally_write(struct obd_export *exp, struct page **pages, lprocfs_oh_tally_log2(&filter->fo_filter_stats.hist[BRW_W_PAGES], nr_pages); - lprocfs_oh_tally_log2(&fed->fed_brw_stats.hist[BRW_W_PAGES], - nr_pages); + lprocfs_oh_tally_log2(&fed->fed_brw_stats.hist[BRW_W_PAGES], nr_pages); while (nr_pages-- > 0) { if (last_page && (*pages)->index != (last_page->index + 1)) @@ -262,6 +261,7 @@ void filter_tally_read(struct obd_export *exp, struct page **pages, int nr_pages, unsigned long *blocks, int blocks_per_page) { struct filter_obd *filter = &exp->exp_obd->u.filter; + struct filter_export_data *fed = &exp->exp_filter_data; struct page *last_page = NULL; unsigned long *last_block = NULL; unsigned long discont_pages = 0; @@ -271,7 +271,9 @@ void filter_tally_read(struct obd_export *exp, struct page **pages, if (nr_pages == 0) return; - lprocfs_oh_tally_log2(&filter->fo_filter_stats.hist[BRW_R_PAGES], nr_pages); + lprocfs_oh_tally_log2(&filter->fo_filter_stats.hist[BRW_R_PAGES], + nr_pages); + lprocfs_oh_tally_log2(&fed->fed_brw_stats.hist[BRW_R_PAGES], nr_pages); while (nr_pages-- > 0) { if (last_page && (*pages)->index != (last_page->index + 1)) @@ -285,15 +287,14 @@ void filter_tally_read(struct obd_export *exp, struct page **pages, } } - lprocfs_oh_tally_log2(&filter->fo_filter_stats.hist[BRW_R_PAGES], nr_pages); - lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_R_DISCONT_PAGES], discont_pages); - lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_R_DISCONT_BLOCKS], discont_blocks); + lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_R_DISCONT_PAGES], + discont_pages); + lprocfs_oh_tally(&filter->fo_filter_stats.hist[BRW_R_DISCONT_BLOCKS], + discont_blocks); - lprocfs_oh_tally_log2(&exp->exp_filter_data.fed_brw_stats.hist[BRW_R_PAGES], - nr_pages); - lprocfs_oh_tally(&exp->exp_filter_data.fed_brw_stats.hist[BRW_R_DISCONT_PAGES], + lprocfs_oh_tally(&fed->fed_brw_stats.hist[BRW_R_DISCONT_PAGES], discont_pages); - lprocfs_oh_tally(&exp->exp_filter_data.fed_brw_stats.hist[BRW_R_DISCONT_BLOCKS], + lprocfs_oh_tally(&fed->fed_brw_stats.hist[BRW_R_DISCONT_BLOCKS], discont_blocks); }