LASSERT(root != NULL);
parent = root->parent;
LASSERT(parent != NULL);
-
+
while (1) {
while (temp->subdir != NULL)
temp = temp->subdir;
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 = {
- open: lprocfs_stats_seq_open,
- read: seq_read,
- llseek: seq_lseek,
- release: seq_release,
+ .owner = THIS_MODULE,
+ .open = lprocfs_stats_seq_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
};
int lprocfs_register_stats(struct proc_dir_entry *root, const char *name,
LPROCFS_OBD_OP_INIT(num_private_stats, stats, san_preprw);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, init_export);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, destroy_export);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, llog_init);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, llog_finish);
- LPROCFS_OBD_OP_INIT(num_private_stats, stats, pin);
+ LPROCFS_OBD_OP_INIT(num_private_stats, stats, llog_init);
+ LPROCFS_OBD_OP_INIT(num_private_stats, stats, llog_finish);
+ LPROCFS_OBD_OP_INIT(num_private_stats, stats, pin);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, unpin);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, import_event);
LPROCFS_OBD_OP_INIT(num_private_stats, stats, notify);
-
+
for (i = num_private_stats; i < num_stats; i++) {
/* If this LBUGs, it is likely that an obd
* operation was added to struct obd_ops in
return 0;
}
-int lprocfs_write_u64_helper(const char *buffer, unsigned long count,
- __u64 *val)
+int lprocfs_write_u64_helper(const char *buffer, unsigned long count,__u64 *val)
{
char kernbuf[22], *end;
kernbuf[count] = '\0';
- *val = simple_strtoull(kernbuf, &end, 0);
+ if (kernbuf[0] == '-')
+ *val = -simple_strtoull(kernbuf + 1, &end, 0);
+ else
+ *val = simple_strtoull(kernbuf, &end, 0);
if (kernbuf == end)
return -EINVAL;
}
EXPORT_SYMBOL(lprocfs_oh_clear);
+int lprocfs_obd_rd_recovery_status(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ struct obd_device *obd = data;
+ int len = 0, n,
+ connected = obd->obd_connected_clients,
+ max_recoverable = obd->obd_max_recoverable_clients,
+ recoverable = obd->obd_recoverable_clients,
+ completed = max_recoverable - recoverable,
+ queue_len = obd->obd_requests_queued_for_recovery,
+ replayed = obd->obd_replayed_requests;
+ __u64 next_transno = obd->obd_next_recovery_transno;
+
+ LASSERT(obd != NULL);
+ *eof = 1;
+
+ n = snprintf(page, count, "status: ");
+ page += n; len += n; count -= n;
+ if (obd->obd_max_recoverable_clients == 0) {
+ n = snprintf(page, count, "INACTIVE\n");
+ return len + n;
+ }
+
+ /* sampled unlocked, but really... */
+ if (obd->obd_recovering == 0) {
+ n = snprintf(page, count, "COMPLETE\n");
+ page += n; len += n; count -= n;
+
+ n = snprintf(page, count, "recovery_start: %lu\n",
+ obd->obd_recovery_start);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "recovery_end: %lu\n",
+ obd->obd_recovery_end);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "recovered_clients: %d\n",
+ completed);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "unrecovered_clients: %d\n",
+ obd->obd_recoverable_clients);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "last_transno: "LPD64"\n",
+ next_transno - 1);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "replayed_requests: %d\n", replayed);
+ return len + n;
+ }
+
+ n = snprintf(page, count, "RECOVERING\n");
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "recovery_start: %lu\n",
+ obd->obd_recovery_start);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "connected_clients: %d/%d\n",
+ connected, max_recoverable);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "completed_clients: %d/%d\n",
+ completed, max_recoverable);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "replayed_requests: %d/??\n", replayed);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "queued_requests: %d\n", queue_len);
+ page += n; len += n; count -= n;
+ n = snprintf(page, count, "next_transno: "LPD64"\n", next_transno);
+ return len + n;
+}
+EXPORT_SYMBOL(lprocfs_obd_rd_recovery_status);
+
#endif /* LPROCFS*/
EXPORT_SYMBOL(lprocfs_register);
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);