lprocfs_status.c
来自「lustre 1.6.5 source code」· C语言 代码 · 共 1,933 行 · 第 1/5 页
C
1,933 行
EXPORT_SYMBOL(lprocfs_seq_create);__inline__ int lprocfs_obd_seq_create(struct obd_device *dev, char *name, mode_t mode, struct file_operations *seq_fops, void *data){ return (lprocfs_seq_create(dev->obd_proc_entry, name, mode, seq_fops, data));}EXPORT_SYMBOL(lprocfs_obd_seq_create);void lprocfs_oh_tally(struct obd_histogram *oh, unsigned int value){ if (value >= OBD_HIST_MAX) value = OBD_HIST_MAX - 1; spin_lock(&oh->oh_lock); oh->oh_buckets[value]++; spin_unlock(&oh->oh_lock);}EXPORT_SYMBOL(lprocfs_oh_tally);void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value){ unsigned int val; for (val = 0; ((1 << val) < value) && (val <= OBD_HIST_MAX); val++) ; lprocfs_oh_tally(oh, val);}EXPORT_SYMBOL(lprocfs_oh_tally_log2);unsigned long lprocfs_oh_sum(struct obd_histogram *oh){ unsigned long ret = 0; int i; for (i = 0; i < OBD_HIST_MAX; i++) ret += oh->oh_buckets[i]; return ret;}EXPORT_SYMBOL(lprocfs_oh_sum);void lprocfs_oh_clear(struct obd_histogram *oh){ spin_lock(&oh->oh_lock); memset(oh->oh_buckets, 0, sizeof(oh->oh_buckets)); spin_unlock(&oh->oh_lock);}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, 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 CFS_PAGE_SIZE. */ size = min(count + (int)off + 1, (int)CFS_PAGE_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_recoverable_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; 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_end ? 0 : obd->obd_recovery_end - cfs_time_current_sec()) <= 0) goto out; if (lprocfs_obd_snprintf(&page, size, &len,"connected_clients: %d/%d\n", 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,"completed_clients: %d/%d\n", obd->obd_max_recoverable_clients - obd->obd_recoverable_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, "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);#ifdef CRAY_XT3int lprocfs_obd_rd_recovery_maxtime(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, "%lu\n", obd->obd_recovery_max_time);}EXPORT_SYMBOL(lprocfs_obd_rd_recovery_maxtime);int lprocfs_obd_wr_recovery_maxtime(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_max_time = val; return count;}EXPORT_SYMBOL(lprocfs_obd_wr_recovery_maxtime);#endif /* CRAY_XT3 */#ifdef HAVE_QUOTA_SUPPORTint lprocfs_quota_rd_bunit(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, "%lu\n", obd->u.obt.obt_qctxt.lqc_bunit_sz);}EXPORT_SYMBOL(lprocfs_quota_rd_bunit);int lprocfs_quota_wr_bunit(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 % QUOTABLOCK_SIZE || val <= obd->u.obt.obt_qctxt.lqc_btune_sz) return -EINVAL; obd->u.obt.obt_qctxt.lqc_bunit_sz = val; return count;}EXPORT_SYMBOL(lprocfs_quota_wr_bunit);int lprocfs_quota_rd_btune(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, "%lu\n", obd->u.obt.obt_qctxt.lqc_btune_sz);}EXPORT_SYMBOL(lprocfs_quota_rd_btune);int lprocfs_quota_wr_btune(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 <= QUOTABLOCK_SIZE * MIN_QLIMIT || val % QUOTABLOCK_SIZE || val >= obd->u.obt.obt_qctxt.lqc_bunit_sz) return -EINVAL; obd->u.obt.obt_qctxt.lqc_btune_sz = val; return count;}EXPORT_SYMBOL(lprocfs_quota_wr_btune);int lprocfs_quota_rd_iunit(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, "%lu\n", obd->u.obt.obt_qctxt.lqc_iunit_sz);}EXPORT_SYMBOL(lprocfs_quota_rd_iunit);int lprocfs_quota_wr_iunit(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->u.obt.obt_qctxt.lqc_itune_sz) return -EINVAL; obd->u.obt.obt_qctxt.lqc_iunit_sz = val; return count;}EXPORT_SYMBOL(lprocfs_quota_wr_iunit);int lprocfs_quota_rd_itune(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, "%lu\n", obd->u.obt.obt_qctxt.lqc_itune_sz);}EXPORT_SYMBOL(lprocfs_quota_rd_itune);int lprocfs_quota_wr_itune(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 <= MIN_QLIMIT || val >= obd->u.obt.obt_qctxt.lqc_iunit_sz) return -EINVAL; obd->u.obt.obt_qctxt.lqc_itune_sz = val; return count;}EXPORT_SYMBOL(lprocfs_quota_wr_itune);int lprocfs_quota_rd_switch_seconds(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->u.obt.obt_qctxt.lqc_switch_seconds);}EXPORT_SYMBOL(lprocfs_quota_rd_switch_seconds);int lprocfs_quota_wr_switch_seconds(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 <= 10) return -EINVAL; obd->u.obt.obt_qctxt.lqc_switch_seconds = val; return count;}EXPORT_SYMBOL(lprocfs_quota_wr_switch_seconds);#endifEXPORT_SYMBOL(lprocfs_register);EXPORT_SYMBOL(lprocfs_srch);EXPORT_SYMBOL(lprocfs_remove);EXPORT_SYMBOL(lprocfs_add_vars);EXPORT_SYMBOL(lprocfs_obd_setup);EXPORT_SYMBOL(lprocfs_obd_cleanup);EXPORT_SYMBOL(lprocfs_add_simple);EXPORT_SYMBOL(lprocfs_free_per_client_stats);EXPORT_SYMBOL(lprocfs_alloc_stats);EXPORT_SYMBOL(lprocfs_free_stats);EXPORT_SYMBOL(lprocfs_clear_stats);EXPORT_SYMBOL(lprocfs_register_stats);EXPORT_SYMBOL(lprocfs_init_ops_stats);EXPORT_SYMBOL(lprocfs_alloc_obd_stats);EXPORT_SYMBOL(lprocfs_free_obd_stats);EXPORT_SYMBOL(lprocfs_exp_setup);EXPORT_SYMBOL(lprocfs_exp_cleanup);EXPORT_SYMBOL(lprocfs_rd_u64);EXPORT_SYMBOL(lprocfs_rd_atomic);EXPORT_SYMBOL(lprocfs_wr_atomic);EXPORT_SYMBOL(lprocfs_rd_uint);EXPORT_SYMBOL(lprocfs_wr_uint);EXPORT_SYMBOL(lprocfs_rd_uuid);EXPORT_SYMBOL(lprocfs_rd_name);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_at_hist_helper);EXPORT_SYMBOL(lprocfs_rd_timeouts);EXPORT_SYMBOL(lprocfs_rd_blksize);EXPORT_SYMBOL(lprocfs_rd_kbytestotal);EXPORT_SYMBOL(lprocfs_rd_kbytesfree);EXPORT_SYMBOL(lprocfs_rd_kbytesavail);EXPORT_SYMBOL(lprocfs_rd_filestotal);EXPORT_SYMBOL(lprocfs_rd_filesfree);EXPORT_SYMBOL(lprocfs_write_helper);EXPORT_SYMBOL(lprocfs_write_frac_helper);EXPORT_SYMBOL(lprocfs_read_frac_helper);EXPORT_SYMBOL(lprocfs_write_u64_helper);EXPORT_SYMBOL(lprocfs_write_frac_u64_helper);#endif /* LPROCFS*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?