[Ocfs2-commits] jlbec commits r2256 - in branches/alloc_inode/fs/ocfs2: . cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon May 16 20:30:52 CDT 2005


Author: jlbec
Date: 2005-05-16 20:30:51 -0500 (Mon, 16 May 2005)
New Revision: 2256

Modified:
   branches/alloc_inode/fs/ocfs2/cluster/tcp.c
   branches/alloc_inode/fs/ocfs2/journal.c
   branches/alloc_inode/fs/ocfs2/localalloc.c
   branches/alloc_inode/fs/ocfs2/namei.c
   branches/alloc_inode/fs/ocfs2/super.c
Log:

Merged 2249:2255 from trunk:
	- [2250] Don't rely on compat includes.
	- [2251] Cosmetic coding style fix.
	- [2252] Handle osb->journal==NULL.
	- [2253] Do nothing on shutdown if local alloc is unused.
	- [2254] Initalize a bunch of osb members.



Modified: branches/alloc_inode/fs/ocfs2/cluster/tcp.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/cluster/tcp.c	2005-05-17 01:26:24 UTC (rev 2255)
+++ branches/alloc_inode/fs/ocfs2/cluster/tcp.c	2005-05-17 01:30:51 UTC (rev 2256)
@@ -94,6 +94,7 @@
 #include <linux/proc_fs.h>
 #include <linux/file.h>
 #include <linux/kthread.h>
+#include <linux/kref.h>
 
 #include <asm/uaccess.h>
 

Modified: branches/alloc_inode/fs/ocfs2/journal.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/journal.c	2005-05-17 01:26:24 UTC (rev 2255)
+++ branches/alloc_inode/fs/ocfs2/journal.c	2005-05-17 01:30:51 UTC (rev 2256)
@@ -642,6 +642,9 @@
 		BUG();
 
 	journal = osb->journal;
+	if (!journal)
+		goto done;
+
 	inode = journal->j_inode;
 
 	if (journal->j_state != OCFS_JOURNAL_LOADED)

Modified: branches/alloc_inode/fs/ocfs2/localalloc.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/localalloc.c	2005-05-17 01:26:24 UTC (rev 2255)
+++ branches/alloc_inode/fs/ocfs2/localalloc.c	2005-05-17 01:30:51 UTC (rev 2256)
@@ -215,6 +215,9 @@
 
 	mlog_entry_void();
 
+	if (osb->local_alloc_state == OCFS2_LA_UNUSED)
+		goto bail;
+
 	local_alloc_inode = 
 		ocfs_get_system_file_inode(osb, 
 					   LOCAL_ALLOC_SYSTEM_INODE,
@@ -226,9 +229,6 @@
 	}
 	oip = OCFS_I(local_alloc_inode);
 
-	if (osb->local_alloc_state == OCFS2_LA_UNUSED)
-		goto bail;
-
 	osb->local_alloc_state = OCFS2_LA_DISABLED;
 
 	handle = ocfs_alloc_handle(osb);

Modified: branches/alloc_inode/fs/ocfs2/namei.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/namei.c	2005-05-17 01:26:24 UTC (rev 2255)
+++ branches/alloc_inode/fs/ocfs2/namei.c	2005-05-17 01:30:51 UTC (rev 2256)
@@ -1962,7 +1962,7 @@
 cleanup_and_exit:
 	/* Clean up the read-ahead blocks */
 	for (; ra_ptr < ra_max; ra_ptr++)
-		brelse (bh_use[ra_ptr]);
+		brelse(bh_use[ra_ptr]);
 
 	mlog_exit_ptr(ret);
 	return ret;

Modified: branches/alloc_inode/fs/ocfs2/super.c
===================================================================
--- branches/alloc_inode/fs/ocfs2/super.c	2005-05-17 01:26:24 UTC (rev 2255)
+++ branches/alloc_inode/fs/ocfs2/super.c	2005-05-17 01:30:51 UTC (rev 2256)
@@ -985,6 +985,51 @@
 	mlog_entry_void ();
 
 	INIT_LIST_HEAD(&osb->osb_net_handlers);
