From 0306ec231fd7c4b8e0ebc08be14850c80d93fbc3 Mon Sep 17 00:00:00 2001 From: Joel Becker Date: Wed, 30 Jan 2008 15:38:24 -0800 Subject: [PATCH] --- yaml --- r: 89551 b: refs/heads/master c: 19fdb624dc8ccb663f6e48b3a3a3fa4e4e567fc1 h: refs/heads/master i: 89549: 3482f266c19badf946c1855a02b1d68a68f367fa 89547: 1712b6f7260e16a0c779334abd6b3ebcb9815705 89543: a8a867fe1a45aeffeb9b06cb20c390dbbef8c327 89535: 1b30842b794f12aa57c57ca7d33a80a458a4630a v: v3 --- [refs] | 2 +- trunk/fs/ocfs2/ocfs2.h | 2 +- trunk/fs/ocfs2/slot_map.c | 2 -- trunk/fs/ocfs2/stackglue.c | 17 +++++++++++++++++ trunk/fs/ocfs2/stackglue.h | 1 + trunk/fs/ocfs2/super.c | 22 +++++++++++----------- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index 26bc7f2b81d3..4072590802b9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4670c46ded9a18268d1265417ff4ac72145a7917 +refs/heads/master: 19fdb624dc8ccb663f6e48b3a3a3fa4e4e567fc1 diff --git a/trunk/fs/ocfs2/ocfs2.h b/trunk/fs/ocfs2/ocfs2.h index 664e4fe3eab5..7006abaffd47 100644 --- a/trunk/fs/ocfs2/ocfs2.h +++ b/trunk/fs/ocfs2/ocfs2.h @@ -218,7 +218,7 @@ struct ocfs2_super unsigned int s_atime_quantum; unsigned int max_slots; - s16 node_num; + unsigned int node_num; int slot_num; int preferred_slot; int s_sectsize_bits; diff --git a/trunk/fs/ocfs2/slot_map.c b/trunk/fs/ocfs2/slot_map.c index 63fb1b26d964..bb5ff8939bf1 100644 --- a/trunk/fs/ocfs2/slot_map.c +++ b/trunk/fs/ocfs2/slot_map.c @@ -73,8 +73,6 @@ static void ocfs2_set_slot(struct ocfs2_slot_info *si, int slot_num, unsigned int node_num) { BUG_ON((slot_num < 0) || (slot_num >= si->si_num_slots)); - BUG_ON((node_num == O2NM_INVALID_NODE_NUM) || - (node_num >= O2NM_MAX_NODES)); si->si_slots[slot_num].sl_valid = 1; si->si_slots[slot_num].sl_node_num = node_num; diff --git a/trunk/fs/ocfs2/stackglue.c b/trunk/fs/ocfs2/stackglue.c index f6f309a08344..814686356cc6 100644 --- a/trunk/fs/ocfs2/stackglue.c +++ b/trunk/fs/ocfs2/stackglue.c @@ -25,6 +25,8 @@ #include #include "cluster/masklog.h" +#include "cluster/nodemanager.h" + #include "stackglue.h" static struct ocfs2_locking_protocol *lproto; @@ -371,6 +373,21 @@ int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn) return 0; } +int ocfs2_cluster_this_node(unsigned int *node) +{ + int node_num; + + node_num = o2nm_this_node(); + if (node_num == O2NM_INVALID_NODE_NUM) + return -ENOENT; + + if (node_num >= O2NM_MAX_NODES) + return -EOVERFLOW; + + *node = node_num; + return 0; +} + void o2cb_get_stack(struct ocfs2_locking_protocol *proto) { BUG_ON(proto == NULL); diff --git a/trunk/fs/ocfs2/stackglue.h b/trunk/fs/ocfs2/stackglue.h index 3900b5c3933c..ccb03991b514 100644 --- a/trunk/fs/ocfs2/stackglue.h +++ b/trunk/fs/ocfs2/stackglue.h @@ -74,6 +74,7 @@ int ocfs2_cluster_connect(const char *group, void *recovery_data, struct ocfs2_cluster_connection **conn); int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn); +int ocfs2_cluster_this_node(unsigned int *node); int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn, int mode, diff --git a/trunk/fs/ocfs2/super.c b/trunk/fs/ocfs2/super.c index 0ee49757467d..d3c4d323fab5 100644 --- a/trunk/fs/ocfs2/super.c +++ b/trunk/fs/ocfs2/super.c @@ -694,7 +694,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) if (ocfs2_mount_local(osb)) snprintf(nodestr, sizeof(nodestr), "local"); else - snprintf(nodestr, sizeof(nodestr), "%d", osb->node_num); + snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num); printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %s, slot %d) " "with %s data mode.\n", @@ -1145,16 +1145,17 @@ static int ocfs2_fill_local_node_info(struct ocfs2_super *osb) * desirable. */ if (ocfs2_mount_local(osb)) osb->node_num = 0; - else - osb->node_num = o2nm_this_node(); - - if (osb->node_num == O2NM_MAX_NODES) { - mlog(ML_ERROR, "could not find this host's node number\n"); - status = -ENOENT; - goto bail; + else { + status = ocfs2_cluster_this_node(&osb->node_num); + if (status < 0) { + mlog_errno(status); + mlog(ML_ERROR, + "could not find this host's node number\n"); + goto bail; + } } - mlog(0, "I am node %d\n", osb->node_num); + mlog(0, "I am node %u\n", osb->node_num); status = 0; bail: @@ -1282,7 +1283,7 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) if (ocfs2_mount_local(osb)) snprintf(nodestr, sizeof(nodestr), "local"); else - snprintf(nodestr, sizeof(nodestr), "%d", osb->node_num); + snprintf(nodestr, sizeof(nodestr), "%u", osb->node_num); printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %s)\n", osb->dev_str, nodestr); @@ -1384,7 +1385,6 @@ static int ocfs2_initialize_super(struct super_block *sb, osb->s_atime_quantum = OCFS2_DEFAULT_ATIME_QUANTUM; - osb->node_num = O2NM_INVALID_NODE_NUM; osb->slot_num = OCFS2_INVALID_SLOT; osb->local_alloc_state = OCFS2_LA_UNUSED;