[Ocfs2-commits] rev 770 - in trunk/src: . inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Mar 11 15:24:19 CST 2004
Author: smushran
Date: 2004-03-11 15:24:18 -0600 (Thu, 11 Mar 2004)
New Revision: 770
Modified:
trunk/src/dlm.c
trunk/src/inc/ocfs.h
trunk/src/nm.c
trunk/src/osb.c
trunk/src/proc.c
trunk/src/ver.c
Log:
lockstat, device, nodes added to the proc interface
Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c 2004-03-10 18:26:08 UTC (rev 769)
+++ trunk/src/dlm.c 2004-03-11 21:24:18 UTC (rev 770)
@@ -696,6 +696,11 @@
status = -EAGAIN;
bail:
+ ocfs_compute_dlm_stats ((timewaited >= time_to_wait ? -ETIMEDOUT : 0),
+ status, &(OcfsGlobalCtxt.dsk_reqst_stats));
+ ocfs_compute_dlm_stats ((timewaited >= time_to_wait ? -ETIMEDOUT : 0),
+ status, &(osb->dsk_reqst_stats));
+
LOG_EXIT_STATUS (status);
return status;
} /* ocfs_wait_for_vote */
@@ -805,6 +810,12 @@
OCFS_DLM_NET_TIMEOUT);
atomic_set (&lockres->voted_event_woken, 0);
+ ocfs_compute_dlm_stats (status, lockres->vote_status,
+ &(OcfsGlobalCtxt.net_reqst_stats));
+
+ ocfs_compute_dlm_stats (status, lockres->vote_status,
+ &(osb->net_reqst_stats));
+
finally:
ocfs_safefree (dlm_msg);
LOG_EXIT_STATUS (status);
Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h 2004-03-10 18:26:08 UTC (rev 769)
+++ trunk/src/inc/ocfs.h 2004-03-11 21:24:18 UTC (rev 770)
@@ -1950,6 +1950,18 @@
struct list_head c_list;
} ocfs_commit_task;
+typedef struct _ocfs_dlm_stats
+{
+ atomic_t total;
+ atomic_t okay;
+ atomic_t etimedout;
+ atomic_t efail;
+ atomic_t eagain;
+ atomic_t enoent;
+ atomic_t def;
+}
+ocfs_dlm_stats;
+
/*
* ocfs_super
*
@@ -1973,6 +1985,7 @@
ocfs_inode *oin_root_dir; /* ptr to the root dir ocfs_inode */
ocfs_vol_layout vol_layout;
ocfs_vol_node_map vol_node_map;
+ struct semaphore cfg_lock;
ocfs_node_config_info *node_cfg_info[OCFS_MAXIMUM_NODES];
__u64 cfg_seq_num;
bool cfg_initialized;
@@ -2043,6 +2056,11 @@
ocfs_inode_hash inode_hash;
struct semaphore extend_sem;
__u8 check_mounted; /* tell nm to check mounted flag, protected by publish_lock*/
+ ocfs_dlm_stats net_reqst_stats; /* stats of netdlm vote requests */
+ ocfs_dlm_stats net_reply_stats; /* stats of netdlm vote reponses */
+ ocfs_dlm_stats dsk_reqst_stats; /* stats of diskdlm vote requests */
+ ocfs_dlm_stats dsk_reply_stats; /* stats of diskdlm vote reponses */
+ char dev_str[20]; /* "major,minor" of the device */
};
typedef struct _ocfs_comm_info
@@ -2085,6 +2103,10 @@
int bh_sem_hash_sz;
atomic_t bh_sem_hash_target_bucket;
atomic_t bh_sem_hash_num_iters;
+ ocfs_dlm_stats net_reqst_stats; /* stats of netdlm vote requests */
+ ocfs_dlm_stats net_reply_stats; /* stats of netdlm vote reponses */
+ ocfs_dlm_stats dsk_reqst_stats; /* stats of diskdlm vote requests */
+ ocfs_dlm_stats dsk_reply_stats; /* stats of diskdlm vote reponses */
}
ocfs_global_ctxt;
@@ -2660,6 +2682,38 @@
#endif /* !USERSPACE_TOOL */
+#define ocfs_compute_dlm_stats(__status, __vote_status, __stats) \
+do { \
+ atomic_inc (&((__stats)->total)); \
+ if (__status == -ETIMEDOUT) \
+ atomic_inc (&((__stats)->etimedout)); \
+ else { \
+ switch (__vote_status) { \
+ case -EAGAIN: \
+ case FLAG_VOTE_UPDATE_RETRY: \
+ atomic_inc (&((__stats)->eagain)); \
+ break; \
+ case -ENOENT: \
+ case FLAG_VOTE_FILE_DEL: \
+ atomic_inc (&((__stats)->enoent)); \
+ break; \
+ case -EBUSY: \
+ case -EFAIL: \
+ case FLAG_VOTE_OIN_ALREADY_INUSE: \
+ atomic_inc (&((__stats)->efail)); \
+ break; \
+ case 0: \
+ case FLAG_VOTE_NODE: \
+ case FLAG_VOTE_OIN_UPDATED: \
+ atomic_inc (&((__stats)->okay)); \
+ break; \
+ default: \
+ atomic_inc (&((__stats)->def)); \
+ break; \
+ } \
+ } \
+} while (0)
+
#include "io.h"
#define OCFS_FE_CACHE_FLAGS(__osb, __fe) \
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-03-10 18:26:08 UTC (rev 769)
+++ trunk/src/nm.c 2004-03-11 21:24:18 UTC (rev 770)
@@ -317,7 +317,9 @@
if ((osb->cfg_seq_num != cfg_seq_num) ||
(osb->num_cfg_nodes != num_nodes)) {
+ down (&(osb->cfg_lock));
status = ocfs_chk_update_config (osb);
+ up (&(osb->cfg_lock));
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -1261,6 +1263,19 @@
}
if (status < 0)
LOG_ERROR_STATUS (status);
+ else {
+ if (disk_vote) {
+ ocfs_compute_dlm_stats (0, vote_response,
+ &(OcfsGlobalCtxt.dsk_reply_stats));
+ ocfs_compute_dlm_stats (0, vote_response,
+ &(osb->dsk_reply_stats));
+ } else {
+ ocfs_compute_dlm_stats (0, vote_response,
+ &(OcfsGlobalCtxt.net_reply_stats));
+ ocfs_compute_dlm_stats (0, vote_response,
+ &(osb->net_reply_stats));
+ }
+ }
if (lockres) {
ocfs_release_lockres (lockres);
Modified: trunk/src/osb.c
===================================================================
--- trunk/src/osb.c 2004-03-10 18:26:08 UTC (rev 769)
+++ trunk/src/osb.c 2004-03-11 21:24:18 UTC (rev 770)
@@ -61,6 +61,9 @@
osb->obj_id.size = sizeof (ocfs_super);
INIT_LIST_HEAD (&(osb->osb_next));
+ snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
+ MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
+
#define HASHBITS 12
if (!ocfs_hash_create (&(osb->root_sect_node), HASHBITS)) {
@@ -79,6 +82,7 @@
init_MUTEX (&(osb->comm_lock));
init_MUTEX (&(osb->trans_lock));
init_MUTEX (&(osb->extend_sem));
+ init_MUTEX (&(osb->cfg_lock));
spin_lock_init(&osb->recovery_map_lock);
osb->recovery_map = 0;
Modified: trunk/src/proc.c
===================================================================
--- trunk/src/proc.c 2004-03-10 18:26:08 UTC (rev 769)
+++ trunk/src/proc.c 2004-03-11 21:24:18 UTC (rev 770)
@@ -27,6 +27,7 @@
#define OCFSPROC_PRIVATE_DECLS
#include "inc/ocfs.h"
+extern __u32 comm_voting;
/* Tracing */
@@ -35,13 +36,15 @@
static int ocfs_proc_globalctxt(char *page, char **start, off_t off, int count, int *eof, void *data);
+static int ocfs_proc_dlm_stats(char *page, char **start, off_t off, int count, int *eof, void *data);
static int ocfs_proc_version (char *page, char **start, off_t off, int count, int *eof, void *data);
static int ocfs_proc_nodename (char *page, char **start, off_t off, int count, int *eof, void *data);
static int ocfs_proc_mountpoint (char *page, char **start, off_t off, int count, int *eof, void *data);
static int ocfs_proc_statistics (char *page, char **start, off_t off, int count, int *eof, void *data);
static int ocfs_proc_hash_stats (char *page, char **start, off_t off, int count, int *eof, void *data);
+static int ocfs_proc_device (char *page, char **start, off_t off, int count, int *eof, void *data);
+static int ocfs_proc_nodes (char *page, char **start, off_t off, int count, int *eof, void *data);
-
/*
* ocfs_proc_init()
*
@@ -59,6 +62,7 @@
{ "ocfs2/version", NULL, ocfs_proc_version },
{ "ocfs2/nodename", NULL, ocfs_proc_nodename },
{ "ocfs2/globalctxt", NULL, ocfs_proc_globalctxt },
+ { "ocfs2/lockstat", NULL, ocfs_proc_dlm_stats },
#ifdef OCFS_LINUX_MEM_DEBUG
{ "ocfs2/memallocs", NULL, ocfs_proc_memallocs },
#endif
@@ -87,7 +91,11 @@
remove_proc_entry ("ocfs2/version", NULL);
remove_proc_entry ("ocfs2/nodename", NULL);
+ remove_proc_entry ("ocfs2/globalctxt", NULL);
+ remove_proc_entry ("ocfs2/lockstat", NULL);
+#ifdef OCFS_LINUX_MEM_DEBUG
remove_proc_entry ("ocfs2/memallocs", NULL);
+#endif
remove_proc_entry ("ocfs2", NULL);
LOG_EXIT ();
@@ -224,13 +232,22 @@
static int ocfs_proc_globalctxt(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
- int len;
+ int len = 0;
int ret;
LOG_ENTRY ();
- sprintf (page, "lockres count: %d\n", atomic_read (&OcfsGlobalCtxt.cnt_lockres));
- len = strlen (page);
+ len += sprintf (page, "lockres count: %d\n",
+ atomic_read (&OcfsGlobalCtxt.cnt_lockres));
+ len += sprintf (page + len, "comm voting : %d\n", comm_voting);
+ len += sprintf (page + len, "ip addr/port : %s/%d\n",
+ OcfsGlobalCtxt.comm_info.ip_addr,
+ OcfsGlobalCtxt.comm_info.ip_port);
+ len += sprintf (page + len, "guid : ");
+ strncat (page + len, OcfsGlobalCtxt.guid.guid, GUID_LEN);
+ len += GUID_LEN;
+ strncat (page + len, "\n", 1);
+ len++;
ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
@@ -238,7 +255,72 @@
return ret;
} /* ocfs_proc_version */
+/*
+ * ocfs_proc_dlm_stats()
+ *
+ */
+static int ocfs_proc_dlm_stats(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ int len;
+ int ret;
+ ocfs_super *osb;
+ ocfs_dlm_stats *nrq;
+ ocfs_dlm_stats *nrp;
+ ocfs_dlm_stats *drq;
+ ocfs_dlm_stats *drp;
+ LOG_ENTRY ();
+
+#define DLM_STATS_HDR "%-25s %10s %10s %10s %10s %10s %10s %10s\n"
+#define DLM_STATS "%-25s %10d %10d %10d %10d %10d %10d %10d\n"
+
+ osb = (ocfs_super *) data;
+ if (osb) {
+ nrq = &(osb->net_reqst_stats);
+ nrp = &(osb->net_reply_stats);
+ drq = &(osb->dsk_reqst_stats);
+ drp = &(osb->dsk_reply_stats);
+ } else {
+ nrq = &(OcfsGlobalCtxt.net_reqst_stats);
+ nrp = &(OcfsGlobalCtxt.net_reply_stats);
+ drq = &(OcfsGlobalCtxt.dsk_reqst_stats);
+ drp = &(OcfsGlobalCtxt.dsk_reply_stats);
+ }
+
+ len = sprintf (page, DLM_STATS_HDR, " ", "total", "okay", "etimedout",
+ "eagain", "efail", "enoent", "others");
+
+ len += sprintf (page + len, DLM_STATS, "netdlm vote requests",
+ atomic_read (&nrq->total), atomic_read (&nrq->okay),
+ atomic_read (&nrq->etimedout), atomic_read (&nrq->eagain),
+ atomic_read (&nrq->efail), atomic_read (&nrq->enoent),
+ atomic_read (&nrq->def));
+
+ len += sprintf (page + len, DLM_STATS, "netdlm vote responses",
+ atomic_read (&nrp->total), atomic_read (&nrp->okay),
+ atomic_read (&nrp->etimedout), atomic_read (&nrp->eagain),
+ atomic_read (&nrp->efail), atomic_read (&nrp->enoent),
+ atomic_read (&nrp->def));
+
+ len += sprintf (page + len, DLM_STATS, "diskdlm vote requests",
+ atomic_read (&drq->total), atomic_read (&drq->okay),
+ atomic_read (&drq->etimedout), atomic_read (&drq->eagain),
+ atomic_read (&drq->efail), atomic_read (&drq->enoent),
+ atomic_read (&drq->def));
+
+ len += sprintf (page + len, DLM_STATS, "diskdlm vote responses",
+ atomic_read (&drp->total), atomic_read (&drp->okay),
+ atomic_read (&drp->etimedout), atomic_read (&drp->eagain),
+ atomic_read (&drp->efail), atomic_read (&drp->enoent),
+ atomic_read (&drp->def));
+
+ ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
+
+ LOG_EXIT_LONG (ret);
+ return ret;
+} /* ocfs_proc_dlm_stats */
+
/*
* ocfs_proc_version()
*
@@ -246,16 +328,17 @@
static int ocfs_proc_version (char *page, char **start, off_t off,
int count, int *eof, void *data)
{
- extern char *ocfs_version;
int len;
int ret;
+ extern char *ocfs_version;
+ extern char *ocfs_date;
+ extern char *ocfs_md5;
LOG_ENTRY ();
+
+ len = sprintf (page, "%s %s (build %s)\n", ocfs_version, ocfs_date,
+ ocfs_md5);
- strcpy (page, ocfs_version);
- strcat (page, "\n");
- len = strlen (page);
-
ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
LOG_EXIT_LONG (ret);
@@ -327,6 +410,9 @@
{ "mountpoint", NULL, ocfs_proc_mountpoint },
{ "statistics", NULL, ocfs_proc_statistics },
{ "hashstat", NULL, ocfs_proc_hash_stats },
+ { "lockstat", NULL, ocfs_proc_dlm_stats },
+ { "device", NULL, ocfs_proc_device },
+ { "nodes", NULL, ocfs_proc_nodes },
{ NULL, }
};
@@ -343,6 +429,9 @@
ProcList[1].data = osb->vol_layout.mount_point;
ProcList[2].data = (char *) osb;
ProcList[3].data = (char *) osb;
+ ProcList[4].data = (char *) osb;
+ ProcList[5].data = (char *) osb;
+ ProcList[6].data = (char *) osb;
sprintf (newdir, "ocfs2/%-d", osb->osb_id);
proc_mkdir (newdir, 0);
@@ -378,6 +467,18 @@
sprintf (tmp, "ocfs2/%-d/statistics", osb->osb_id);
remove_proc_entry (tmp, NULL);
+ sprintf (tmp, "ocfs/%-d/hashstat", osb->osb_id);
+ remove_proc_entry (tmp, NULL);
+
+ sprintf (tmp, "ocfs/%-d/lockstat", osb->osb_id);
+ remove_proc_entry (tmp, NULL);
+
+ sprintf (tmp, "ocfs/%-d/device", osb->osb_id);
+ remove_proc_entry (tmp, NULL);
+
+ sprintf (tmp, "ocfs/%-d/nodes", osb->osb_id);
+ remove_proc_entry (tmp, NULL);
+
sprintf (tmp, "ocfs2/%-d", osb->osb_id);
remove_proc_entry (tmp, NULL);
@@ -492,3 +593,71 @@
LOG_EXIT_LONG (ret);
return ret;
} /* ocfs_proc_hash_stats */
+
+/*
+ * ocfs_proc_device()
+ *
+ */
+static int ocfs_proc_device (char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ int len;
+ int ret;
+ ocfs_super *osb;
+
+ LOG_ENTRY ();
+
+ osb = (ocfs_super *) data;
+ len = snprintf (page, sizeof(osb->dev_str), "%s\n", osb->dev_str);
+
+ ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
+
+ LOG_EXIT_LONG (ret);
+ return ret;
+} /* ocfs_proc_device */
+
+/*
+ * ocfs_proc_nodes()
+ *
+ */
+static int ocfs_proc_nodes (char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+{
+ int len = 0;
+ int i;
+ int ret;
+ ocfs_super *osb;
+ ocfs_node_config_info *node;
+ __u32 publ_map;
+ char mount;
+
+ LOG_ENTRY ();
+
+ osb = (ocfs_super *) data;
+
+ if (osb) {
+ down (&(osb->cfg_lock));
+ publ_map = (__u32)osb->publ_map;
+ for (i = 0; i < OCFS_MAXIMUM_NODES; ++i, publ_map >>= 1) {
+ node = osb->node_cfg_info[i];
+ if (!node)
+ continue;
+ mount = (publ_map & 0x1) ? 'M' : ' ';
+ len += sprintf (page + len,
+ "%2d %c %-32s %-15s %-6d ",
+ i, mount, node->node_name,
+ node->ipc_config.ip_addr,
+ node->ipc_config.ip_port);
+ strncat (page + len, node->guid.guid, GUID_LEN);
+ len += GUID_LEN;
+ len += sprintf (page + len, "\n");
+ }
+ up (&(osb->cfg_lock));
+ }
+
+ ret = ocfs_proc_calc_metrics (page, start, off, count, eof, len);
+
+ LOG_EXIT_LONG (ret);
+ return ret;
+} /* ocfs_proc_nodes */
+
Modified: trunk/src/ver.c
===================================================================
--- trunk/src/ver.c 2004-03-10 18:26:08 UTC (rev 769)
+++ trunk/src/ver.c 2004-03-11 21:24:18 UTC (rev 770)
@@ -34,6 +34,8 @@
")");
char *ocfs_version = OCFS_BUILD_VERSION;
+char *ocfs_date = OCFS_BUILD_DATE;
+char *ocfs_md5 = OCFS_BUILD_MD5;
void ocfs_version_print (void)
{
More information about the Ocfs2-commits
mailing list