+	init_waitqueue_head(&osb->recovery_event);
+	spin_lock_init(&osb->vote_task_lock);
+	init_waitqueue_head(&osb->vote_event);
+	osb->vote_work_sequence = 0;
+	osb->vote_wake_sequence = 0;
+	INIT_LIST_HEAD(&osb->blocked_lock_list);
+	osb->blocked_lock_count = 0;
+	INIT_LIST_HEAD(&osb->vote_list);
+	spin_lock_init(&osb->s_next_gen_lock);
+
+	spin_lock_init(&osb->osb_okp_teardown_lock);
+	INIT_LIST_HEAD(&osb->osb_okp_teardown_list);
+	INIT_LIST_HEAD(&osb->osb_okp_pending_list);
+	init_waitqueue_head(&osb->osb_okp_pending_wq);
+	/* we sync with this work queue (and sb ref) on unmount */
+	INIT_WORK(&osb->osb_okp_teardown_work, okp_teardown_from_list, osb);
+
+	atomic_set(&osb->alloc_stats.moves, 0);
+	atomic_set(&osb->alloc_stats.local_data, 0);
+	atomic_set(&osb->alloc_stats.bitmap_data, 0);
+	atomic_set(&osb->alloc_stats.bg_allocs, 0);
+	atomic_set(&osb->alloc_stats.bg_extends, 0);
+
+	ocfs2_init_node_maps(osb);
+
+	snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
+		 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
+
+	init_MUTEX (&(osb->recovery_lock));
+
+	osb->disable_recovery = 0;
+	osb->recovery_thread_task = NULL;
+
+	init_waitqueue_head (&osb->checkpoint_event);
+	atomic_set (&osb->needs_checkpoint, 0);
+	atomic_set (&osb->clean_buffer_seq, 1);
+	spin_lock_init (&osb->clean_buffer_lock);
+
+	osb->node_num = OCFS_INVALID_NODE_NUM;
+	osb->slot_num = OCFS_INVALID_NODE_NUM;
+
+	osb->local_alloc_state = OCFS2_LA_UNUSED;
+	osb->local_alloc_bh = NULL;
+
+	init_waitqueue_head(&osb->osb_mount_event);
 	
 	osb->vol_label = kmalloc(64, GFP_KERNEL);
 	if (!osb->vol_label) {
@@ -999,10 +1044,10 @@
 		goto bail;
 	}
 
-	/* this needs to be done before most other initializations */
 	di = (ocfs2_dinode *) bh->b_data;
+
 	osb->max_nodes = le16_to_cpu(di->id2.i_super.s_max_nodes);
-	if (osb->max_nodes > OCFS2_MAX_NODES) {
+	if (osb->max_nodes > OCFS2_MAX_NODES || osb->max_nodes == 0) {
 		mlog(ML_ERROR, "Invalid number of nodes (%u)\n",
 		     osb->max_nodes);
 		status = -EINVAL;
@@ -1039,30 +1084,8 @@
 		goto bail;
 	}
 
-	init_waitqueue_head(&osb->recovery_event);
-	spin_lock_init(&osb->vote_task_lock);
-	init_waitqueue_head(&osb->vote_event);
-	osb->vote_work_sequence = 0;
-	osb->vote_wake_sequence = 0;
-	INIT_LIST_HEAD(&osb->blocked_lock_list);
-	osb->blocked_lock_count = 0;
-	INIT_LIST_HEAD(&osb->vote_list);
-	spin_lock_init(&osb->s_next_gen_lock);
 	get_random_bytes(&osb->s_next_generation, sizeof(u32));
 
-	spin_lock_init(&osb->osb_okp_teardown_lock);
-	INIT_LIST_HEAD(&osb->osb_okp_teardown_list);
-	INIT_LIST_HEAD(&osb->osb_okp_pending_list);
-	init_waitqueue_head(&osb->osb_okp_pending_wq);
-	/* we sync with this work queue (and sb ref) on unmount */
-	INIT_WORK(&osb->osb_okp_teardown_work, okp_teardown_from_list, osb);
-
-	atomic_set(&osb->alloc_stats.moves, 0);
-	atomic_set(&osb->alloc_stats.local_data, 0);
-	atomic_set(&osb->alloc_stats.bitmap_data, 0);
-	atomic_set(&osb->alloc_stats.bg_allocs, 0);
-	atomic_set(&osb->alloc_stats.bg_extends, 0);
-
 	/* FIXME
 	 * This should be done in ocfs_journal_init(), but unknown
 	 * ordering issues will cause the filesystem to crash.
@@ -1091,31 +1114,6 @@
 	INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery, osb);
 	journal->j_state = OCFS_JOURNAL_FREE;
 
-	ocfs2_init_node_maps(osb);
-
-	snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u",
-		 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
-
-	init_MUTEX (&(osb->recovery_lock));
-
-	osb->disable_recovery = 0;
-	osb->recovery_thread_task = NULL;
-
-	init_waitqueue_head (&osb->checkpoint_event);
-	atomic_set (&osb->needs_checkpoint, 0);
-	atomic_set (&osb->clean_buffer_seq, 1);
-	spin_lock_init (&osb->clean_buffer_lock);
-
-	osb->node_num = OCFS_INVALID_NODE_NUM;
-	osb->slot_num = OCFS_INVALID_NODE_NUM;
-
-	osb->local_alloc_state = OCFS2_LA_UNUSED;
-	osb->local_alloc_bh = NULL;
-
-	init_waitqueue_head(&osb->osb_mount_event);
-
-	di = (ocfs2_dinode *) bh->b_data;
-
 	/* get some pseudo constants for clustersize bits */
 	osb->s_clustersize_bits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
 	osb->s_clustersize = 1 << osb->s_clustersize_bits;



More information about the Ocfs2-commits mailing list