[Ocfs2-commits] mfasheh commits r1887 - trunk/fs/ocfs2/cluster
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Feb 7 19:54:33 CST 2005
Author: mfasheh
Date: 2005-02-07 19:54:32 -0600 (Mon, 07 Feb 2005)
New Revision: 1887
Modified:
trunk/fs/ocfs2/cluster/heartbeat.c
Log:
* commit a patch by Sunil Mushran to use a bytemap for heartbeat
communication of node maps. This makes things a bit easier on ppc64.
Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c 2005-02-04 22:42:35 UTC (rev 1886)
+++ trunk/fs/ocfs2/cluster/heartbeat.c 2005-02-08 01:54:32 UTC (rev 1887)
@@ -60,6 +60,7 @@
#include <linux/seq_file.h>
#include <linux/pagemap.h>
#include <linux/file.h>
+#include <linux/bitops.h>
#include <asm/uaccess.h>
@@ -95,9 +96,9 @@
static int hb_thread(void *data);
static void hb_complete_thread(void);
static int hb_launch_thread(void);
+static int hb_fill_node_bytemap(struct inode *group, void *map, int size);
-
/* globals */
static spinlock_t hb_lock = SPIN_LOCK_UNLOCKED;
static LIST_HEAD(hb_net_groups);
@@ -472,7 +473,7 @@
dev_t dev;
int ret, tmpret;
nm_group_inode_private *priv;
- u32 tmpmap[8];
+ u8 tmpmap[NM_MAX_NODES];
hbprintk("write_disk\n");
@@ -529,16 +530,17 @@
-EINVAL, data->group_num);
break;
}
-
- if ((ret = hb_fill_node_map(group, tmpmap,
- sizeof(tmpmap))) == 0) {
+
+ memset(tmpmap, 0, sizeof(tmpmap));
+ if ((ret = hb_fill_node_bytemap(group, tmpmap,
+ NM_MAX_NODES)) == 0) {
ret = sprintf(buf, "0: ");
buf += ret;
memcpy(buf, tmpmap, sizeof(tmpmap));
ret += sizeof(tmpmap);
} else {
ret = sprintf(buf, "%d: error occurred in "
- "hb_fill_node_map", ret);
+ "hb_fill_node_bytemap", ret);
}
break;
@@ -809,7 +811,51 @@
module_init(init_hb)
module_exit(exit_hb)
+/*
+ * hb_fill_node_bytemap()
+ * 255 bytes... each byte set to 0 (not mounted) or 1 (mounted)
+ *
+ */
+static int hb_fill_node_bytemap(struct inode *group, void *map, int size)
+{
+ hb_disk_slot *slot;
+ int idx = 0;
+ nm_group_inode_private *priv;
+ u8 *bytemap = (u8 *)map;
+
+ priv = group->u.generic_ip;
+ down(&group->i_sem);
+
+ if (priv->disk.uuid[0]) {
+ while ((slot = nm_iterate_group_disk_slots(group, &idx))) {
+ if (idx >= size-1) {
+ hbprintk("map size (%d) too small for "
+ "index (%d)\n", size, idx);
+ up(&group->i_sem);
+ return -EINVAL;
+ }
+ if (slot->state == HB_NODE_STATE_UP)
+ bytemap[idx] = 1;
+ idx++;
+ }
+ } else {
+ hbprintk("filling straight from slot bitmap for non-disk "
+ "heartbeat group\n");
+ idx = 0;
+ while ((idx = find_next_bit(priv->slot_bitmap, NM_MAX_NODES,
+ idx)) != -1) {
+ if (idx == NM_MAX_NODES)
+ break;
+ bytemap[idx] = 1;
+ }
+ }
+
+ up(&group->i_sem);
+
+ return 0;
+}
+
int hb_fill_node_map(struct inode *group, void *map, int size)
{
hb_disk_slot *slot;
More information about the Ocfs2-commits
mailing list