-#ifndef HAVE_ONLY_PROCFS_SEQ
-int lprocfs_obd_rd_hash(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- struct obd_device *obd = data;
- int c = 0;
-
- if (obd == NULL)
- return 0;
-
- c += cfs_hash_debug_header(page, count);
- c += cfs_hash_debug_str(obd->obd_uuid_hash, page + c, count - c);
- c += cfs_hash_debug_str(obd->obd_nid_hash, page + c, count - c);
- c += cfs_hash_debug_str(obd->obd_nid_stats_hash, page+c, count-c);
-
- return c;
-}
-EXPORT_SYMBOL(lprocfs_obd_rd_hash);
-
-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, size;
-
- LASSERT(obd != NULL);
- LASSERT(count >= 0);
-
- /* Set start of user data returned to
- page + off since the user may have
- requested to read much smaller than
- what we need to read */
- *start = page + off;
-
- /*
- * We know we are allocated a page here.
- * Also we know that this function will
- * not need to write more than a page
- * so we can truncate at PAGE_CACHE_SIZE.
- */
- size = min(count + (int)off + 1, (int)PAGE_CACHE_SIZE);
-
- /* Initialize the page */
- memset(page, 0, size);
-
- if (lprocfs_obd_snprintf(&page, size, &len, "status: ") <= 0)
- goto out;
- if (obd->obd_max_recoverable_clients == 0) {
- if (lprocfs_obd_snprintf(&page, size, &len, "INACTIVE\n") <= 0)
- goto out;
-
- goto fclose;
- }
-
- /* sampled unlocked, but really... */
- if (obd->obd_recovering == 0) {
- if (lprocfs_obd_snprintf(&page, size, &len, "COMPLETE\n") <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len,
- "recovery_start: %lu\n",
- obd->obd_recovery_start) <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len,
- "recovery_duration: %lu\n",
- obd->obd_recovery_end -
- obd->obd_recovery_start) <= 0)
- goto out;
- /* Number of clients that have completed recovery */
- if (lprocfs_obd_snprintf(&page, size, &len,
- "completed_clients: %d/%d\n",
- obd->obd_max_recoverable_clients -
- obd->obd_stale_clients,
- obd->obd_max_recoverable_clients) <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len,
- "replayed_requests: %d\n",
- obd->obd_replayed_requests) <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len,
- "last_transno: "LPD64"\n",
- obd->obd_next_recovery_transno - 1) <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len, "VBR: %s\n",
- obd->obd_version_recov ?
- "ENABLED" : "DISABLED") <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len, "IR: %s\n",
- obd->obd_no_ir ?
- "DISABLED" : "ENABLED") <= 0)
- goto out;
- goto fclose;
- }
-
- if (lprocfs_obd_snprintf(&page, size, &len, "RECOVERING\n") <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len, "recovery_start: %lu\n",
- obd->obd_recovery_start) <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len, "time_remaining: %lu\n",
- cfs_time_current_sec() >=
- obd->obd_recovery_start +
- obd->obd_recovery_timeout ? 0 :
- obd->obd_recovery_start +
- obd->obd_recovery_timeout -
- cfs_time_current_sec()) <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len,
- "connected_clients: %d/%d\n",
- atomic_read(&obd->obd_connected_clients),
- obd->obd_max_recoverable_clients) <= 0)
- goto out;
- /* Number of clients that have completed recovery */
- if (lprocfs_obd_snprintf(&page, size, &len, "req_replay_clients: %d\n",
- atomic_read(&obd->obd_req_replay_clients))
- <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len, "lock_repay_clients: %d\n",
- atomic_read(&obd->obd_lock_replay_clients))
- <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len, "completed_clients: %d\n",
- atomic_read(&obd->obd_connected_clients) -
- atomic_read(&obd->obd_lock_replay_clients))
- <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len, "evicted_clients: %d\n",
- obd->obd_stale_clients) <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len, "replayed_requests: %d\n",
- obd->obd_replayed_requests) <= 0)
- goto out;
- if (lprocfs_obd_snprintf(&page, size, &len, "queued_requests: %d\n",
- obd->obd_requests_queued_for_recovery) <= 0)
- goto out;
-
- if (lprocfs_obd_snprintf(&page, size, &len, "next_transno: "LPD64"\n",
- obd->obd_next_recovery_transno) <= 0)
- goto out;
-
-fclose:
- *eof = 1;
-out:
- return min(count, len - (int)off);
-}
-EXPORT_SYMBOL(lprocfs_obd_rd_recovery_status);
-
-int lprocfs_obd_rd_ir_factor(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- struct obd_device *obd = (struct obd_device *)data;
- LASSERT(obd != NULL);
-
- return snprintf(page, count, "%d\n",
- obd->obd_recovery_ir_factor);
-}
-EXPORT_SYMBOL(lprocfs_obd_rd_ir_factor);
-
-int lprocfs_obd_wr_ir_factor(struct file *file, const char *buffer,
- unsigned long count, void *data)
-{
- struct obd_device *obd = (struct obd_device *)data;
- int val, rc;
- LASSERT(obd != NULL);
-
- rc = lprocfs_write_helper(buffer, count, &val);
- if (rc)
- return rc;
-
- if (val < OBD_IR_FACTOR_MIN || val > OBD_IR_FACTOR_MAX)
- return -EINVAL;
-
- obd->obd_recovery_ir_factor = val;
- return count;
-}
-EXPORT_SYMBOL(lprocfs_obd_wr_ir_factor);
-
-int lprocfs_obd_rd_recovery_time_soft(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- struct obd_device *obd = (struct obd_device *)data;
- LASSERT(obd != NULL);
-
- return snprintf(page, count, "%d\n",
- obd->obd_recovery_timeout);
-}
-EXPORT_SYMBOL(lprocfs_obd_rd_recovery_time_soft);
-
-int lprocfs_obd_wr_recovery_time_soft(struct file *file, const char *buffer,
- unsigned long count, void *data)
-{
- struct obd_device *obd = (struct obd_device *)data;
- int val, rc;
- LASSERT(obd != NULL);
-
- rc = lprocfs_write_helper(buffer, count, &val);
- if (rc)
- return rc;
-
- obd->obd_recovery_timeout = val;
- return count;
-}
-EXPORT_SYMBOL(lprocfs_obd_wr_recovery_time_soft);
-
-int lprocfs_obd_rd_recovery_time_hard(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- struct obd_device *obd = data;
- LASSERT(obd != NULL);
-
- return snprintf(page, count, "%u\n", obd->obd_recovery_time_hard);
-}
-EXPORT_SYMBOL(lprocfs_obd_rd_recovery_time_hard);
-
-int lprocfs_obd_wr_recovery_time_hard(struct file *file, const char *buffer,
- unsigned long count, void *data)
-{
- struct obd_device *obd = data;
- int val, rc;
- LASSERT(obd != NULL);
-
- rc = lprocfs_write_helper(buffer, count, &val);
- if (rc)
- return rc;
-
- obd->obd_recovery_time_hard = val;
- return count;
-}
-EXPORT_SYMBOL(lprocfs_obd_wr_recovery_time_hard);
-
-int lprocfs_target_rd_instance(char *page, char **start, off_t off,
- int count, int *eof, void *data)
-{
- struct obd_device *obd = (struct obd_device *)data;
- struct obd_device_target *target = &obd->u.obt;
-
- LASSERT(obd != NULL);
- LASSERT(target->obt_magic == OBT_MAGIC);
- *eof = 1;
- return snprintf(page, count, "%u\n", obd->u.obt.obt_instance);
-}
-EXPORT_SYMBOL(lprocfs_target_rd_instance);
-#endif /* HAVE_ONLY_PROCFS_SEQ */
-#endif /* LPROCFS*/