aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2010-10-06 20:55:13 -0400
committerSunil Mushran <sunil.mushran@oracle.com>2010-10-06 20:55:13 -0400
commita6de013654b4839c8609e26241ebd9eb1ecc52e6 (patch)
treeb39f4238abab660c3021f5f9eee3e36c47a3b006 /fs
parentb1c5ebfbe398b3360614a4788c02061cd153e60a (diff)
ocfs2/cluster: Create debugfs files for live, quorum and failed region bitmaps
This patch prints the bitmaps of live, quorum and failed regions. This information will be useful in debugging cluster issues. Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/cluster/heartbeat.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index f890656127fa..b06b9e52fba8 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -76,6 +76,9 @@ static unsigned long o2hb_quorum_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)];
76static unsigned long o2hb_failed_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)]; 76static unsigned long o2hb_failed_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)];
77 77
78#define O2HB_DB_TYPE_LIVENODES 0 78#define O2HB_DB_TYPE_LIVENODES 0
79#define O2HB_DB_TYPE_LIVEREGIONS 1
80#define O2HB_DB_TYPE_QUORUMREGIONS 2
81#define O2HB_DB_TYPE_FAILEDREGIONS 3
79struct o2hb_debug_buf { 82struct o2hb_debug_buf {
80 int db_type; 83 int db_type;
81 int db_size; 84 int db_size;
@@ -84,12 +87,21 @@ struct o2hb_debug_buf {
84}; 87};
85 88
86static struct o2hb_debug_buf *o2hb_db_livenodes; 89static struct o2hb_debug_buf *o2hb_db_livenodes;
90static struct o2hb_debug_buf *o2hb_db_liveregions;
91static struct o2hb_debug_buf *o2hb_db_quorumregions;
92static struct o2hb_debug_buf *o2hb_db_failedregions;
87 93
88#define O2HB_DEBUG_DIR "o2hb" 94#define O2HB_DEBUG_DIR "o2hb"
89#define O2HB_DEBUG_LIVENODES "livenodes" 95#define O2HB_DEBUG_LIVENODES "livenodes"
96#define O2HB_DEBUG_LIVEREGIONS "live_regions"
97#define O2HB_DEBUG_QUORUMREGIONS "quorum_regions"
98#define O2HB_DEBUG_FAILEDREGIONS "failed_regions"
90 99
91static struct dentry *o2hb_debug_dir; 100static struct dentry *o2hb_debug_dir;
92static struct dentry *o2hb_debug_livenodes; 101static struct dentry *o2hb_debug_livenodes;
102static struct dentry *o2hb_debug_liveregions;
103static struct dentry *o2hb_debug_quorumregions;
104static struct dentry *o2hb_debug_failedregions;
93 105
94static LIST_HEAD(o2hb_all_regions); 106static LIST_HEAD(o2hb_all_regions);
95 107
@@ -1085,6 +1097,9 @@ static int o2hb_debug_open(struct inode *inode, struct file *file)
1085 1097
1086 switch (db->db_type) { 1098 switch (db->db_type) {
1087 case O2HB_DB_TYPE_LIVENODES: 1099 case O2HB_DB_TYPE_LIVENODES:
1100 case O2HB_DB_TYPE_LIVEREGIONS:
1101 case O2HB_DB_TYPE_QUORUMREGIONS:
1102 case O2HB_DB_TYPE_FAILEDREGIONS:
1088 spin_lock(&o2hb_live_lock); 1103 spin_lock(&o2hb_live_lock);
1089 memcpy(map, db->db_data, db->db_size); 1104 memcpy(map, db->db_data, db->db_size);
1090 spin_unlock(&o2hb_live_lock); 1105 spin_unlock(&o2hb_live_lock);
@@ -1146,6 +1161,12 @@ static const struct file_operations o2hb_debug_fops = {
1146void o2hb_exit(void) 1161void o2hb_exit(void)
1147{ 1162{
1148 kfree(o2hb_db_livenodes); 1163 kfree(o2hb_db_livenodes);
1164 kfree(o2hb_db_liveregions);
1165 kfree(o2hb_db_quorumregions);
1166 kfree(o2hb_db_failedregions);
1167 debugfs_remove(o2hb_debug_failedregions);
1168 debugfs_remove(o2hb_debug_quorumregions);
1169 debugfs_remove(o2hb_debug_liveregions);
1149 debugfs_remove(o2hb_debug_livenodes); 1170 debugfs_remove(o2hb_debug_livenodes);
1150 debugfs_remove(o2hb_debug_dir); 1171 debugfs_remove(o2hb_debug_dir);
1151} 1172}
@@ -1189,6 +1210,48 @@ static int o2hb_debug_init(void)
1189 mlog_errno(ret); 1210 mlog_errno(ret);
1190 goto bail; 1211 goto bail;
1191 } 1212 }
1213
1214 o2hb_debug_liveregions = o2hb_debug_create(O2HB_DEBUG_LIVEREGIONS,
1215 o2hb_debug_dir,
1216 &o2hb_db_liveregions,
1217 sizeof(*o2hb_db_liveregions),
1218 O2HB_DB_TYPE_LIVEREGIONS,
1219 sizeof(o2hb_live_region_bitmap),
1220 O2NM_MAX_REGIONS,
1221 o2hb_live_region_bitmap);
1222 if (!o2hb_debug_liveregions) {
1223 mlog_errno(ret);
1224 goto bail;
1225 }
1226
1227 o2hb_debug_quorumregions =
1228 o2hb_debug_create(O2HB_DEBUG_QUORUMREGIONS,
1229 o2hb_debug_dir,
1230 &o2hb_db_quorumregions,
1231 sizeof(*o2hb_db_quorumregions),
1232 O2HB_DB_TYPE_QUORUMREGIONS,
1233 sizeof(o2hb_quorum_region_bitmap),
1234 O2NM_MAX_REGIONS,
1235 o2hb_quorum_region_bitmap);
1236 if (!o2hb_debug_quorumregions) {
1237 mlog_errno(ret);
1238 goto bail;
1239 }
1240
1241 o2hb_debug_failedregions =
1242 o2hb_debug_create(O2HB_DEBUG_FAILEDREGIONS,
1243 o2hb_debug_dir,
1244 &o2hb_db_failedregions,
1245 sizeof(*o2hb_db_failedregions),
1246 O2HB_DB_TYPE_FAILEDREGIONS,
1247 sizeof(o2hb_failed_region_bitmap),
1248 O2NM_MAX_REGIONS,
1249 o2hb_failed_region_bitmap);
1250 if (!o2hb_debug_failedregions) {
1251 mlog_errno(ret);
1252 goto bail;
1253 }
1254
1192 ret = 0; 1255 ret = 0;
1193bail: 1256bail:
1194 if (ret) 1257 if (ret)