aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2010-10-06 20:55:18 -0400
committerSunil Mushran <sunil.mushran@oracle.com>2010-10-06 20:55:18 -0400
commite7d656baf6607a0775f4ca85464a4ead306741e5 (patch)
tree0ed3f7a94209ccb13b450234aa801c2393546fab /fs
parent536f0741f324f116d8b059295999945a2dac56bc (diff)
ocfs2/cluster: Track bitmap of live heartbeat regions
A heartbeat region becomes live (or active) after a fixed number of (steady) iterations. Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ocfs2/cluster/heartbeat.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index d66b17c000d4..2a7cd17e96f0 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -65,8 +65,10 @@ static DECLARE_WAIT_QUEUE_HEAD(o2hb_steady_queue);
65/* 65/*
66 * In global heartbeat, we maintain a series of region bitmaps. 66 * In global heartbeat, we maintain a series of region bitmaps.
67 * - o2hb_region_bitmap allows us to limit the region number to max region. 67 * - o2hb_region_bitmap allows us to limit the region number to max region.
68 * - o2hb_live_region_bitmap tracks live regions (seen steady iterations).
68 */ 69 */
69static unsigned long o2hb_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)]; 70static unsigned long o2hb_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)];
71static unsigned long o2hb_live_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)];
70 72
71#define O2HB_DB_TYPE_LIVENODES 0 73#define O2HB_DB_TYPE_LIVENODES 0
72struct o2hb_debug_buf { 74struct o2hb_debug_buf {
@@ -1135,6 +1137,7 @@ int o2hb_init(void)
1135 1137
1136 memset(o2hb_live_node_bitmap, 0, sizeof(o2hb_live_node_bitmap)); 1138 memset(o2hb_live_node_bitmap, 0, sizeof(o2hb_live_node_bitmap));
1137 memset(o2hb_region_bitmap, 0, sizeof(o2hb_region_bitmap)); 1139 memset(o2hb_region_bitmap, 0, sizeof(o2hb_region_bitmap));
1140 memset(o2hb_live_region_bitmap, 0, sizeof(o2hb_live_region_bitmap));
1138 1141
1139 return o2hb_debug_init(); 1142 return o2hb_debug_init();
1140} 1143}
@@ -1563,6 +1566,8 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
1563 /* Ok, we were woken. Make sure it wasn't by drop_item() */ 1566 /* Ok, we were woken. Make sure it wasn't by drop_item() */
1564 spin_lock(&o2hb_live_lock); 1567 spin_lock(&o2hb_live_lock);
1565 hb_task = reg->hr_task; 1568 hb_task = reg->hr_task;
1569 if (o2hb_global_heartbeat_active())
1570 set_bit(reg->hr_region_num, o2hb_live_region_bitmap);
1566 spin_unlock(&o2hb_live_lock); 1571 spin_unlock(&o2hb_live_lock);
1567 1572
1568 if (hb_task) 1573 if (hb_task)
@@ -1751,8 +1756,10 @@ static void o2hb_heartbeat_group_drop_item(struct config_group *group,
1751 1756
1752 /* stop the thread when the user removes the region dir */ 1757 /* stop the thread when the user removes the region dir */
1753 spin_lock(&o2hb_live_lock); 1758 spin_lock(&o2hb_live_lock);
1754 if (o2hb_global_heartbeat_active()) 1759 if (o2hb_global_heartbeat_active()) {
1755 clear_bit(reg->hr_region_num, o2hb_region_bitmap); 1760 clear_bit(reg->hr_region_num, o2hb_region_bitmap);
1761 clear_bit(reg->hr_region_num, o2hb_live_region_bitmap);
1762 }
1756 hb_task = reg->hr_task; 1763 hb_task = reg->hr_task;
1757 reg->hr_task = NULL; 1764 reg->hr_task = NULL;
1758 spin_unlock(&o2hb_live_lock); 1765 spin_unlock(&o2hb_live_lock);