1 /* -*- MODE: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
5 * Lustre Metadata Server (mdd) routines
7 * Copyright (C) 2006 Cluster File Systems, Inc.
8 * Author: Wang Di <wangdi@clusterfs.com>
10 * This file is part of the Lustre file system, http://www.lustre.org
11 * Lustre is a trademark of Cluster File Systems, Inc.
13 * You may have signed or agreed to another license before downloading
14 * this software. If so, you are bound by the terms and conditions
15 * of that agreement, and the following does not apply to you. See the
16 * LICENSE file included with this distribution for more information.
18 * If you did not agree to a different license, then this copy of Lustre
19 * is open source software; you can redistribute it and/or modify it
20 * under the terms of version 2 of the GNU General Public License as
21 * published by the Free Software Foundation.
23 * In either case, Lustre is distributed in the hope that it will be
24 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
25 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * license text for more details.
29 # define EXPORT_SYMTAB
31 #define DEBUG_SUBSYSTEM S_MDS
33 #include <linux/module.h>
35 #include <obd_class.h>
36 #include <lustre_ver.h>
37 #include <obd_support.h>
38 #include <lprocfs_status.h>
41 #include <lustre/lustre_idl.h>
43 #include "mdd_internal.h"
45 static const char *mdd_counter_names[LPROC_MDD_NR] = {
48 int mdd_procfs_init(struct mdd_device *mdd, const char *name)
50 struct lu_device *ld = &mdd->mdd_md_dev.md_lu_dev;
51 struct obd_type *type;
55 type = ld->ld_type->ldt_obd_type;
57 LASSERT(name != NULL);
58 LASSERT(type != NULL);
60 /* Find the type procroot and add the proc entry for this device */
61 mdd->mdd_proc_entry = lprocfs_register(name, type->typ_procroot,
63 if (IS_ERR(mdd->mdd_proc_entry)) {
64 rc = PTR_ERR(mdd->mdd_proc_entry);
65 CERROR("Error %d setting up lprocfs for %s\n",
67 mdd->mdd_proc_entry = NULL;
71 rc = lu_time_init(&mdd->mdd_stats,
73 mdd_counter_names, ARRAY_SIZE(mdd_counter_names));
81 int mdd_procfs_fini(struct mdd_device *mdd)
84 lu_time_fini(&mdd->mdd_stats);
86 if (mdd->mdd_proc_entry) {
87 lprocfs_remove(&mdd->mdd_proc_entry);
88 mdd->mdd_proc_entry = NULL;
93 void mdd_lprocfs_time_start(const struct lu_env *env)
95 lu_lprocfs_time_start(env);
98 void mdd_lprocfs_time_end(const struct lu_env *env, struct mdd_device *mdd,
101 lu_lprocfs_time_end(env, mdd->mdd_stats, idx);