static int mdt_statfs(struct mdt_thread_info *info)
{
+ struct ptlrpc_request *req = mdt_info_req(info);
struct md_device *next = info->mti_mdt->mdt_child;
struct ptlrpc_service *svc;
struct obd_statfs *osfs;
&info->mti_u.ksfs);
statfs_pack(osfs, &info->mti_u.ksfs);
}
+
+ if (rc == 0)
+ mdt_counter_incr(req->rq_export, LPROC_MDT_STATFS);
+
RETURN(rc);
}
static int mdt_getattr(struct mdt_thread_info *info)
{
+ struct ptlrpc_request *req = mdt_info_req(info);
struct mdt_object *obj = info->mti_object;
struct req_capsule *pill = info->mti_pill;
struct mdt_body *reqbody;
mdt_exit_ucred(info);
EXIT;
out_shrink:
+ if (rc == 0)
+ mdt_counter_incr(req->rq_export, LPROC_MDT_GETATTR);
+
mdt_shrink_reply(info);
return rc;
}
static int mdt_sync(struct mdt_thread_info *info)
{
+ struct ptlrpc_request *req = mdt_info_req(info);
struct req_capsule *pill = info->mti_pill;
struct mdt_body *body;
int rc;
} else
rc = err_serious(rc);
}
+ if (rc == 0)
+ mdt_counter_incr(req->rq_export, LPROC_MDT_SYNC);
+
RETURN(rc);
}
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_GETATTR, 0, "getattr", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_SETATTR, 0, "setattr", "reqs");
lprocfs_counter_init(stats, LPROC_MDT_GETXATTR, 0, "getxattr", "reqs");
lprocfs_counter_init(stats, LPROC_MDT_SETXATTR, 0, "setxattr", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_STATFS, 0, "statfs", "reqs");
+ lprocfs_counter_init(stats, LPROC_MDT_SYNC, 0, "sync", "reqs");
}
}
run_test 132 "som avoids glimpse rpc"
+check_stats() {
+ local res
+ local count
+ case $1 in
+ $SINGLEMDS) res=`do_facet $SINGLEMDS $LCTL get_param mdt.$FSNAME-MDT0000.md_stats | grep "$2"`
+ ;;
+ ost) res=`do_facet ost $LCTL get_param obdfilter.$FSNAME-OST0000.stats | grep "$2"`
+ ;;
+ *) error "Wrong argument $1" ;;
+ esac
+ echo $res
+ count=`echo $res | awk '{print $2}'`
+ [ -z "$res" ] && error "The counter for $2 on $1 was not incremented"
+ # if the argument $3 is zero, it means any stat increment is ok.
+ if [ $3 -gt 0 ] ; then
+ [ $count -ne $3 ] && error "The $2 counter on $1 is wrong - expected $3"
+ fi
+}
+
+test_133a() {
+ local testdir=$DIR/${tdir}/stats_testdir
+ mkdir -p $DIR/${tdir}
+
+ # clear stats.
+ do_facet $SINGLEMDS $LCTL set_param mdt.*.md_stats=clear
+ do_facet ost $LCTL set_param obdfilter.*.stats=clear
+
+ # verify mdt stats first.
+ mkdir ${testdir} || error "mkdir failed"
+ check_stats $SINGLEMDS "mkdir" 1
+ touch ${testdir}/${tfile} || "touch failed"
+ check_stats $SINGLEMDS "open" 1
+ check_stats $SINGLEMDS "close" 1
+ mknod ${testdir}/${tfile}-pipe p || "mknod failed"
+ check_stats $SINGLEMDS "mknod" 1
+ rm -f ${testdir}/${tfile}-pipe || "pipe remove failed"
+ check_stats $SINGLEMDS "unlink" 1
+ rm -f ${testdir}/${tfile} || error "file remove failed"
+ check_stats $SINGLEMDS "unlink" 2
+
+ # remove working dir and check mdt stats again.
+ rmdir ${testdir} || error "rmdir failed"
+ check_stats $SINGLEMDS "rmdir" 1
+
+ rm -rf $DIR/${tdir}
+}
+run_test 133a "Verifying MDT stats ========================================"
+
+test_133b() {
+ local testdir=$DIR/${tdir}/stats_testdir
+ mkdir -p ${testdir} || error "mkdir failed"
+ touch ${testdir}/${tfile} || "touch failed"
+ cancel_lru_locks mdc
+
+ # clear stats.
+ do_facet $SINGLEMDS $LCTL set_param mdt.*.md_stats=clear
+ do_facet ost $LCTL set_param obdfilter.*.stats=clear
+
+ # extra mdt stats verification.
+ chmod 444 ${testdir}/${tfile} || error "chmod failed"
+ check_stats $SINGLEMDS "setattr" 1
+ $LFS df || error "lfs failed"
+ check_stats $SINGLEMDS "statfs" 1
+
+ rm -rf $DIR/${tdir}
+}
+run_test 133b "Verifying extra MDT stats =================================="
+
+test_133c() {
+ local testdir=$DIR/${tdir}/stats_testdir
+ mkdir -p ${testdir} || error "mkdir failed"
+
+ # verify obdfilter stats.
+ $LFS setstripe -c 1 -o 0 ${testdir}/${tfile}
+ sync
+ cancel_lru_locks osc
+
+ # clear stats.
+ do_facet $SINGLEMDS $LCTL set_param mdt.*.md_stats=clear
+ do_facet ost $LCTL set_param obdfilter.*.stats=clear
+
+ dd if=/dev/zero of=${testdir}/${tfile} conv=notrunc bs=1024k count=1 || error "dd failed"
+ sync
+ cancel_lru_locks osc
+ check_stats ost "write" 1
+
+ dd if=${testdir}/${tfile} of=/dev/null bs=1k count=1 || error "dd failed"
+ check_stats ost "read" 1
+
+ > ${testdir}/${tfile} || error "truncate failed"
+ check_stats ost "punch" 1
+
+ rm -f ${testdir}/${tfile} || error "file remove failed"
+ check_stats ost "destroy" 1
+
+ rm -rf $DIR/${tdir}
+}
+run_test 133c "Verifying OST stats ========================================"
+
test_140() { #bug-17379
mkdir -p $DIR/$tdir || error "Creating dir $DIR/$tdir"
cd $DIR/$tdir || error "Changing to $DIR/$tdir"