From 83b6762d1a72f11c867d26d712da3aa6d4d62eb4 Mon Sep 17 00:00:00 2001 From: yury Date: Wed, 20 Sep 2006 13:48:12 +0000 Subject: [PATCH] - added limited lprocfs stuff in mdt to pass some tests; - fixes in tests. --- lustre/mdt/mdt_handler.c | 40 +++++++++++++++++++++++++++++----------- lustre/tests/recovery-small.sh | 4 ++-- lustre/tests/run-llog.sh | 2 +- lustre/tests/run-quotafmt.sh | 2 +- lustre/tests/sanity-quota.sh | 2 +- lustre/tests/sanity.sh | 2 +- 6 files changed, 35 insertions(+), 17 deletions(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 2dd1324..3e0fe66 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -2861,8 +2861,9 @@ out: static void mdt_fini(const struct lu_context *ctx, struct mdt_device *m) { - struct lu_device *d = &m->mdt_md_dev.md_lu_dev; - struct lu_site *ls = d->ld_site; + struct obd_device *obd = m->mdt_md_dev.md_lu_dev.ld_obd; + struct lu_device *d = &m->mdt_md_dev.md_lu_dev; + struct lu_site *ls = d->ld_site; ENTRY; target_cleanup_recovery(m->mdt_md_dev.md_lu_dev.ld_obd); @@ -2876,10 +2877,13 @@ static void mdt_fini(const struct lu_context *ctx, struct mdt_device *m) mdt_seq_fini(ctx, m); mdt_seq_fini_cli(m); - mdt_fld_fini(ctx, m); mdt_fs_cleanup(ctx, m); + + /* finish lprocfs */ + lprocfs_obd_cleanup(obd); + /* finish the stack */ mdt_stack_fini(ctx, m, md2lu_dev(m->mdt_child)); @@ -2899,12 +2903,13 @@ int mdt_postrecov(const struct lu_context *, struct mdt_device *); static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m, struct lu_device_type *ldt, struct lustre_cfg *cfg) { - struct mdt_thread_info *info; - struct obd_device *obd; - const char *dev = lustre_cfg_string(cfg, 0); - const char *num = lustre_cfg_string(cfg, 2); - struct lu_site *s; - int rc; + struct lprocfs_static_vars lvars; + struct mdt_thread_info *info; + struct obd_device *obd; + const char *dev = lustre_cfg_string(cfg, 0); + const char *num = lustre_cfg_string(cfg, 2); + struct lu_site *s; + int rc; ENTRY; info = lu_context_key_get(ctx, &mdt_thread_key); @@ -2942,11 +2947,18 @@ static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m, GOTO(err_free_site, rc); } + lprocfs_init_vars(mdt, &lvars); + rc = lprocfs_obd_setup(obd, lvars.obd_vars); + if (rc) { + CERROR("can't init lprocfs, rc %d\n", rc); + GOTO(err_fini_site, rc); + } + /* init the stack */ rc = mdt_stack_init(ctx, m, cfg); if (rc) { CERROR("can't init device stack, rc %d\n", rc); - GOTO(err_fini_site, rc); + GOTO(err_fini_lprocfs, rc); } /* set server index */ @@ -2993,6 +3005,8 @@ err_fini_fld: mdt_fld_fini(ctx, m); err_fini_stack: mdt_stack_fini(ctx, m, md2lu_dev(m->mdt_child)); +err_fini_lprocfs: + lprocfs_obd_cleanup(obd); err_fini_site: lu_site_fini(s); err_free_site: @@ -3564,10 +3578,14 @@ static struct lu_device_type mdt_device_type = { }; static struct lprocfs_vars lprocfs_mdt_obd_vars[] = { + { "uuid", lprocfs_rd_uuid, 0, 0 }, + { "recovery_status", lprocfs_obd_rd_recovery_status, 0, 0 }, + { "num_exports", lprocfs_rd_num_exports, 0, 0 }, { 0 } }; static struct lprocfs_vars lprocfs_mdt_module_vars[] = { + { "num_refs", lprocfs_rd_numrefs, 0, 0 }, { 0 } }; @@ -3575,8 +3593,8 @@ LPROCFS_INIT_VARS(mdt, lprocfs_mdt_module_vars, lprocfs_mdt_obd_vars); static int __init mdt_mod_init(void) { - int rc; struct lprocfs_static_vars lvars; + int rc; printk(KERN_INFO "Lustre: MetaData Target; info@clusterfs.com\n"); diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 0f73e10..e604fd8 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -238,7 +238,7 @@ test_18a() { do_facet client cp /etc/termcap $f sync - local osc2dev=`grep ${ost2_svc}-osc- $LPROC/devices | awk '{print $1}'` + local osc2dev=`grep ${ost2_svc}.*-osc- $LPROC/devices | awk '{print $1}'` $LCTL --device $osc2dev deactivate || return 3 # my understanding is that there should be nothing in the page # cache after the client reconnects? @@ -601,7 +601,7 @@ run_test 26 "evict dead exports" test_26b() { # bug 10140 - evict dead exports by pinger zconf_mount `hostname` $MOUNT2 - MDS_FILE=$LPROC/mds/${mds_svc}/num_exports + MDS_FILE=$LPROC/mdt/${mds_svc}/num_exports MDS_NEXP1="`do_facet mds cat $MDS_FILE | cut -d' ' -f2`" OST_FILE=$LPROC/obdfilter/${ost1_svc}/num_exports OST_NEXP1="`do_facet ost1 cat $OST_FILE | cut -d' ' -f2`" diff --git a/lustre/tests/run-llog.sh b/lustre/tests/run-llog.sh index 515a347..204eff5 100644 --- a/lustre/tests/run-llog.sh +++ b/lustre/tests/run-llog.sh @@ -2,7 +2,7 @@ PATH=`dirname $0`:`dirname $0`/../utils:$PATH TMP=${TMP:-/tmp} -MDS=`ls /proc/fs/lustre/mds | grep -v num_refs | head -n 1` +MDS=`ls /proc/fs/lustre/mdt | grep -v num_refs | head -n 1` [ -z "$MDS" ] && echo "no MDS available, skipping llog test" && exit 0 case `uname -r` in diff --git a/lustre/tests/run-quotafmt.sh b/lustre/tests/run-quotafmt.sh index 989cfa5..307f1dd 100644 --- a/lustre/tests/run-quotafmt.sh +++ b/lustre/tests/run-quotafmt.sh @@ -2,7 +2,7 @@ PATH=`dirname $0`:`dirname $0`/../utils:$PATH TMP=${TMP:-/tmp} -MDS=`ls /proc/fs/lustre/mds | grep -v num_refs | head -n 1` +MDS=`ls /proc/fs/lustre/mdt | grep -v num_refs | head -n 1` [ -z "$MDS" ] && echo "no MDS available, skipping quotafile test" && exit 0 insmod ../ldiskfs/quotafmt_test.ko || exit 1 diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index c4fe5f4..c0f1626 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -151,7 +151,7 @@ STRIPECOUNT=`cat $LPROC/lov/$LOVNAME/stripecount` STRIPESIZE=`cat $LPROC/lov/$LOVNAME/stripesize` ORIGFREE=`cat $LPROC/lov/$LOVNAME/kbytesavail` MAXFREE=${MAXFREE:-$((200000 * $OSTCOUNT))} -MDS=$(\ls $LPROC/mds 2> /dev/null | grep -v num_refs | tail -n 1) +MDS=$(\ls $LPROC/mdt 2> /dev/null | grep -v num_refs | tail -n 1) TSTDIR="$MOUNT/quota_dir" build_test_filter diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index f3b74c2..af4b01a 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -240,7 +240,7 @@ STRIPECOUNT=`cat $LPROC/lov/$LOVNAME/stripecount` STRIPESIZE=`cat $LPROC/lov/$LOVNAME/stripesize` ORIGFREE=`cat $LPROC/lov/$LOVNAME/kbytesavail` MAXFREE=${MAXFREE:-$((200000 * $OSTCOUNT))} -MDS=$(\ls $LPROC/mds 2> /dev/null | grep -v num_refs | tail -n 1) +MDS=$(\ls $LPROC/mdt 2> /dev/null | grep -v num_refs | tail -n 1) [ -f $DIR/d52a/foo ] && chattr -a $DIR/d52a/foo [ -f $DIR/d52b/foo ] && chattr -i $DIR/d52b/foo -- 1.8.3.1