0001
0002
0003
0004
0005
0006 #ifndef _H_JFS_LOCK
0007 #define _H_JFS_LOCK
0008
0009 #include <linux/spinlock.h>
0010 #include <linux/mutex.h>
0011 #include <linux/sched.h>
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #define __SLEEP_COND(wq, cond, lock_cmd, unlock_cmd) \
0023 do { \
0024 DECLARE_WAITQUEUE(__wait, current); \
0025 \
0026 add_wait_queue(&wq, &__wait); \
0027 for (;;) { \
0028 set_current_state(TASK_UNINTERRUPTIBLE);\
0029 if (cond) \
0030 break; \
0031 unlock_cmd; \
0032 io_schedule(); \
0033 lock_cmd; \
0034 } \
0035 __set_current_state(TASK_RUNNING); \
0036 remove_wait_queue(&wq, &__wait); \
0037 } while (0)
0038
0039 #endif