[Ocfs2-commits] mfasheh commits r2413 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Jun 20 15:35:01 CDT 2005


Author: mfasheh
Signed-off-by: manish
Date: 2005-06-20 15:35:00 -0500 (Mon, 20 Jun 2005)
New Revision: 2413

Modified:
   trunk/fs/ocfs2/alloc.c
   trunk/fs/ocfs2/journal.c
   trunk/fs/ocfs2/super.c
   trunk/fs/ocfs2/super.h
Log:
* push all the heavy work in ocfs2 off the keventd workqueue and onto it's  
  own. this will avoid stalling other smaller work that gets scheduled
  there, and will avoid any deadlocks with respect to i/o timeouts and
  recovery work.

Signed-off-by: manish



Modified: trunk/fs/ocfs2/alloc.c
===================================================================
--- trunk/fs/ocfs2/alloc.c	2005-06-20 18:29:25 UTC (rev 2412)
+++ trunk/fs/ocfs2/alloc.c	2005-06-20 20:35:00 UTC (rev 2413)
@@ -43,6 +43,7 @@
 #include "suballoc.h"
 #include "sysfile.h"
 #include "file.h"
+#include "super.h"
 
 #include "buffer_head_io.h"
 
@@ -1144,8 +1145,8 @@
 		if (cancel)
 			cancel_delayed_work(&osb->osb_truncate_log_wq);
 
-		schedule_delayed_work(&osb->osb_truncate_log_wq,
-				      OCFS2_TRUNCATE_LOG_FLUSH_INTERVAL);
+		queue_delayed_work(ocfs2_wq, &osb->osb_truncate_log_wq,
+				   OCFS2_TRUNCATE_LOG_FLUSH_INTERVAL);
 	}
 }
 
@@ -1321,7 +1322,7 @@
 
 	if (tl_inode) {
 		cancel_delayed_work(&osb->osb_truncate_log_wq);
-		flush_scheduled_work();
+		flush_workqueue(ocfs2_wq);
 
 		status = ocfs2_flush_truncate_log(osb);
 		if (status < 0)

Modified: trunk/fs/ocfs2/journal.c
===================================================================
--- trunk/fs/ocfs2/journal.c	2005-06-20 18:29:25 UTC (rev 2412)
+++ trunk/fs/ocfs2/journal.c	2005-06-20 20:35:00 UTC (rev 2413)
@@ -951,7 +951,7 @@
 
 	spin_lock(&journal->j_lock);
 	list_add_tail(&item->lri_list, &journal->j_la_cleanups);
-	schedule_work(&journal->j_recovery_work);
+	queue_work(ocfs2_wq, &journal->j_recovery_work);
 	spin_unlock(&journal->j_lock);
 }
 

Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c	2005-06-20 18:29:25 UTC (rev 2412)
+++ trunk/fs/ocfs2/super.c	2005-06-20 20:35:00 UTC (rev 2413)
@@ -75,6 +75,11 @@
 
 kmem_cache_t *ocfs2_lock_cache = NULL;
 kmem_cache_t *ocfs2_inode_cachep = NULL;
+/* OCFS2 needs to schedule several differnt types of work which
+ * require cluster locking, disk I/O, recovery waits, etc. Since these
+ * types of work tend to be heavy we avoid using the kernel events
+ * workqueue and schedule on our own. */
+struct workqueue_struct *ocfs2_wq = NULL;
 
 MODULE_AUTHOR("Oracle");
 MODULE_LICENSE("GPL");
@@ -510,7 +515,13 @@
 		mlog_errno(status);
 		goto leave;
 	}
-	
+
+	ocfs2_wq = create_singlethread_workqueue("ocfs2_wq");
+	if (!ocfs2_wq) {
+		status = -ENOMEM;
+		goto leave;
+	}
+
 	spin_lock(&ocfs2_globals_lock);
 	osb_id = 0;
 	spin_unlock(&ocfs2_globals_lock);
@@ -534,9 +545,13 @@
 
 static void __exit ocfs2_exit(void)
 {
-
 	mlog_entry_void();
 
+	if (ocfs2_wq) {
+		flush_workqueue(ocfs2_wq);
+		destroy_workqueue(ocfs2_wq);
+	}
+
 	ocfs2_free_mem_caches();
 
 	/* Deinit the proc interface */
@@ -965,7 +980,7 @@
 	/* At this point, we know that no more recovery threads can be
 	 * launched, so wait for any recovery completion work to
 	 * complete. */
-	flush_scheduled_work();
+	flush_workqueue(ocfs2_wq);
 
 	ocfs2_journal_shutdown(osb);
 

Modified: trunk/fs/ocfs2/super.h
===================================================================
--- trunk/fs/ocfs2/super.h	2005-06-20 18:29:25 UTC (rev 2412)
+++ trunk/fs/ocfs2/super.h	2005-06-20 20:35:00 UTC (rev 2413)
@@ -26,6 +26,8 @@
 #ifndef OCFS2_SUPER_H
 #define OCFS2_SUPER_H
 
+extern struct workqueue_struct *ocfs2_wq;
+
 int ocfs2_publish_get_mount_state(ocfs2_super *osb,
 				  int node_num);
 



More information about the Ocfs2-commits mailing list