diff options
author | Sunil Mushran <sunil.mushran@oracle.com> | 2010-12-14 17:14:30 -0500 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-12-16 03:48:19 -0500 |
commit | cb0586bd4c77c531fe0be4ae860ec642450eeda5 (patch) | |
tree | a61a523952b929d9d42e04779fff2912d6821bc5 /fs/ocfs2/cluster | |
parent | 58a3158a5d17ddf4894db9e8ccaf92093ff8e42e (diff) |
ocfs2/cluster: Show pin state for each o2hb region
This patch adds a per o2hb region debugfs file that shows whether that region
is pinned or not.
Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/cluster')
-rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index ad2e41d6879d..3722e3850a1f 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -82,6 +82,7 @@ static unsigned long o2hb_failed_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)]; | |||
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 | 84 | #define O2HB_DB_TYPE_REGION_ELAPSED_TIME 6 |
85 | #define O2HB_DB_TYPE_REGION_PINNED 7 | ||
85 | struct o2hb_debug_buf { | 86 | struct o2hb_debug_buf { |
86 | int db_type; | 87 | int db_type; |
87 | int db_size; | 88 | int db_size; |
@@ -101,6 +102,7 @@ static struct o2hb_debug_buf *o2hb_db_failedregions; | |||
101 | #define O2HB_DEBUG_FAILEDREGIONS "failed_regions" | 102 | #define O2HB_DEBUG_FAILEDREGIONS "failed_regions" |
102 | #define O2HB_DEBUG_REGION_NUMBER "num" | 103 | #define O2HB_DEBUG_REGION_NUMBER "num" |
103 | #define O2HB_DEBUG_REGION_ELAPSED_TIME "elapsed_time_in_ms" | 104 | #define O2HB_DEBUG_REGION_ELAPSED_TIME "elapsed_time_in_ms" |
105 | #define O2HB_DEBUG_REGION_PINNED "pinned" | ||
104 | 106 | ||
105 | static struct dentry *o2hb_debug_dir; | 107 | static struct dentry *o2hb_debug_dir; |
106 | static struct dentry *o2hb_debug_livenodes; | 108 | static struct dentry *o2hb_debug_livenodes; |
@@ -241,9 +243,11 @@ struct o2hb_region { | |||
241 | struct dentry *hr_debug_livenodes; | 243 | struct dentry *hr_debug_livenodes; |
242 | struct dentry *hr_debug_regnum; | 244 | struct dentry *hr_debug_regnum; |
243 | struct dentry *hr_debug_elapsed_time; | 245 | struct dentry *hr_debug_elapsed_time; |
246 | struct dentry *hr_debug_pinned; | ||
244 | struct o2hb_debug_buf *hr_db_livenodes; | 247 | struct o2hb_debug_buf *hr_db_livenodes; |
245 | struct o2hb_debug_buf *hr_db_regnum; | 248 | struct o2hb_debug_buf *hr_db_regnum; |
246 | struct o2hb_debug_buf *hr_db_elapsed_time; | 249 | struct o2hb_debug_buf *hr_db_elapsed_time; |
250 | struct o2hb_debug_buf *hr_db_pinned; | ||
247 | 251 | ||
248 | /* let the person setting up hb wait for it to return until it | 252 | /* let the person setting up hb wait for it to return until it |
249 | * has reached a 'steady' state. This will be fixed when we have | 253 | * has reached a 'steady' state. This will be fixed when we have |
@@ -1180,6 +1184,12 @@ static int o2hb_debug_open(struct inode *inode, struct file *file) | |||
1180 | reg->hr_last_timeout_start)); | 1184 | reg->hr_last_timeout_start)); |
1181 | goto done; | 1185 | goto done; |
1182 | 1186 | ||
1187 | case O2HB_DB_TYPE_REGION_PINNED: | ||
1188 | reg = (struct o2hb_region *)db->db_data; | ||
1189 | out += snprintf(buf + out, PAGE_SIZE - out, "%u\n", | ||
1190 | !!reg->hr_item_pinned); | ||
1191 | goto done; | ||
1192 | |||
1183 | default: | 1193 | default: |
1184 | goto done; | 1194 | goto done; |
1185 | } | 1195 | } |
@@ -1424,6 +1434,7 @@ static void o2hb_region_release(struct config_item *item) | |||
1424 | debugfs_remove(reg->hr_debug_livenodes); | 1434 | debugfs_remove(reg->hr_debug_livenodes); |
1425 | debugfs_remove(reg->hr_debug_regnum); | 1435 | debugfs_remove(reg->hr_debug_regnum); |
1426 | debugfs_remove(reg->hr_debug_elapsed_time); | 1436 | debugfs_remove(reg->hr_debug_elapsed_time); |
1437 | debugfs_remove(reg->hr_debug_pinned); | ||
1427 | debugfs_remove(reg->hr_debug_dir); | 1438 | debugfs_remove(reg->hr_debug_dir); |
1428 | 1439 | ||
1429 | spin_lock(&o2hb_live_lock); | 1440 | spin_lock(&o2hb_live_lock); |
@@ -1988,6 +1999,18 @@ static int o2hb_debug_region_init(struct o2hb_region *reg, struct dentry *dir) | |||
1988 | goto bail; | 1999 | goto bail; |
1989 | } | 2000 | } |
1990 | 2001 | ||
2002 | reg->hr_debug_pinned = | ||
2003 | o2hb_debug_create(O2HB_DEBUG_REGION_PINNED, | ||
2004 | reg->hr_debug_dir, | ||
2005 | &(reg->hr_db_pinned), | ||
2006 | sizeof(*(reg->hr_db_pinned)), | ||
2007 | O2HB_DB_TYPE_REGION_PINNED, | ||
2008 | 0, 0, reg); | ||
2009 | if (!reg->hr_debug_pinned) { | ||
2010 | mlog_errno(ret); | ||
2011 | goto bail; | ||
2012 | } | ||
2013 | |||
1991 | ret = 0; | 2014 | ret = 0; |
1992 | bail: | 2015 | bail: |
1993 | return ret; | 2016 | return ret; |