Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212794
b: refs/heads/master
c: 43182d2
h: refs/heads/master
v: v3
  • Loading branch information
Sunil Mushran committed Oct 7, 2010
1 parent 2009620 commit 9120d34
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e7d656baf6607a0775f4ca85464a4ead306741e5
refs/heads/master: 43182d2a799865872041b6e4d8387131e9462f56
35 changes: 35 additions & 0 deletions trunk/fs/ocfs2/cluster/heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ static DECLARE_WAIT_QUEUE_HEAD(o2hb_steady_queue);
* In global heartbeat, we maintain a series of region bitmaps.
* - o2hb_region_bitmap allows us to limit the region number to max region.
* - o2hb_live_region_bitmap tracks live regions (seen steady iterations).
* - o2hb_quorum_region_bitmap tracks live regions that have seen all nodes
* heartbeat on it.
*/
static unsigned long o2hb_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)];
static unsigned long o2hb_live_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)];
static unsigned long o2hb_quorum_region_bitmap[BITS_TO_LONGS(O2NM_MAX_REGIONS)];

#define O2HB_DB_TYPE_LIVENODES 0
struct o2hb_debug_buf {
Expand Down Expand Up @@ -607,6 +610,35 @@ static void o2hb_shutdown_slot(struct o2hb_disk_slot *slot)
o2nm_node_put(node);
}

static void o2hb_set_quorum_device(struct o2hb_region *reg,
struct o2hb_disk_slot *slot)
{
assert_spin_locked(&o2hb_live_lock);

if (!o2hb_global_heartbeat_active())
return;

if (test_bit(reg->hr_region_num, o2hb_quorum_region_bitmap))
return;

/*
* A region can be added to the quorum only when it sees all
* live nodes heartbeat on it. In other words, the region has been
* added to all nodes.
*/
if (memcmp(reg->hr_live_node_bitmap, o2hb_live_node_bitmap,
sizeof(o2hb_live_node_bitmap)))
return;

if (slot->ds_changed_samples < O2HB_LIVE_THRESHOLD)
return;

printk(KERN_NOTICE "o2hb: Region %s is now a quorum device\n",
config_item_name(&reg->hr_item));

set_bit(reg->hr_region_num, o2hb_quorum_region_bitmap);
}

static int o2hb_check_slot(struct o2hb_region *reg,
struct o2hb_disk_slot *slot)
{
Expand Down Expand Up @@ -772,6 +804,8 @@ static int o2hb_check_slot(struct o2hb_region *reg,
slot->ds_equal_samples = 0;
}
out:
o2hb_set_quorum_device(reg, slot);

spin_unlock(&o2hb_live_lock);

o2hb_run_event_list(&event);
Expand Down Expand Up @@ -1138,6 +1172,7 @@ int o2hb_init(void)
memset(o2hb_live_node_bitmap, 0, sizeof(o2hb_live_node_bitmap));
memset(o2hb_region_bitmap, 0, sizeof(o2hb_region_bitmap));
memset(o2hb_live_region_bitmap, 0, sizeof(o2hb_live_region_bitmap));
memset(o2hb_quorum_region_bitmap, 0, sizeof(o2hb_quorum_region_bitmap));

return o2hb_debug_init();
}
Expand Down

0 comments on commit 9120d34

Please sign in to comment.