Use __set_current_state() instead of current->state = (take 1)
PATCH 1/1 Use __set_current_state() instead of current->state = (take 1)
Hi all
In fs/*.c, many functions manually set the task state directly accessing current->state, or with a macro, kind of inconsistently. This patch changes all of them to use [__]set_current_state().
Changelog:
- Ported forward to 2.5.52
dquot.c renamed from dquot.c:1.1.1.4 +3 -3
@@ -264,7 +264,7 @@ goto repeat; }remove_wait_queue (&dquot->dq_wait_lock, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING ); }static inline void wait_on_dquot (struct dquot *dquot)
@@ -298,7 +298,7 @@ goto repeat; }remove_wait_queue (&dquot->dq_wait_free, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING ); }/* Wait for all duplicated dquot references to be dropped */
@@ -314,7 +314,7 @@ goto repeat; }remove_wait_queue (&dquot->dq_wait_free, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING ); }static int read_dqblk (struct dquot *dquot)
exec.c renamed from exec.c:1.1.1.8 +1 -1
@@ -587,7 +587,7 @@ count =1 ;while (atomic_read (&oldsig->count) > count) { oldsig->group_exit_task = current; - current->state =TASK_UNINTERRUPTIBLE ; +__set_current_state (TASK_UNINTERRUPTIBLE );spin_unlock_irq (&oldsig->siglock);schedule ();spin_lock_irq (&oldsig->siglock);
inode.c renamed from inode.c:1.1.1.6 +1 -1
@@ -1195,7 +1195,7 @@ goto repeat; }remove_wait_queue (wq, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING ); }void wake_up_inode (struct inode *inode)
locks.c renamed from locks.c:1.1.1.6 +2 -2
@@ -571,7 +571,7 @@int result =0 ;DECLARE_WAITQUEUE (wait, current); - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );add_wait_queue (fl_wait, &wait);if (timeout ==0 )schedule ();
@@ -580,7 +580,7 @@if (signal_pending (current)) result = -ERESTARTSYS ;remove_wait_queue (fl_wait, &wait); - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );return result; }
namei.c renamed from namei.c:1.1.1.6 +1 -1
@@ -410,7 +410,7 @@if (current->total_link_count >=40 ) goto loop;if (need_resched ()) { - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );schedule (); } err =security_inode_follow_link (dentry, nd);
select.c renamed from select.c:1.1.1.3 +2 -2
@@ -235,7 +235,7 @@ } __timeout =schedule_timeout (__timeout); } - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );poll_freewait (&table);
@@ -417,7 +417,7 @@break ; timeout =schedule_timeout (timeout); } - current->state =TASK_RUNNING ; +__set_current_state (TASK_RUNNING );return count; }
Signature · 1 line
Inaky Perez-Gonzalez -- Not speaking for Intel - opinions are my own [or my fault]
Quoted 4 lines · Inaky Perez-Gonzalez
In
fs/*.c, many functions manually set the task state directly accessingcurrent->state, or with a macro, kind of inconsistently. This patch changes all of them to use [__]set_current_state().
Some of these should probably be set_current_state(). I realize the current code is equivalent to __set_current_state() but it might as well be done right.
locks.c line 576
Quoted 11 lines
diff -u fs/locks.c:1.1.1.6 fs/locks.c:1.1.1.1.6.2
locks.c renamed from locks.c:1.1.1.6 +1
-1@@ -571,7 +571,7 @@int result =0 ;DECLARE_WAITQUEUE (wait, current); - current->state =TASK_INTERRUPTIBLE ; +__set_current_state (TASK_INTERRUPTIBLE );add_wait_queue (fl_wait, &wait);if (timeout ==0 )
At least this guy should be set_current_state(), on quick glance.
When in doubt just use set_current_state()..
Robert Love