[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [dm-devel] more workqueue play



Hi,

I think I need to be a bit nicer with the spinlock.

--- linux.orig/drivers/md/kcopyd.c	2004-02-17 15:43:10.000000000 +0100
+++ linux/drivers/md/kcopyd.c	2004-02-17 18:04:09.851419000 +0100
@@ -235,6 +235,7 @@
 static void unqueue_pagewait_jobs(struct kcopyd_client *kc)
 {
 	struct list_head *tmp, *tmp2;
+	LIST_HEAD(jobs);
 	unsigned int nr;
 
 	spin_lock(&kc->lock);
@@ -247,10 +248,16 @@
 			break;
 		nr -= job->nr_pages;
 
-		list_del(&job->pagewait_list);
-		queue_job(job, run_pages_job);
+		list_move_tail(&job->pagewait_list, &jobs);
 	}
 	spin_unlock(&kc->lock);
+
+	list_for_each (tmp, &jobs) {
+		struct kcopyd_job *job =
+			list_entry(tmp, struct kcopyd_job, pagewait_list);
+
+		queue_job(job, run_pages_job);
+	}
 }
 
 static void queue_pagewait_job(struct kcopyd_job *job)
@@ -258,7 +265,7 @@
 	struct kcopyd_client *kc = job->kc;
 
 	spin_lock(&kc->lock);
-	list_add(&job->pagewait_list, &kc->pagewait_jobs);
+	list_add_tail(&job->pagewait_list, &kc->pagewait_jobs);
 	spin_unlock(&kc->lock);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]