1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) International Business Machines Corp., 2000-2001
4 * Portions Copyright (C) Christoph Hellwig, 2001-2002
9 #include <linux/spinlock.h>
10 #include <linux/mutex.h>
11 #include <linux/sched.h>
18 * Conditional sleep where condition is protected by spinlock
20 * lock_cmd and unlock_cmd take and release the spinlock
22 #define __SLEEP_COND(wq, cond, lock_cmd, unlock_cmd) \
24 DECLARE_WAITQUEUE(__wait, current); \
26 add_wait_queue(&wq, &__wait); \
28 set_current_state(TASK_UNINTERRUPTIBLE);\
35 __set_current_state(TASK_RUNNING); \
36 remove_wait_queue(&wq, &__wait); \
39 #endif /* _H_JFS_LOCK */