Cleanup of current->state for __set_current_state in linu x/fs/*.c

Cleanup of current->state for __set_current_state in linu x/fs/*.c

Post by Perez-Gonzalez, Inak » Fri, 18 Oct 2002 21:20:12



Hi All

This is a simple patch to remove all direct usage of
current->state in fs/*.c and use the helper __set_current_state().

Applies vs 2.5.43

Maybe it'd be better to use set_current_state() so it
is truly SMP safe. I was wondering, but I did not want
to change it without someone confirming a good reason.

Cheers,

diff -urN linux-2.5.43.orig/fs/dquot.c linux-2.5.43/fs/dquot.c
--- linux-2.5.43.orig/fs/dquot.c        Tue Oct 15 20:28:29 2002

                goto repeat;
        }
        remove_wait_queue(&dquot->dq_wait_lock, &wait);
-       current->state = TASK_RUNNING;
+       __set_current_state(TASK_RUNNING);
 }


                goto repeat;
        }
        remove_wait_queue(&dquot->dq_wait_free, &wait);
-       current->state = TASK_RUNNING;
+       __set_current_state(TASK_RUNNING);
 }


                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)
diff -urN linux-2.5.43.orig/fs/exec.c linux-2.5.43/fs/exec.c
--- linux-2.5.43.orig/fs/exec.c Tue Oct 15 20:27:53 2002

                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);
diff -urN linux-2.5.43.orig/fs/inode.c linux-2.5.43/fs/inode.c
--- linux-2.5.43.orig/fs/inode.c        Tue Oct 15 20:29:06 2002

                goto repeat;
        }
        remove_wait_queue(wq, &wait);
-       current->state = TASK_RUNNING;
+       __set_current_state(TASK_RUNNING);
 }

 void wake_up_inode(struct inode *inode)
diff -urN linux-2.5.43.orig/fs/locks.c linux-2.5.43/fs/locks.c
--- linux-2.5.43.orig/fs/locks.c        Tue Oct 15 20:29:04 2002

        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)

        if (signal_pending(current))
                result = -ERESTARTSYS;
        remove_wait_queue(fl_wait, &wait);
-       current->state = TASK_RUNNING;
+       __set_current_state (TASK_RUNNING);
        return result;
 }

diff -urN linux-2.5.43.orig/fs/namei.c linux-2.5.43/fs/namei.c
--- linux-2.5.43.orig/fs/namei.c        Tue Oct 15 20:27:51 2002

        if (current->total_link_count >= 40)
                goto loop;
        if (need_resched()) {
-               current->state = TASK_RUNNING;
+               __set_current_state(TASK_RUNNING);
                schedule();
        }
        err = security_ops->inode_follow_link(dentry, nd);
diff -urN linux-2.5.43.orig/fs/pipe.c linux-2.5.43/fs/pipe.c
--- linux-2.5.43.orig/fs/pipe.c Tue Oct 15 20:28:23 2002

 void pipe_wait(struct inode * inode)
 {
        DECLARE_WAITQUEUE(wait, current);
-       current->state = TASK_INTERRUPTIBLE;
+       __set_current_state(TASK_INTERRUPTIBLE);
        add_wait_queue(PIPE_WAIT(*inode), &wait);
        up(PIPE_SEM(*inode));
        schedule();
        remove_wait_queue(PIPE_WAIT(*inode), &wait);
-       current->state = TASK_RUNNING;
+       __set_current_state(TASK_RUNNING);
        down(PIPE_SEM(*inode));
 }

diff -urN linux-2.5.43.orig/fs/select.c linux-2.5.43/fs/select.c
--- linux-2.5.43.orig/fs/select.c       Tue Oct 15 20:27:09 2002

                }
                __timeout = schedule_timeout(__timeout);
        }
-       current->state = TASK_RUNNING;
+       __set_current_state (TASK_RUNNING);

        poll_freewait(&table);

                        break;
                timeout = schedule_timeout(timeout);
        }
-       current->state = TASK_RUNNING;
+       __set_current_state (TASK_RUNNING);
        return count;
 }

Inaky Perez-Gonzalez -- Not speaking for Intel - opinions are my own [or my
fault]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/