[Ocfs2-commits] mfasheh commits r1648 - branches/dlm-glue/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Nov 15 17:39:50 CST 2004
Author: mfasheh
Date: 2004-11-15 17:39:48 -0600 (Mon, 15 Nov 2004)
New Revision: 1648
Modified:
branches/dlm-glue/src/dlmglue.c
branches/dlm-glue/src/dlmglue.h
branches/dlm-glue/src/heartbeat.c
branches/dlm-glue/src/ocfs.h
branches/dlm-glue/src/super.c
Log:
* add some more stubs
* set ourselves up with heartbeat
* look to node management for our node number
Modified: branches/dlm-glue/src/dlmglue.c
===================================================================
--- branches/dlm-glue/src/dlmglue.c 2004-11-15 23:23:25 UTC (rev 1647)
+++ branches/dlm-glue/src/dlmglue.c 2004-11-15 23:39:48 UTC (rev 1648)
@@ -1145,6 +1145,18 @@
dlm_unregister_domain(osb->dlm);
}
+int ocfs2_find_slot(ocfs_super *osb)
+{
+#warning "finish this"
+
+ /* TODO: We take a lock on the super block, read in our node
+ * map and find ourselves a slot. Right now hard code things
+ * such that slot_num == global_node_num. */
+
+ osb->slot_num = osb->global_node_num;
+ return 0;
+}
+
static void ocfs2_unlock_ast_func(void *opaque, dlm_status status)
{
ocfs2_lock *lock = opaque;
Modified: branches/dlm-glue/src/dlmglue.h
===================================================================
--- branches/dlm-glue/src/dlmglue.h 2004-11-15 23:23:25 UTC (rev 1647)
+++ branches/dlm-glue/src/dlmglue.h 2004-11-15 23:39:48 UTC (rev 1648)
@@ -79,6 +79,7 @@
int ocfs2_dlm_init(ocfs_super *osb);
void ocfs2_dlm_shutdown(ocfs_super *osb);
+int ocfs2_find_slot(ocfs_super *osb);
int ocfs2_lock_res_init(struct inode *inode,
ocfs2_lock_res *res);
void ocfs2_lock_res_free(ocfs2_lock_res *res);
Modified: branches/dlm-glue/src/heartbeat.c
===================================================================
--- branches/dlm-glue/src/heartbeat.c 2004-11-15 23:23:25 UTC (rev 1647)
+++ branches/dlm-glue/src/heartbeat.c 2004-11-15 23:39:48 UTC (rev 1648)
@@ -31,6 +31,10 @@
#include <linux/slab.h>
#include <linux/highmem.h>
+#include <dlmutil.h>
+#include <dlmcommon.h>
+#include <dlmhb.h>
+
#include "ocfs_log.h"
#include "ocfs.h"
#include "ocfs2.h"
@@ -45,6 +49,13 @@
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_HEARTBEAT
+#define OCFS2_HB_NODE_DOWN_PRI (0x0000001)
+
+static void ocfs2_hb_node_down_cb(void *ptr1,
+ void *ptr2,
+ int node_num,
+ void *data);
+
static void ocfs_node_map_init(ocfs_super *osb, ocfs_node_map *map);
static void __ocfs_node_map_dup(ocfs_super *osb,
ocfs_node_map *target,
@@ -66,15 +77,50 @@
ocfs_node_map_init(osb, &osb->recovery_map);
}
+static void ocfs2_hb_node_down_cb(void *ptr1,
+ void *ptr2,
+ int node_num,
+ void *data)
+{
+ ocfs_super *osb = data;
+
+ if (atomic_read(&osb->vol_state) != VOLUME_MOUNTED) {
+ printk("ocfs2: Ignoring node down callback for node %d\n",
+ node_num);
+ return;
+ }
+
+ OCFS_ASSERT(osb->global_node_num != node_num);
+
+ printk("ocfs2: node down event for %d\n", node_num);
+ /* uhm, do some recovery stuff.. */
+}
+
/* Most functions here are just stubs for now... */
int ocfs2_register_hb_callbacks(ocfs_super *osb)
{
+ int status;
ocfs_node_map_set_bit(osb, &osb->node_map, osb->node_num);
- return 0;
+
+ status = hb_register_callback(HB_NODE_DOWN_CB,
+ ocfs2_hb_node_down_cb,
+ osb,
+ OCFS2_HB_NODE_DOWN_PRI);
+ if (status < 0)
+ LOG_ERROR_STATUS(status);
+
+ return status;
}
void ocfs2_clear_hb_callbacks(ocfs_super *osb)
{
+ int status;
+
+ status = hb_unregister_callback(HB_NODE_DOWN_CB,
+ ocfs2_hb_node_down_cb, osb);
+ if (status < 0)
+ LOG_ERROR_STATUS(status);
+
ocfs_node_map_clear_bit(osb, &osb->node_map, osb->node_num);
}
Modified: branches/dlm-glue/src/ocfs.h
===================================================================
--- branches/dlm-glue/src/ocfs.h 2004-11-15 23:23:25 UTC (rev 1647)
+++ branches/dlm-glue/src/ocfs.h 2004-11-15 23:39:48 UTC (rev 1648)
@@ -44,6 +44,8 @@
#include <dlmutil.h>
#include <dlmcommon.h>
+#include <dlmnm.h>
+#include <dlmnet.h>
#include <dlmmod.h>
/* convenience macro */
@@ -391,6 +393,8 @@
u16 max_nodes;
u16 num_nodes;
s16 node_num;
+ s16 global_node_num;
+ unsigned int slot_num;
int reclaim_id; /* reclaim the original node number*/
int s_sectsize_bits;
int s_clustersize;
Modified: branches/dlm-glue/src/super.c
===================================================================
--- branches/dlm-glue/src/super.c 2004-11-15 23:23:25 UTC (rev 1647)
+++ branches/dlm-glue/src/super.c 2004-11-15 23:39:48 UTC (rev 1648)
@@ -824,12 +824,10 @@
static int ocfs2_fill_node_info(ocfs_super *osb)
{
int status;
- /* get the required node information from the group services /
- * node management stuff. For now we hard code these
- * things. */
+ struct inode *group = NULL;
- osb->node_num = 0;
-
+#warning "TODO: group name is always passed in as a parameter"
+ /* hard coded right now. */
osb->group_name = kmalloc(NM_MAX_NAME_LEN, GFP_KERNEL);
if (!osb->group_name) {
status = -ENOMEM;
@@ -837,10 +835,26 @@
goto bail;
}
memset(osb->group_name, 0, NM_MAX_NAME_LEN);
- sprintf(osb->group_name, "%s", "testgroup");
+ sprintf(osb->group_name, "%s", "ocfs2cluster");
+ group = nm_get_group_by_name(osb->group_name);
+ if (!group) {
+ printk("ocfs2: could not join group \"%s\"\n",
+ osb->group_name);
+ status = -EINVAL;
+ goto bail;
+ }
+
+ osb->global_node_num = osb->node_num = nm_this_node(group);
+
+ printk("ocfs2: I am node %u, a member of group %s\n", osb->node_num,
+ osb->group_name);
+
status = 0;
bail:
+ if (group)
+ iput(group);
+
return status;
}
@@ -894,25 +908,32 @@
goto leave;
}
- /* load all node-local system inodes */
- status = ocfs_init_local_system_inodes(osb);
+ status = ocfs2_register_hb_callbacks(osb);
if (status < 0) {
- LOG_ERROR_STATUS(status);
+ LOG_ERROR_STATUS (status);
goto leave;
}
- status = ocfs2_register_hb_callbacks(osb);
+ status = ocfs2_dlm_init(osb);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto leave;
}
- status = ocfs2_dlm_init(osb);
+ /* This will load up the node map and add ourselves to it. */
+ status = ocfs2_find_slot(osb);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto leave;
}
+ /* load all node-local system inodes */
+ status = ocfs_init_local_system_inodes(osb);
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ goto leave;
+ }
+
/* Add proc entry for this volume */
ocfs_proc_add_volume (osb);
More information about the Ocfs2-commits
mailing list