aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2010-10-06 20:55:09 -0400
committerSunil Mushran <sunil.mushran@oracle.com>2010-10-06 20:55:09 -0400
commit43695d095dfaf266a8a940d9b07eed7f46076b49 (patch)
treeceb5909ed948ee354de9c9c17c573b30159e24db /fs/ocfs2
parentd6aa1c7c9e4b48081c2302e14b0f857017461efd (diff)
ocfs2/cluster: Show per region heartbeat elapsed time
This patch adds a per region debugfs file that shows the elapsed time since the time the o2hb timer was last armed. Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/cluster/heartbeat.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index e8676accf90..29aee2128ed 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -81,6 +81,7 @@ static unsigned long o2hb_failed_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)];
81#define O2HB_DB_TYPE_FAILEDREGIONS 3 81#define O2HB_DB_TYPE_FAILEDREGIONS 3
82#define O2HB_DB_TYPE_REGION_LIVENODES 4 82#define O2HB_DB_TYPE_REGION_LIVENODES 4
83#define O2HB_DB_TYPE_REGION_NUMBER 5 83#define O2HB_DB_TYPE_REGION_NUMBER 5
84#define O2HB_DB_TYPE_REGION_ELAPSED_TIME 6
84struct o2hb_debug_buf { 85struct o2hb_debug_buf {
85 int db_type; 86 int db_type;
86 int db_size; 87 int db_size;
@@ -99,6 +100,7 @@ static struct o2hb_debug_buf *o2hb_db_failedregions;
99#define O2HB_DEBUG_QUORUMREGIONS "quorum_regions" 100#define O2HB_DEBUG_QUORUMREGIONS "quorum_regions"
100#define O2HB_DEBUG_FAILEDREGIONS "failed_regions" 101#define O2HB_DEBUG_FAILEDREGIONS "failed_regions"
101#define O2HB_DEBUG_REGION_NUMBER "num" 102#define O2HB_DEBUG_REGION_NUMBER "num"
103#define O2HB_DEBUG_REGION_ELAPSED_TIME "elapsed_time_in_ms"
102 104
103static struct dentry *o2hb_debug_dir; 105static struct dentry *o2hb_debug_dir;
104static struct dentry *o2hb_debug_livenodes; 106static struct dentry *o2hb_debug_livenodes;
@@ -209,8 +211,10 @@ struct o2hb_region {
209 struct dentry *hr_debug_dir; 211 struct dentry *hr_debug_dir;
210 struct dentry *hr_debug_livenodes; 212 struct dentry *hr_debug_livenodes;
211 struct dentry *hr_debug_regnum; 213 struct dentry *hr_debug_regnum;
214 struct dentry *hr_debug_elapsed_time;
212 struct o2hb_debug_buf *hr_db_livenodes; 215 struct o2hb_debug_buf *hr_db_livenodes;
213 struct o2hb_debug_buf *hr_db_regnum; 216 struct o2hb_debug_buf *hr_db_regnum;
217 struct o2hb_debug_buf *hr_db_elapsed_time;
214 218
215 /* let the person setting up hb wait for it to return until it 219 /* let the person setting up hb wait for it to return until it
216 * has reached a 'steady' state. This will be fixed when we have 220 * has reached a 'steady' state. This will be fixed when we have
@@ -1132,6 +1136,13 @@ static int o2hb_debug_open(struct inode *inode, struct file *file)
1132 reg->hr_region_num); 1136 reg->hr_region_num);
1133 goto done; 1137 goto done;
1134 1138
1139 case O2HB_DB_TYPE_REGION_ELAPSED_TIME:
1140 reg = (struct o2hb_region *)db->db_data;
1141 out += snprintf(buf + out, PAGE_SIZE - out, "%u\n",
1142 jiffies_to_msecs(jiffies -
1143 reg->hr_last_timeout_start));
1144 goto done;
1145
1135 default: 1146 default:
1136 goto done; 1147 goto done;
1137 } 1148 }
@@ -1925,6 +1936,18 @@ static int o2hb_debug_region_init(struct o2hb_region *reg, struct dentry *dir)
1925 goto bail; 1936 goto bail;
1926 } 1937 }
1927 1938
1939 reg->hr_debug_elapsed_time =
1940 o2hb_debug_create(O2HB_DEBUG_REGION_ELAPSED_TIME,
1941 reg->hr_debug_dir,
1942 &(reg->hr_db_elapsed_time),
1943 sizeof(*(reg->hr_db_elapsed_time)),
1944 O2HB_DB_TYPE_REGION_ELAPSED_TIME,
1945 0, 0, reg);
1946 if (!reg->hr_debug_elapsed_time) {
1947 mlog_errno(ret);
1948 goto bail;
1949 }
1950
1928 ret = 0; 1951 ret = 0;
1929bail: 1952bail:
1930 return ret; 1953 return ret;