time) so that they don't try to use initialized data.
b=1519
- use highest lock extent for kms, not last one (2925)
- don't dereference ERR_PTR() dentry in error handling path (3107)
- fix thread race in portals_debug_dumplog() (3122)
+ - create lprocfs device entries at setup instead of at attach (1519)
* miscellania
- allow default OST striping configuration per directory (1414)
#include <linux/obd_class.h>
#include <linux/obd_cache.h>
-static int cobd_attach(struct obd_device *dev, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
-
- lprocfs_init_vars(cobd, &lvars);
- return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-static int cobd_detach(struct obd_device *dev)
-{
- return lprocfs_obd_detach(dev);
-}
-
-static int
-cobd_setup (struct obd_device *dev, obd_count len, void *buf)
+static int cobd_setup (struct obd_device *obd, obd_count len, void *buf)
{
struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
- struct cache_obd *cobd = &dev->u.cobd;
+ struct cache_obd *cobd = &obd->u.cobd;
struct obd_device *target;
struct obd_device *cache;
struct obd_uuid target_uuid;
struct obd_uuid cache_uuid;
struct lustre_handle target_conn = {0,}, cache_conn = {0,};
+ struct lprocfs_static_vars lvars;
int rc;
- if (lcfg->lcfg_inlbuf1 == NULL ||
- lcfg->lcfg_inlbuf2 == NULL)
+ if (lcfg->lcfg_inlbuf1 == NULL || lcfg->lcfg_inlbuf2 == NULL)
return (-EINVAL);
obd_str2uuid(&target_uuid, lcfg->lcfg_inlbuf1);
}
cobd->cobd_cache_exp = class_conn2export(&cache_conn);
- return rc;
+ lprocfs_init_vars(cobd, &lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
+
+ return 0;
}
-static int cobd_cleanup(struct obd_device *dev, int flags)
+static int cobd_cleanup(struct obd_device *obd, int flags)
{
- struct cache_obd *cobd = &dev->u.cobd;
+ struct cache_obd *cobd = &obd->u.cobd;
int rc;
- if (!list_empty(&dev->obd_exports))
+ if (!list_empty(&obd->obd_exports))
return (-EBUSY);
+ lprocfs_obd_cleanup(obd);
+
rc = obd_disconnect(cobd->cobd_cache_exp, flags);
if (rc != 0)
- CERROR ("error %d disconnecting cache\n", rc);
+ CERROR("error %d disconnecting cache\n", rc);
rc = obd_disconnect(cobd->cobd_target_exp, flags);
if (rc != 0)
- CERROR ("error %d disconnecting target\n", rc);
+ CERROR("error %d disconnecting target\n", rc);
return (0);
}
static struct obd_ops cobd_ops = {
o_owner: THIS_MODULE,
- o_attach: cobd_attach,
- o_detach: cobd_detach,
o_setup: cobd_setup,
o_cleanup: cobd_cleanup,
extern int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
struct lprocfs_stats *stats);
-#define LPROCFS_INIT_MULTI_VARS(array, size) \
-void lprocfs_init_multi_vars(unsigned int idx, \
- struct lprocfs_static_vars *x) \
-{ \
- struct lprocfs_static_vars *glob = (struct lprocfs_static_vars*)array; \
- LASSERT(glob != 0); \
- LASSERT(idx < (unsigned int)(size)); \
- x->module_vars = glob[idx].module_vars; \
- x->obd_vars = glob[idx].obd_vars; \
-} \
-
#define LPROCFS_INIT_VARS(name, vclass, vinstance) \
void lprocfs_##name##_init_vars(struct lprocfs_static_vars *x) \
{ \
extern void lprocfs_##NAME##_init_vars(struct lprocfs_static_vars *); \
lprocfs_##NAME##_init_vars(VAR); \
} while (0)
-extern void lprocfs_init_multi_vars(unsigned int idx,
- struct lprocfs_static_vars *var);
/* lprocfs_status.c */
extern int lprocfs_add_vars(struct proc_dir_entry *root,
struct lprocfs_vars *var,
extern struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *root,
const char *name);
-extern int lprocfs_obd_attach(struct obd_device *dev, struct lprocfs_vars *list);
-extern int lprocfs_obd_detach(struct obd_device *dev);
+extern int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list);
+extern int lprocfs_obd_cleanup(struct obd_device *obd);
/* Generic callbacks */
int count, int *eof, void *data);
extern int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
int count, int *eof, void *data);
+extern int lprocfs_rd_num_exports(char *page, char **start, off_t off,
+ int count, int *eof, void *data);
extern int lprocfs_rd_numrefs(char *page, char **start, off_t off,
int count, int *eof, void *data);
static inline struct proc_dir_entry *
lprocfs_register(const char *name, struct proc_dir_entry *parent,
struct lprocfs_vars *list, void *data) { return NULL; }
-#define LPROCFS_INIT_MULTI_VARS(array, size) do {} while (0)
-static inline void lprocfs_init_multi_vars(unsigned int idx,
- struct lprocfs_static_vars *x) { return; }
#define LPROCFS_INIT_VARS(name, vclass, vinstance) do {} while (0)
#define lprocfs_init_vars(...) do {} while (0)
static inline int lprocfs_add_vars(struct proc_dir_entry *root,
static inline void lprocfs_remove(struct proc_dir_entry *root) {};
static inline struct proc_dir_entry *lprocfs_srch(struct proc_dir_entry *head,
const char *name) {return 0;}
-static inline int lprocfs_obd_attach(struct obd_device *dev,
- struct lprocfs_vars *list) { return 0; }
-static inline int lprocfs_obd_detach(struct obd_device *dev) { return 0; }
+static inline int lprocfs_obd_setup(struct obd_device *dev,
+ struct lprocfs_vars *list) { return 0; }
+static inline int lprocfs_obd_cleanup(struct obd_device *dev) { return 0; }
static inline int lprocfs_rd_u64(char *page, char **start, off_t off,
int count, int *eof, void *data) { return 0; }
static inline int lprocfs_rd_uuid(char *page, char **start, off_t off,
static inline int lprocfs_rd_name(char *page, char **start, off_t off,
int count, int *eof, void *data) { return 0; }
static inline int lprocfs_rd_server_uuid(char *page, char **start, off_t off,
- int count, int *eof, void *data) { return 0; }
+ int count, int *eof, void *data)
+{ return 0; }
static inline int lprocfs_rd_conn_uuid(char *page, char **start, off_t off,
- int count, int *eof, void *data) { return 0; }
+ int count, int *eof, void *data)
+{ return 0; }
+static inline int lprocfs_rd_num_exports(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{ return 0; }
static inline int lprocfs_rd_numrefs(char *page, char **start, off_t off,
int count, int *eof, void *data) { return 0; }
}
struct file_operations llite_dump_pgcache_fops = {
+ .owner = THIS_MODULE,
.open = llite_dump_pgcache_seq_open,
.read = seq_read,
.release = llite_dump_pgcache_seq_release,
}
/* obd methods */
-int lov_attach(struct obd_device *dev, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
- int rc;
-
- lprocfs_init_vars(lov, &lvars);
- rc = lprocfs_obd_attach(dev, lvars.obd_vars);
- if (rc == 0) {
-#ifdef __KERNEL__
- struct proc_dir_entry *entry;
-
- entry = create_proc_entry("target_obd", 0444,
- dev->obd_proc_entry);
- if (entry == NULL) {
- rc = -ENOMEM;
- } else {
- entry->proc_fops = &lov_proc_target_fops;
- entry->data = dev;
- }
-#endif
- }
- return rc;
-}
-
-int lov_detach(struct obd_device *dev)
-{
- return lprocfs_obd_detach(dev);
-}
-
static int lov_connect(struct lustre_handle *conn, struct obd_device *obd,
struct obd_uuid *cluuid)
{
static int lov_setup(struct obd_device *obd, obd_count len, void *buf)
{
+ struct lprocfs_static_vars lvars;
struct lustre_cfg *lcfg = buf;
struct lov_desc *desc;
struct lov_obd *lov = &obd->u.lov;
struct lov_tgt_desc *tgts;
int i;
int count;
- int rc = 0;
ENTRY;
if (lcfg->lcfg_inllen1 < 1) {
*uuid = uuids[i];
}
+ lprocfs_init_vars(lov, &lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
+#ifdef __KERNEL__
+ {
+ struct proc_dir_entry *entry;
+
+ entry = create_proc_entry("target_obd", 0444,
+ obd->obd_proc_entry);
+ if (entry != NULL) {
+ entry->proc_fops = &lov_proc_target_fops;
+ entry->data = obd;
+ }
+ }
+#endif
- RETURN(rc);
+ RETURN(0);
}
-static int lov_cleanup(struct obd_device *obd, int flags)
+static int lov_cleanup(struct obd_device *obd, int flags)
{
struct lov_obd *lov = &obd->u.lov;
+ lprocfs_obd_cleanup(obd);
OBD_FREE(lov->tgts, lov->bufsize);
+
RETURN(0);
}
struct obd_ops lov_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: lov_attach,
- o_detach: lov_detach,
o_setup: lov_setup,
o_cleanup: lov_cleanup,
o_connect: lov_connect,
};
struct file_operations lov_proc_target_fops = {
- .open = lov_target_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
+ .owner = THIS_MODULE,
+ .open = lov_target_seq_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
.release = seq_release,
};
RETURN(rc);
}
-static int mdc_attach(struct obd_device *dev, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
-
- lprocfs_init_vars(mdc, &lvars);
- return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-static int mdc_detach(struct obd_device *dev)
-{
- return lprocfs_obd_detach(dev);
-}
-
static int mdc_import_event(struct obd_device *obd,
struct obd_import *imp,
enum obd_import_event event)
}
case IMP_EVENT_INVALIDATE: {
struct ldlm_namespace *ns = obd->obd_namespace;
-
+
ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
if (obd->obd_observer)
static int mdc_setup(struct obd_device *obd, obd_count len, void *buf)
{
struct client_obd *cli = &obd->u.cli;
+ struct lprocfs_static_vars lvars;
int rc;
ENTRY;
OBD_ALLOC(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
if (!cli->cl_setattr_lock)
- GOTO(out_free_rpc, rc = -ENOMEM);
+ GOTO(err_rpc_lock, rc = -ENOMEM);
mdc_init_rpc_lock(cli->cl_setattr_lock);
rc = client_obd_setup(obd, len, buf);
- if (rc) {
- OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
- out_free_rpc:
- OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
- }
+ if (rc)
+ GOTO(err_setattr_lock, rc);
+ lprocfs_init_vars(mdc, &lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
rc = obd_llog_init(obd, obd, 0, NULL);
if (rc) {
}
RETURN(rc);
+
+err_setattr_lock:
+ OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
+err_rpc_lock:
+ OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
+ ptlrpcd_decref();
+ RETURN(rc);
}
int mdc_init_ea_size(struct obd_device *obd, char *lov_name)
static int mdc_precleanup(struct obd_device *obd, int flags)
{
int rc = 0;
-
+
rc = obd_llog_finish(obd, 0);
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
static int mdc_cleanup(struct obd_device *obd, int flags)
{
struct client_obd *cli = &obd->u.cli;
-
+
OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
OBD_FREE(cli->cl_setattr_lock, sizeof (*cli->cl_setattr_lock));
+ lprocfs_obd_cleanup(obd);
ptlrpcd_decref();
return client_obd_cleanup(obd, flags);
struct obd_ops mdc_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: mdc_attach,
- o_detach: mdc_detach,
o_setup: mdc_setup,
o_precleanup: mdc_precleanup,
o_cleanup: mdc_cleanup,
/* mount the file system (secretly) */
static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
{
+ struct lprocfs_static_vars lvars;
struct lustre_cfg* lcfg = buf;
struct mds_obd *mds = &obd->u.mds;
struct vfsmount *mnt;
rc = llog_start_commit_thread();
if (rc < 0)
GOTO(err_fs, rc);
-
if (lcfg->lcfg_inllen3 > 0 && lcfg->lcfg_inlbuf3) {
class_uuid_t uuid;
class_uuid_unparse(uuid, &mds->mds_lov_uuid);
OBD_ALLOC(mds->mds_profile, lcfg->lcfg_inllen3);
- if (mds->mds_profile == NULL)
+ if (mds->mds_profile == NULL)
GOTO(err_fs, rc = -ENOMEM);
memcpy(mds->mds_profile, lcfg->lcfg_inlbuf3,
lcfg->lcfg_inllen3);
- }
+ }
ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
"mds_ldlm_client", &obd->obd_ldlm_client);
rc = mds_postsetup(obd);
if (rc)
GOTO(err_fs, rc);
+
+ lprocfs_init_vars(mds, &lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
+
RETURN(0);
err_fs:
if (mds->mds_sb == NULL)
RETURN(0);
+ lprocfs_obd_cleanup(obd);
+
mds_update_server_data(obd, 1);
if (mds->mds_lov_objids != NULL) {
OBD_FREE(mds->mds_lov_objids,
* be handled like any normal request now. */
lustre_msg_clear_flags(req->rq_reqmsg, MSG_RESENT);
-
+
DEBUG_REQ(D_HA, req, "no existing lock with rhandle "LPX64,
remote_hdl.cookie);
}
RETURN(ELDLM_LOCK_REPLACED);
}
-int mds_attach(struct obd_device *dev, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
-
- lprocfs_init_multi_vars(0, &lvars);
- return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-int mds_detach(struct obd_device *dev)
-{
- return lprocfs_obd_detach(dev);
-}
-
-int mdt_attach(struct obd_device *dev, obd_count len, void *data)
+static int mdt_setup(struct obd_device *obd, obd_count len, void *buf)
{
+ struct mds_obd *mds = &obd->u.mds;
struct lprocfs_static_vars lvars;
-
- lprocfs_init_multi_vars(1, &lvars);
- return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-int mdt_detach(struct obd_device *dev)
-{
- return lprocfs_obd_detach(dev);
-}
-
-static int mdt_setup(struct obd_device *obddev, obd_count len, void *buf)
-{
- struct mds_obd *mds = &obddev->u.mds;
int rc = 0;
ENTRY;
- mds->mds_service =
+ mds->mds_service =
ptlrpc_init_svc(MDS_NBUFS, MDS_BUFSIZE, MDS_MAXREQSIZE,
MDS_REQUEST_PORTAL, MDC_REPLY_PORTAL,
mds_handle, "mds",
- obddev->obd_proc_entry);
+ obd->obd_proc_entry);
if (!mds->mds_service) {
CERROR("failed to start service\n");
RETURN(rc = -ENOMEM);
}
- rc = ptlrpc_start_n_threads(obddev, mds->mds_service, MDT_NUM_THREADS,
+ rc = ptlrpc_start_n_threads(obd, mds->mds_service, MDT_NUM_THREADS,
"ll_mdt");
if (rc)
GOTO(err_thread, rc);
mds->mds_setattr_service =
ptlrpc_init_svc(MDS_NBUFS, MDS_BUFSIZE, MDS_MAXREQSIZE,
MDS_SETATTR_PORTAL, MDC_REPLY_PORTAL,
- mds_handle, "mds_setattr",
- obddev->obd_proc_entry);
+ mds_handle, "mds_setattr",
+ obd->obd_proc_entry);
if (!mds->mds_setattr_service) {
CERROR("failed to start getattr service\n");
GOTO(err_thread, rc = -ENOMEM);
}
- rc = ptlrpc_start_n_threads(obddev, mds->mds_setattr_service,
+ rc = ptlrpc_start_n_threads(obd, mds->mds_setattr_service,
MDT_NUM_THREADS, "ll_mdt_attr");
if (rc)
GOTO(err_thread2, rc);
-
+
mds->mds_readpage_service =
ptlrpc_init_svc(MDS_NBUFS, MDS_BUFSIZE, MDS_MAXREQSIZE,
MDS_READPAGE_PORTAL, MDC_REPLY_PORTAL,
- mds_handle, "mds_readpage",
- obddev->obd_proc_entry);
+ mds_handle, "mds_readpage",
+ obd->obd_proc_entry);
if (!mds->mds_readpage_service) {
CERROR("failed to start readpage service\n");
GOTO(err_thread2, rc = -ENOMEM);
}
- rc = ptlrpc_start_n_threads(obddev, mds->mds_readpage_service,
+ rc = ptlrpc_start_n_threads(obd, mds->mds_readpage_service,
MDT_NUM_THREADS, "ll_mdt_rdpg");
- if (rc)
+ if (rc)
GOTO(err_thread3, rc);
+ lprocfs_init_vars(mdt, &lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
+
RETURN(0);
err_thread3:
}
-static int mdt_cleanup(struct obd_device *obddev, int flags)
+static int mdt_cleanup(struct obd_device *obd, int flags)
{
- struct mds_obd *mds = &obddev->u.mds;
+ struct mds_obd *mds = &obd->u.mds;
ENTRY;
+ lprocfs_obd_cleanup(obd);
+
ptlrpc_stop_all_threads(mds->mds_readpage_service);
ptlrpc_unregister_service(mds->mds_readpage_service);
RETURN(0);
}
-static struct dentry *mds_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr, void *data)
+static struct dentry *mds_lvfs_fid2dentry(__u64 id, __u32 gen, __u64 gr,
+ void *data)
{
struct obd_device *obd = data;
struct ll_fid fid;
/* use obd ops to offer management infrastructure */
static struct obd_ops mds_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: mds_attach,
- o_detach: mds_detach,
o_connect: mds_connect,
o_init_export: mds_init_export,
o_destroy_export: mds_destroy_export,
static struct obd_ops mdt_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: mdt_attach,
- o_detach: mdt_detach,
o_setup: mdt_setup,
o_cleanup: mdt_cleanup,
};
{
struct lprocfs_static_vars lvars;
- lprocfs_init_multi_vars(0, &lvars);
+ lprocfs_init_vars(mds, &lvars);
class_register_type(&mds_obd_ops, lvars.module_vars, LUSTRE_MDS_NAME);
- lprocfs_init_multi_vars(1, &lvars);
+ lprocfs_init_vars(mdt, &lvars);
class_register_type(&mdt_obd_ops, lvars.module_vars, LUSTRE_MDT_NAME);
return 0;
{ "filestotal", lprocfs_rd_filestotal, 0, 0 },
{ "filesfree", lprocfs_rd_filesfree, 0, 0 },
{ "filesopen", lprocfs_mds_rd_filesopen, 0, 0 },
- //{ "filegroups", lprocfs_rd_filegroups, 0, 0 },
{ "mntdev", lprocfs_mds_rd_mntdev, 0, 0 },
{ "recovery_status", lprocfs_mds_rd_recovery_status, 0, 0 },
{ "evict_client", 0, lprocfs_mds_wr_evict_client, 0 },
+ { "num_exports", lprocfs_rd_num_exports, 0, 0 },
{ 0 }
};
};
#endif
-struct lprocfs_static_vars lprocfs_array_vars[] = { {lprocfs_mds_module_vars,
- lprocfs_mds_obd_vars},
- {lprocfs_mdt_module_vars,
- lprocfs_mdt_obd_vars}};
-
-LPROCFS_INIT_MULTI_VARS(lprocfs_array_vars,
- (sizeof(lprocfs_array_vars) /
- sizeof(struct lprocfs_static_vars)))
+LPROCFS_INIT_VARS(mds, lprocfs_mds_module_vars, lprocfs_mds_obd_vars);
+LPROCFS_INIT_VARS(mdt, lprocfs_mdt_module_vars, lprocfs_mdt_obd_vars);
/* declare character device */
static struct file_operations obd_psdev_fops = {
- ioctl: obd_class_ioctl, /* ioctl */
- open: obd_class_open, /* open */
- release: obd_class_release, /* release */
+ .owner = THIS_MODULE,
+ .ioctl = obd_class_ioctl, /* ioctl */
+ .open = obd_class_open, /* open */
+ .release = obd_class_release, /* release */
};
/* modules setup */
static struct miscdevice obd_psdev = {
- OBD_MINOR,
- "obd_psdev",
- &obd_psdev_fops
+ .minor = OBD_MINOR,
+ .name = "obd_psdev",
+ .fops = &obd_psdev_fops,
};
#else
void *obd_psdev = NULL;
}
struct file_operations obd_device_list_fops = {
- .open = obd_device_list_open,
- .read = seq_read,
- .llseek = seq_lseek,
+ .owner = THIS_MODULE,
+ .open = obd_device_list_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
.release = seq_release,
};
#endif
if (rc)
CERROR("failed to llog_test_llog_finish: %d\n", rc);
+ lprocfs_obd_cleanup(obd);
+
return rc;
}
static int llog_test_setup(struct obd_device *obd, obd_count len, void *buf)
{
+ struct lprocfs_static_vars lvars;
struct lustre_cfg *lcfg = buf;
struct obd_device *tgt;
int rc;
rc = llog_run_tests(obd);
if (rc)
llog_test_cleanup(obd, 0);
- RETURN(rc);
-}
-
-static struct lprocfs_vars lprocfs_ost_obd_vars[] = { {0} };
-static struct lprocfs_vars lprocfs_ost_module_vars[] = { {0} };
-LPROCFS_INIT_VARS(ost, lprocfs_ost_module_vars, lprocfs_ost_obd_vars)
-
-static int llog_test_attach(struct obd_device *dev, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
- lprocfs_init_vars(ost, &lvars);
- return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
+ lprocfs_init_vars(llog_test, &lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
-static int llog_test_detach(struct obd_device *dev)
-{
- return lprocfs_obd_detach(dev);
+ RETURN(rc);
}
static struct obd_ops llog_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: llog_test_attach,
- o_detach: llog_test_detach,
o_setup: llog_test_setup,
o_cleanup: llog_test_cleanup,
o_llog_init: llog_test_llog_init,
return rc;
}
-int lprocfs_rd_filegroups(char *page, char **start, off_t off, int count,
- int *eof, void *data)
-{
- *eof = 1;
- return snprintf(page, count, "unimplemented\n");
-}
-
int lprocfs_rd_server_uuid(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
struct obd_device *obd = (struct obd_device *)data;
struct obd_import *imp;
char *imp_state_name = NULL;
-
+
LASSERT(obd != NULL);
imp = obd->u.cli.cl_import;
imp_state_name = ptlrpc_import_state_name(imp->imp_state);
return snprintf(page, count, "%s\n", conn->c_remote_uuid.uuid);
}
+int lprocfs_rd_num_exports(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device*)data;
+
+ LASSERT(obd != NULL);
+ *eof = 1;
+ return snprintf(page, count, "%u\n", obd->obd_num_exports);
+}
+
int lprocfs_rd_numrefs(char *page, char **start, off_t off, int count,
int *eof, void *data)
{
return snprintf(page, count, "%d\n", class->typ_refcnt);
}
-int lprocfs_obd_attach(struct obd_device *dev, struct lprocfs_vars *list)
+int lprocfs_obd_setup(struct obd_device *obd, struct lprocfs_vars *list)
{
int rc = 0;
- LASSERT(dev != NULL);
- LASSERT(dev->obd_type != NULL);
- LASSERT(dev->obd_type->typ_procroot != NULL);
-
- dev->obd_proc_entry = lprocfs_register(dev->obd_name,
- dev->obd_type->typ_procroot,
- list, dev);
- if (IS_ERR(dev->obd_proc_entry)) {
- rc = PTR_ERR(dev->obd_proc_entry);
- dev->obd_proc_entry = NULL;
+ LASSERT(obd != NULL);
+ LASSERT(obd->obd_type != NULL);
+ LASSERT(obd->obd_type->typ_procroot != NULL);
+
+ obd->obd_proc_entry = lprocfs_register(obd->obd_name,
+ obd->obd_type->typ_procroot,
+ list, obd);
+ if (IS_ERR(obd->obd_proc_entry)) {
+ rc = PTR_ERR(obd->obd_proc_entry);
+ CERROR("error %d setting up lprocfs for %s\n",rc,obd->obd_name);
+ obd->obd_proc_entry = NULL;
}
return rc;
}
-int lprocfs_obd_detach(struct obd_device *dev)
+int lprocfs_obd_cleanup(struct obd_device *obd)
{
- if (dev && dev->obd_proc_entry) {
- lprocfs_remove(dev->obd_proc_entry);
- dev->obd_proc_entry = NULL;
+ if (obd && obd->obd_proc_entry) {
+ lprocfs_remove(obd->obd_proc_entry);
+ obd->obd_proc_entry = NULL;
}
return 0;
}
}
struct file_operations lprocfs_stats_seq_fops = {
+ owner: THIS_MODULE,
open: lprocfs_stats_seq_open,
read: seq_read,
llseek: seq_lseek,
EXPORT_SYMBOL(lprocfs_srch);
EXPORT_SYMBOL(lprocfs_remove);
EXPORT_SYMBOL(lprocfs_add_vars);
-EXPORT_SYMBOL(lprocfs_obd_attach);
-EXPORT_SYMBOL(lprocfs_obd_detach);
+EXPORT_SYMBOL(lprocfs_obd_setup);
+EXPORT_SYMBOL(lprocfs_obd_cleanup);
EXPORT_SYMBOL(lprocfs_alloc_stats);
EXPORT_SYMBOL(lprocfs_free_stats);
EXPORT_SYMBOL(lprocfs_register_stats);
EXPORT_SYMBOL(lprocfs_rd_fstype);
EXPORT_SYMBOL(lprocfs_rd_server_uuid);
EXPORT_SYMBOL(lprocfs_rd_conn_uuid);
+EXPORT_SYMBOL(lprocfs_rd_num_exports);
EXPORT_SYMBOL(lprocfs_rd_numrefs);
EXPORT_SYMBOL(lprocfs_rd_blksize);
EXPORT_SYMBOL(lprocfs_rd_kbytesavail);
EXPORT_SYMBOL(lprocfs_rd_filestotal);
EXPORT_SYMBOL(lprocfs_rd_filesfree);
-EXPORT_SYMBOL(lprocfs_rd_filegroups);
EXPORT_SYMBOL(lprocfs_write_helper);
EXPORT_SYMBOL(lprocfs_write_u64_helper);
return rc;
}
-static int echo_setup(struct obd_device *obddev, obd_count len, void *buf)
+static int echo_setup(struct obd_device *obd, obd_count len, void *buf)
{
+ struct lprocfs_static_vars lvars;
ENTRY;
- spin_lock_init(&obddev->u.echo.eo_lock);
- obddev->u.echo.eo_lastino = ECHO_INIT_OBJID;
+ spin_lock_init(&obd->u.echo.eo_lock);
+ obd->u.echo.eo_lastino = ECHO_INIT_OBJID;
- obddev->obd_namespace =
- ldlm_namespace_new("echo-tgt", LDLM_NAMESPACE_SERVER);
- if (obddev->obd_namespace == NULL) {
+ obd->obd_namespace = ldlm_namespace_new("echo-tgt",
+ LDLM_NAMESPACE_SERVER);
+ if (obd->obd_namespace == NULL) {
LBUG();
RETURN(-ENOMEM);
}
+ lprocfs_init_vars(echo, &lvars);
+ if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 &&
+ lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST) == 0) {
+ lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES,
+ LPROCFS_CNTR_AVGMINMAX,
+ "read_bytes", "bytes");
+ lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_WRITE_BYTES,
+ LPROCFS_CNTR_AVGMINMAX,
+ "write_bytes", "bytes");
+ }
+
ptlrpc_init_client (LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
- "echo_ldlm_cb_client", &obddev->obd_ldlm_client);
+ "echo_ldlm_cb_client", &obd->obd_ldlm_client);
RETURN(0);
}
-static int echo_cleanup(struct obd_device *obddev, int flags)
+static int echo_cleanup(struct obd_device *obd, int flags)
{
- int leaked;
+ int leaked;
ENTRY;
- ldlm_namespace_free(obddev->obd_namespace, flags & OBD_OPT_FORCE);
+ lprocfs_free_obd_stats(obd);
+ lprocfs_obd_cleanup(obd);
+
+ ldlm_namespace_free(obd->obd_namespace, flags & OBD_OPT_FORCE);
- leaked = atomic_read(&obddev->u.echo.eo_prep);
+ leaked = atomic_read(&obd->u.echo.eo_prep);
if (leaked != 0)
CERROR("%d prep/commitrw pages leaked\n", leaked);
RETURN(0);
}
-int echo_attach(struct obd_device *obd, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
- int rc;
-
- lprocfs_init_vars(echo, &lvars);
- rc = lprocfs_obd_attach(obd, lvars.obd_vars);
- if (rc != 0)
- return rc;
- rc = lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST);
- if (rc != 0)
- return rc;
-
- lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES,
- LPROCFS_CNTR_AVGMINMAX, "read_bytes", "bytes");
- lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_WRITE_BYTES,
- LPROCFS_CNTR_AVGMINMAX, "write_bytes", "bytes");
- return rc;
-}
-
-int echo_detach(struct obd_device *dev)
-{
- lprocfs_free_obd_stats(dev);
- return lprocfs_obd_detach(dev);
-}
-
static struct obd_ops echo_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: echo_attach,
- o_detach: echo_detach,
o_connect: echo_connect,
o_disconnect: echo_disconnect,
o_destroy_export: echo_destroy_export,
f_dput(dentry);
}
OBD_FREE(filter->fo_dentry_O_groups,
- FILTER_GROUPS * sizeof(struct dentry *));
+ FILTER_GROUPS * sizeof(*filter->fo_dentry_O_groups));
filter->fo_dentry_O_groups = NULL;
}
if (filter->fo_last_objid_files != NULL) {
filp_close(filp, 0);
}
OBD_FREE(filter->fo_last_objid_files,
- FILTER_GROUPS * sizeof(struct file *));
+ FILTER_GROUPS * sizeof(*filter->fo_last_objid_files));
filter->fo_last_objid_files = NULL;
}
- if (filter->fo_dentry_O_sub != NULL && filter->fo_subdir_count) {
+ if (filter->fo_dentry_O_sub != NULL) {
for (i = 0; i < filter->fo_subdir_count; i++) {
dentry = filter->fo_dentry_O_sub[i];
if (dentry != NULL)
}
if (filter->fo_last_objids != NULL) {
OBD_FREE(filter->fo_last_objids,
- FILTER_GROUPS * sizeof(__u64));
+ FILTER_GROUPS * sizeof(*filter->fo_last_objids));
filter->fo_last_objids = NULL;
}
if (filter->fo_dentry_O != NULL) {
static int filter_setup(struct obd_device *obd, obd_count len, void *buf)
{
+ struct lprocfs_static_vars lvars;
struct lustre_cfg* lcfg = buf;
const char *str = NULL;
char *option = NULL;
rc = filter_common_setup(obd, len, buf, option);
if (option)
OBD_FREE(option, n);
+
+ lprocfs_init_vars(filter, &lvars);
+ if (rc == 0 && 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,
+ LPROCFS_CNTR_AVGMINMAX,
+ "read_bytes", "bytes");
+ lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_WRITE_BYTES,
+ LPROCFS_CNTR_AVGMINMAX,
+ "write_bytes", "bytes");
+
+ lproc_filter_attach_seqstat(obd);
+ }
+
return rc;
}
if (filter->fo_sb == NULL)
RETURN(0);
+ lprocfs_free_obd_stats(obd);
+ lprocfs_obd_cleanup(obd);
+
filter_post(obd);
shrink_dcache_parent(filter->fo_sb->s_root);
RETURN(0);
}
-static int filter_attach(struct obd_device *obd, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
- int rc;
-
- lprocfs_init_vars(filter, &lvars);
- rc = lprocfs_obd_attach(obd, lvars.obd_vars);
- if (rc != 0)
- return rc;
-
- rc = lprocfs_alloc_obd_stats(obd, LPROC_FILTER_LAST);
- if (rc != 0)
- return rc;
-
- /* Init obdfilter private stats here */
- lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_READ_BYTES,
- LPROCFS_CNTR_AVGMINMAX, "read_bytes", "bytes");
- lprocfs_counter_init(obd->obd_stats, LPROC_FILTER_WRITE_BYTES,
- LPROCFS_CNTR_AVGMINMAX, "write_bytes", "bytes");
-
- return lproc_filter_attach_seqstat(obd);
-}
-
-static int filter_detach(struct obd_device *dev)
-{
- lprocfs_free_obd_stats(dev);
- return lprocfs_obd_detach(dev);
-}
-
/* nearly identical to mds_connect */
static int filter_connect(struct lustre_handle *conn, struct obd_device *obd,
struct obd_uuid *cluuid)
static struct obd_ops filter_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: filter_attach,
- o_detach: filter_detach,
o_get_info: filter_get_info,
o_set_info: filter_set_info,
o_setup: filter_setup,
static struct obd_ops filter_sanobd_ops = {
o_owner: THIS_MODULE,
- o_attach: filter_attach,
- o_detach: filter_detach,
o_get_info: filter_get_info,
o_set_info: filter_set_info,
o_setup: filter_san_setup,
{
struct filter_export_data *fed;
struct obd_device *obd = exp->exp_obd;
+ static unsigned long last_msg;
+ static int last_count;
+ int mask = D_CACHE;
ENTRY;
LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
fed = &exp->exp_filter_data;
+ /* Don't print this to the console the first time it happens, since
+ * it can happen legitimately on occasion, but only rarely. */
+ if (time_after(jiffies, last_msg + 60 * HZ)) {
+ last_count = 0;
+ last_msg = jiffies;
+ }
+ if ((last_count & (-last_count)) == last_count)
+ mask = D_WARNING;
+ last_count++;
+
/* Add some margin, since there is a small race if other RPCs arrive
* out-or-order and have already consumed some grant. We want to
* leave this here in case there is a large error in accounting. */
- CDEBUG(oa->o_grant > fed->fed_grant + FILTER_GRANT_CHUNK ?
- D_WARNING : D_CACHE,
+ CDEBUG(oa->o_grant > fed->fed_grant + FILTER_GRANT_CHUNK ? mask:D_CACHE,
"%s: cli %s/%p reports grant: "LPU64" dropped: %u, local: %lu\n",
obd->obd_name, exp->exp_client_uuid.uuid, exp, oa->o_grant,
oa->o_dropped, fed->fed_grant);
static struct lprocfs_vars lprocfs_module_vars[] = { {0} };
#else
+static int lprocfs_filter_rd_groups(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ *eof = 1;
+ return snprintf(page, count, "%u\n", FILTER_GROUPS);
+}
+
+static int lprocfs_filter_rd_tot_dirty(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+
+ LASSERT(obd != NULL);
+ *eof = 1;
+ return snprintf(page, count, LPU64"\n", obd->u.filter.fo_tot_dirty);
+}
+
+static int lprocfs_filter_rd_tot_granted(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+
+ LASSERT(obd != NULL);
+ *eof = 1;
+ return snprintf(page, count, LPU64"\n", obd->u.filter.fo_tot_granted);
+}
+
+static int lprocfs_filter_rd_tot_pending(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = (struct obd_device *)data;
+
+ LASSERT(obd != NULL);
+ *eof = 1;
+ return snprintf(page, count, LPU64"\n", obd->u.filter.fo_tot_pending);
+}
+
static int lprocfs_filter_rd_mntdev(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
- struct obd_device* obd = (struct obd_device *)data;
+ struct obd_device *obd = (struct obd_device *)data;
LASSERT(obd != NULL);
LASSERT(obd->u.filter.fo_vfsmnt->mnt_devname);
{ "kbytesavail", lprocfs_rd_kbytesavail, 0, 0 },
{ "filestotal", lprocfs_rd_filestotal, 0, 0 },
{ "filesfree", lprocfs_rd_filesfree, 0, 0 },
- //{ "filegroups", lprocfs_rd_filegroups, 0, 0 },
+ { "filegroups", lprocfs_filter_rd_groups, 0, 0 },
{ "fstype", lprocfs_rd_fstype, 0, 0 },
{ "mntdev", lprocfs_filter_rd_mntdev, 0, 0 },
{ "last_id", lprocfs_filter_rd_last_id,0, 0 },
+ { "tot_dirty", lprocfs_filter_rd_tot_dirty, 0, 0 },
+ { "tot_pending", lprocfs_filter_rd_tot_pending, 0, 0 },
+ { "tot_granted", lprocfs_filter_rd_tot_granted, 0, 0 },
+ { "num_exports", lprocfs_rd_num_exports, 0, 0 },
{ "readcache_max_filesize",
lprocfs_filter_rd_readcache,
lprocfs_filter_wr_readcache, 0 },
lprocfs_oh_tally(&filter->fo_w_discont_blocks, discont_blocks);
}
-void filter_tally_read(struct filter_obd *filter, struct niobuf_local *lnb,
+void filter_tally_read(struct filter_obd *filter, struct niobuf_local *lnb,
int niocount)
{
struct niobuf_local *end;
/* XXX not so smart for now */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
if ((page->buffers && last_page->buffers) &&
- (page->buffers->b_blocknr !=
+ (page->buffers->b_blocknr !=
(last_page->buffers->b_blocknr + 1)))
discont_blocks++;
#else
unsigned long w = filter->fo_w_pages.oh_buckets[i];
read_cum += r;
write_cum += w;
- seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
- 1 << i, r, pct(r, read_tot),
- pct(read_cum, read_tot), w,
+ seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
+ 1 << i, r, pct(r, read_tot),
+ pct(read_cum, read_tot), w,
pct(w, write_tot),
pct(write_cum, write_tot));
if (read_cum == read_tot && write_cum == write_tot)
unsigned long w = filter->fo_w_discont_pages.oh_buckets[i];
read_cum += r;
write_cum += w;
- seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
- i, r, pct(r, read_tot),
- pct(read_cum, read_tot), w,
+ seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
+ i, r, pct(r, read_tot),
+ pct(read_cum, read_tot), w,
pct(w, write_tot),
pct(write_cum, write_tot));
if (read_cum == read_tot && write_cum == write_tot)
unsigned long w = filter->fo_w_discont_blocks.oh_buckets[i];
read_cum += r;
write_cum += w;
- seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
- i, r, pct(r, read_tot),
- pct(read_cum, read_tot), w,
+ seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
+ i, r, pct(r, read_tot),
+ pct(read_cum, read_tot), w,
pct(w, write_tot),
pct(write_cum, write_tot));
if (read_cum == read_tot && write_cum == write_tot)
struct proc_dir_entry *dp = PDE(inode);
struct seq_file *seq;
int rc;
-
+
rc = seq_open(file, &filter_brw_stats_seq_sops);
if (rc)
return rc;
}
struct file_operations filter_brw_stats_fops = {
+ .owner = THIS_MODULE,
.open = filter_brw_stats_seq_open,
.read = seq_read,
.write = filter_brw_stats_seq_write,
int lproc_filter_attach_seqstat(struct obd_device *dev)
{
- return lprocfs_obd_seq_create(dev, "brw_stats", 0444,
+ return lprocfs_obd_seq_create(dev, "brw_stats", 0444,
&filter_brw_stats_fops, dev);
}
#endif /* LPROCFS */
-LPROCFS_INIT_VARS(filter,lprocfs_module_vars, lprocfs_obd_vars)
+LPROCFS_INIT_VARS(filter, lprocfs_module_vars, lprocfs_obd_vars)
rpcs = cli->cl_brw_in_flight;
r = cli->cl_pending_r_pages;
w = cli->cl_pending_w_pages;
-
+
seq_printf(seq, "snapshot_time: %lu:%lu (secs:usecs)\n",
now.tv_sec, now.tv_usec);
seq_printf(seq, "RPCs in flight: %d\n", rpcs);
unsigned long w = cli->cl_write_page_hist.oh_buckets[i];
read_cum += r;
write_cum += w;
- seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
- 1 << i, r, pct(r, read_tot),
- pct(read_cum, read_tot), w,
+ seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
+ 1 << i, r, pct(r, read_tot),
+ pct(read_cum, read_tot), w,
pct(w, write_tot),
pct(write_cum, write_tot));
if (read_cum == read_tot && write_cum == write_tot)
unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
read_cum += r;
write_cum += w;
- seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
- i, r, pct(r, read_tot),
- pct(read_cum, read_tot), w,
+ seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
+ i, r, pct(r, read_tot),
+ pct(read_cum, read_tot), w,
pct(w, write_tot),
pct(write_cum, write_tot));
if (read_cum == read_tot && write_cum == write_tot)
struct proc_dir_entry *dp = PDE(inode);
struct seq_file *seq;
int rc;
-
+
rc = seq_open(file, &osc_rpc_stats_seq_sops);
if (rc)
return rc;
}
struct file_operations osc_rpc_stats_fops = {
+ .owner = THIS_MODULE,
.open = osc_rpc_stats_seq_open,
.read = seq_read,
.write = osc_rpc_stats_seq_write,
int lproc_osc_attach_seqstat(struct obd_device *dev)
{
- return lprocfs_obd_seq_create(dev, "rpc_stats", 0444,
+ return lprocfs_obd_seq_create(dev, "rpc_stats", 0444,
&osc_rpc_stats_fops, dev);
}
-
#endif /* LPROCFS */
-LPROCFS_INIT_VARS(osc,lprocfs_module_vars, lprocfs_obd_vars)
+LPROCFS_INIT_VARS(osc, lprocfs_module_vars, lprocfs_obd_vars)
#include <linux/lustre_log.h>
#include "osc_internal.h"
-
-static int osc_attach(struct obd_device *dev, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
- int rc;
- ENTRY;
-
- lprocfs_init_vars(osc,&lvars);
- rc = lprocfs_obd_attach(dev, lvars.obd_vars);
- if (rc < 0)
- RETURN(rc);
-
- rc = lproc_osc_attach_seqstat(dev);
- if (rc < 0) {
- lprocfs_obd_detach(dev);
- RETURN(rc);
- }
-
- ptlrpc_lprocfs_register_obd(dev);
- RETURN(0);
-}
-
-static int osc_detach(struct obd_device *dev)
-{
- ptlrpc_lprocfs_unregister_obd(dev);
- return lprocfs_obd_detach(dev);
-}
-
-
/* Pack OSC object metadata for disk storage (LE byte order). */
static int osc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
struct lov_stripe_md *lsm)
return rc;
rc = client_obd_setup(obd, len, buf);
- if (rc)
+ if (rc) {
ptlrpcd_decref();
- else
+ } else {
+ struct lprocfs_static_vars lvars;
+
+ lprocfs_init_vars(osc, &lvars);
+ if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0) {
+ lproc_osc_attach_seqstat(obd);
+ ptlrpc_lprocfs_register_obd(obd);
+ }
+
oscc_init(obd);
+ }
RETURN(rc);
}
{
int rc;
+ ptlrpc_lprocfs_unregister_obd(obd);
+ lprocfs_obd_cleanup(obd);
+
rc = client_obd_cleanup(obd, flags);
ptlrpcd_decref();
RETURN(rc);
struct obd_ops osc_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: osc_attach,
- o_detach: osc_detach,
o_setup: osc_setup,
o_cleanup: osc_cleanup,
o_connect: osc_connect,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
struct obd_ops sanosc_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: osc_attach,
- o_detach: osc_detach,
o_cleanup: client_obd_cleanup,
o_connect: osc_connect,
o_disconnect: client_disconnect_export,
return 0;
}
-static int ost_setup(struct obd_device *obddev, obd_count len, void *buf)
+static int ost_setup(struct obd_device *obd, obd_count len, void *buf)
{
- struct ost_obd *ost = &obddev->u.ost;
+ struct ost_obd *ost = &obd->u.ost;
+ struct lprocfs_static_vars lvars;
int rc;
ENTRY;
if (rc < 0)
RETURN(rc);
- ost->ost_service =
+ ost->ost_service =
ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE,
OST_REQUEST_PORTAL, OSC_REPLY_PORTAL,
ost_handle, "ost",
- obddev->obd_proc_entry);
+ obd->obd_proc_entry);
if (ost->ost_service == NULL) {
CERROR("failed to start service\n");
RETURN(-ENOMEM);
}
-
- rc = ptlrpc_start_n_threads(obddev, ost->ost_service, OST_NUM_THREADS,
- "ll_ost");
+
+ rc = ptlrpc_start_n_threads(obd, ost->ost_service, OST_NUM_THREADS,
+ "ll_ost");
if (rc)
GOTO(out, rc = -EINVAL);
ptlrpc_init_svc(OST_NBUFS, OST_BUFSIZE, OST_MAXREQSIZE,
OST_CREATE_PORTAL, OSC_REPLY_PORTAL,
ost_handle, "ost_create",
- obddev->obd_proc_entry);
+ obd->obd_proc_entry);
if (ost->ost_create_service == NULL) {
CERROR("failed to start OST create service\n");
GOTO(out, rc = -ENOMEM);
}
- rc = ptlrpc_start_n_threads(obddev, ost->ost_create_service, 1,
+ rc = ptlrpc_start_n_threads(obd, ost->ost_create_service, 1,
"ll_ost_create");
- if (rc)
+ if (rc)
GOTO(out_create, rc = -EINVAL);
+ lprocfs_init_vars(ost, &lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
+
RETURN(0);
out_create:
RETURN(rc);
}
-static int ost_cleanup(struct obd_device *obddev, int flags)
+static int ost_cleanup(struct obd_device *obd, int flags)
{
- struct ost_obd *ost = &obddev->u.ost;
+ struct ost_obd *ost = &obd->u.ost;
int err = 0;
ENTRY;
- spin_lock_bh(&obddev->obd_processing_task_lock);
- if (obddev->obd_recovering) {
- target_cancel_recovery_timer(obddev);
- obddev->obd_recovering = 0;
+ lprocfs_obd_cleanup(obd);
+
+ spin_lock_bh(&obd->obd_processing_task_lock);
+ if (obd->obd_recovering) {
+ target_cancel_recovery_timer(obd);
+ obd->obd_recovering = 0;
}
- spin_unlock_bh(&obddev->obd_processing_task_lock);
+ spin_unlock_bh(&obd->obd_processing_task_lock);
ptlrpc_stop_all_threads(ost->ost_service);
ptlrpc_unregister_service(ost->ost_service);
RETURN(err);
}
-int ost_attach(struct obd_device *dev, obd_count len, void *data)
-{
- struct lprocfs_static_vars lvars;
-
- lprocfs_init_vars(ost,&lvars);
- return lprocfs_obd_attach(dev, lvars.obd_vars);
-}
-
-int ost_detach(struct obd_device *dev)
-{
- return lprocfs_obd_detach(dev);
-}
-
/* use obd ops to offer management infrastructure */
static struct obd_ops ost_obd_ops = {
o_owner: THIS_MODULE,
- o_attach: ost_attach,
- o_detach: ost_detach,
o_setup: ost_setup,
o_cleanup: ost_cleanup,
};
static int ptlbd_cl_setup(struct obd_device *obd, obd_count len, void *buf)
{
struct ptlbd_obd *ptlbd = &obd->u.ptlbd;
+ struct lprocfs_static_vars lvars;
struct obd_import *imp;
struct lustre_cfg* lcfg = buf;
ENTRY;
}
imp->imp_state = LUSTRE_IMP_FULL;
- ptlrpc_init_client(PTLBD_REQUEST_PORTAL, PTLBD_REPLY_PORTAL,
+ ptlrpc_init_client(PTLBD_REQUEST_PORTAL, PTLBD_REPLY_PORTAL,
"ptlbd", &ptlbd->bd_client);
imp->imp_client = &ptlbd->bd_client;
imp->imp_obd = obd;
- memcpy(imp->imp_target_uuid.uuid, lcfg->lcfg_inlbuf1,
+ memcpy(imp->imp_target_uuid.uuid, lcfg->lcfg_inlbuf1,
lcfg->lcfg_inllen1);
ptlbd_blk_register(ptlbd);
+ lprocfs_init_vars(ptlbd_cl, &lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
+
RETURN(0);
}
if (!imp->imp_connection)
RETURN(-ENOENT);
+ lprocfs_obd_cleanup(obd);
+
ptlrpc_cleanup_client(imp);
ptlrpc_put_connection(imp->imp_connection);
int rc, size[] = {sizeof(imp->imp_target_uuid),
sizeof(obd->obd_uuid),
sizeof(*conn)};
- char *tmp[] = {imp->imp_target_uuid.uuid,
+ char *tmp[] = {imp->imp_target_uuid.uuid,
obd->obd_uuid.uuid,
(char*)conn};
ENTRY;
imp->imp_state = LUSTRE_IMP_FULL;
imp->imp_remote_handle = request->rq_repmsg->handle;
-
+
out_req:
ptlrpc_req_finished(request);
out_disco:
static int ptlbd_sv_already_setup = 1;
-static int ptlbd_sv_setup(struct obd_device *obddev, obd_count len, void *buf)
+static int ptlbd_sv_setup(struct obd_device *obd, obd_count len, void *buf)
{
- struct ptlbd_obd *ptlbd = &obddev->u.ptlbd;
+ struct ptlbd_obd *ptlbd = &obd->u.ptlbd;
+ struct lprocfs_static_vars lvars;
int rc;
ENTRY;
ptlrpc_init_svc(PTLBD_NBUFS, PTLBD_BUFSIZE, PTLBD_MAXREQSIZE,
PTLBD_REQUEST_PORTAL, PTLBD_REPLY_PORTAL,
ptlbd_handle, "ptlbd_sv",
- obddev->obd_proc_entry);
+ obd->obd_proc_entry);
- if (ptlbd->ptlbd_service == NULL)
+ if (ptlbd->ptlbd_service == NULL)
GOTO(out_filp, rc = -ENOMEM);
- rc = ptlrpc_start_n_threads(obddev, ptlbd->ptlbd_service, 1, "ptldb");
- if (rc != 0)
+ rc = ptlrpc_start_n_threads(obd, ptlbd->ptlbd_service, 1, "ptldb");
+ if (rc != 0)
GOTO(out_thread, rc);
ptlbd_sv_already_setup = 1;
+ lprocfs_init_vars(ptlbd_sv, &lvars);
+ lprocfs_obd_setup(obd, lvars.obd_vars);
+
RETURN(0);
out_thread:
RETURN(rc);
}
-static int ptlbd_sv_cleanup(struct obd_device *obddev, int flags)
+static int ptlbd_sv_cleanup(struct obd_device *obd, int flags)
{
- struct ptlbd_obd *ptlbd = &obddev->u.ptlbd;
+ struct ptlbd_obd *ptlbd = &obd->u.ptlbd;
ENTRY;
/* XXX check for state */
+ lprocfs_obd_cleanup(obd);
+
ptlrpc_stop_all_threads(ptlbd->ptlbd_service);
ptlrpc_unregister_service(ptlbd->ptlbd_service);
if ( ! IS_ERR(ptlbd->filp) )