mtd/fs/jffs2 background.c,1.32,1.33 os-linux.h,1.20,1.21

David Woodhouse dwmw2 at infradead.org
Tue Nov 12 04:44:32 EST 2002


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv29866

Modified Files:
	background.c os-linux.h 
Log Message:
2.5-compatible signal mask lock stuff.


Index: background.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/background.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- background.c	9 Sep 2002 16:29:08 -0000	1.32
+++ background.c	12 Nov 2002 09:44:30 -0000	1.33
@@ -66,7 +66,7 @@
 		/* stop a eventually scheduled wbuf flush timer */
 		del_timer_sync(&c->wbuf_timer);
 		/* make sure, that a scheduled wbuf flush task is completed */
-		flush_scheduled_tasks();
+		flush_scheduled_work();
 	}
 
 	spin_lock_bh(&c->erase_completion_lock);
@@ -87,18 +87,18 @@
 	c->gc_task = current;
 	up(&c->gc_thread_start);
 
-        sprintf(current->comm, "jffs2_gcd_mtd%d", c->mtd->index);
+	sprintf(current->comm, "jffs2_gcd_mtd%d", c->mtd->index);
 
 	set_user_nice(current, 10);
 
 	for (;;) {
-		spin_lock_irq(&current->sigmask_lock);
+		spin_lock_irq(&current_sig_lock);
 		siginitsetinv (&current->blocked, sigmask(SIGHUP) | sigmask(SIGKILL) | sigmask(SIGSTOP) | sigmask(SIGCONT));
 		recalc_sigpending();
-		spin_unlock_irq(&current->sigmask_lock);
+		spin_unlock_irq(&current_sig_lock);
 
 		if (!thread_should_wake(c)) {
-                        set_current_state (TASK_INTERRUPTIBLE);
+			set_current_state (TASK_INTERRUPTIBLE);
 			D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n"));
 			/* Yes, there's a race here; we checked thread_should_wake() before
 			   setting current->state to TASK_INTERRUPTIBLE. But it doesn't
@@ -106,30 +106,30 @@
 			   is only an optimisation anyway. */
 			schedule();
 		}
-                
+
 		cond_resched();
 
-                /* Put_super will send a SIGKILL and then wait on the sem. 
-                 */
-                while (signal_pending(current)) {
-                        siginfo_t info;
-                        unsigned long signr;
-
-                        spin_lock_irq(&current->sigmask_lock);
-                        signr = dequeue_signal(&current->blocked, &info);
-                        spin_unlock_irq(&current->sigmask_lock);
-
-                        switch(signr) {
-                        case SIGSTOP:
-                                D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGSTOP received.\n"));
-                                set_current_state(TASK_STOPPED);
-                                schedule();
-                                break;
+		/* Put_super will send a SIGKILL and then wait on the sem. 
+		 */
+		while (signal_pending(current)) {
+			siginfo_t info;
+			unsigned long signr;
+
+			spin_lock_irq(&current_sig_lock);
+			signr = dequeue_signal(&current->blocked, &info);
+			spin_unlock_irq(&current_sig_lock);
+
+			switch(signr) {
+			case SIGSTOP:
+				D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGSTOP received.\n"));
+				set_current_state(TASK_STOPPED);
+				schedule();
+				break;
 
-                        case SIGKILL:
-                                D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGKILL received.\n"));
+			case SIGKILL:
+				D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): SIGKILL received.\n"));
 				spin_lock_bh(&c->erase_completion_lock);
-                                c->gc_task = NULL;
+				c->gc_task = NULL;
 				spin_unlock_bh(&c->erase_completion_lock);
 				complete_and_exit(&c->gc_thread_exit, 0);
 
@@ -138,14 +138,13 @@
 				break;
 			default:
 				D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): signal %ld received\n", signr));
-
-                        }
-                }
+			}
+		}
 		/* We don't want SIGHUP to interrupt us. STOP and KILL are OK though. */
-		spin_lock_irq(&current->sigmask_lock);
+		spin_lock_irq(&current_sig_lock);
 		siginitsetinv (&current->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP) | sigmask(SIGCONT));
 		recalc_sigpending();
-		spin_unlock_irq(&current->sigmask_lock);
+		spin_unlock_irq(&current_sig_lock);
 
 		D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread(): pass\n"));
 		jffs2_garbage_collect_pass(c);

Index: os-linux.h
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/os-linux.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- os-linux.h	11 Nov 2002 13:45:20 -0000	1.20
+++ os-linux.h	12 Nov 2002 09:44:30 -0000	1.21
@@ -49,6 +49,14 @@
 #define JFFS2_F_I_RDEV_MAJ(f) (MAJOR(to_kdev_t(OFNI_EDONI_2SFFJ(f)->i_rdev)))
 #endif
 
+/* Hmmm. P'raps generic code should only ever see versions of signal
+   functions which do the locking automatically? */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,40)
+#define current_sig_lock current->sigmask_lock
+#else
+#define current_sig_lock current->sig->siglock
+#endif
+
 static inline void jffs2_init_inode_info(struct jffs2_inode_info *f)
 {
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2)





More information about the linux-mtd-cvs mailing list