sched/wait: Standardize 'struct wait_bit_queue' wait-queue entry field name

Rename 'struct wait_bit_queue::wait' to ::wq_entry, to more clearly
name it as a wait-queue entry.

Propagate it to a couple of usage sites where the wait-bit-queue internals
are exposed.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Ingo Molnar 2017-03-05 11:25:39 +01:00
parent 9d9d676f59
commit 2141713616
6 changed files with 35 additions and 36 deletions

View File

@ -1891,11 +1891,11 @@ static void __wait_on_freeing_inode(struct inode *inode)
wait_queue_head_t *wq; wait_queue_head_t *wq;
DEFINE_WAIT_BIT(wait, &inode->i_state, __I_NEW); DEFINE_WAIT_BIT(wait, &inode->i_state, __I_NEW);
wq = bit_waitqueue(&inode->i_state, __I_NEW); wq = bit_waitqueue(&inode->i_state, __I_NEW);
prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
spin_unlock(&inode_hash_lock); spin_unlock(&inode_hash_lock);
schedule(); schedule();
finish_wait(wq, &wait.wait); finish_wait(wq, &wait.wq_entry);
spin_lock(&inode_hash_lock); spin_lock(&inode_hash_lock);
} }
@ -2038,11 +2038,11 @@ static void __inode_dio_wait(struct inode *inode)
DEFINE_WAIT_BIT(q, &inode->i_state, __I_DIO_WAKEUP); DEFINE_WAIT_BIT(q, &inode->i_state, __I_DIO_WAKEUP);
do { do {
prepare_to_wait(wq, &q.wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(wq, &q.wq_entry, TASK_UNINTERRUPTIBLE);
if (atomic_read(&inode->i_dio_count)) if (atomic_read(&inode->i_dio_count))
schedule(); schedule();
} while (atomic_read(&inode->i_dio_count)); } while (atomic_read(&inode->i_dio_count));
finish_wait(wq, &q.wait); finish_wait(wq, &q.wq_entry);
} }
/** /**

View File

@ -2579,10 +2579,10 @@ void jbd2_journal_release_jbd_inode(journal_t *journal,
wait_queue_head_t *wq; wait_queue_head_t *wq;
DEFINE_WAIT_BIT(wait, &jinode->i_flags, __JI_COMMIT_RUNNING); DEFINE_WAIT_BIT(wait, &jinode->i_flags, __JI_COMMIT_RUNNING);
wq = bit_waitqueue(&jinode->i_flags, __JI_COMMIT_RUNNING); wq = bit_waitqueue(&jinode->i_flags, __JI_COMMIT_RUNNING);
prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
spin_unlock(&journal->j_list_lock); spin_unlock(&journal->j_list_lock);
schedule(); schedule();
finish_wait(wq, &wait.wait); finish_wait(wq, &wait.wq_entry);
goto restart; goto restart;
} }

View File

@ -269,12 +269,12 @@ xfs_inew_wait(
DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_INEW_BIT); DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_INEW_BIT);
do { do {
prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
if (!xfs_iflags_test(ip, XFS_INEW)) if (!xfs_iflags_test(ip, XFS_INEW))
break; break;
schedule(); schedule();
} while (true); } while (true);
finish_wait(wq, &wait.wait); finish_wait(wq, &wait.wq_entry);
} }
/* /*

View File

@ -622,12 +622,12 @@ __xfs_iflock(
DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_IFLOCK_BIT); DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_IFLOCK_BIT);
do { do {
prepare_to_wait_exclusive(wq, &wait.wait, TASK_UNINTERRUPTIBLE); prepare_to_wait_exclusive(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
if (xfs_isiflocked(ip)) if (xfs_isiflocked(ip))
io_schedule(); io_schedule();
} while (!xfs_iflock_nowait(ip)); } while (!xfs_iflock_nowait(ip));
finish_wait(wq, &wait.wait); finish_wait(wq, &wait.wq_entry);
} }
STATIC uint STATIC uint
@ -2486,11 +2486,11 @@ __xfs_iunpin_wait(
xfs_iunpin(ip); xfs_iunpin(ip);
do { do {
prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE); prepare_to_wait(wq, &wait.wq_entry, TASK_UNINTERRUPTIBLE);
if (xfs_ipincount(ip)) if (xfs_ipincount(ip))
io_schedule(); io_schedule();
} while (xfs_ipincount(ip)); } while (xfs_ipincount(ip));
finish_wait(wq, &wait.wait); finish_wait(wq, &wait.wq_entry);
} }
void void

View File

@ -38,7 +38,7 @@ struct wait_bit_key {
struct wait_bit_queue { struct wait_bit_queue {
struct wait_bit_key key; struct wait_bit_key key;
struct wait_queue_entry wait; struct wait_queue_entry wq_entry;
}; };
struct wait_queue_head { struct wait_queue_head {
@ -991,11 +991,11 @@ int wake_bit_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync
#define DEFINE_WAIT_BIT(name, word, bit) \ #define DEFINE_WAIT_BIT(name, word, bit) \
struct wait_bit_queue name = { \ struct wait_bit_queue name = { \
.key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \ .key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \
.wait = { \ .wq_entry = { \
.private = current, \ .private = current, \
.func = wake_bit_function, \ .func = wake_bit_function, \
.task_list = \ .task_list = \
LIST_HEAD_INIT((name).wait.task_list), \ LIST_HEAD_INIT((name).wq_entry.task_list), \
}, \ }, \
} }

View File

@ -395,7 +395,7 @@ int wake_bit_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync
{ {
struct wait_bit_key *key = arg; struct wait_bit_key *key = arg;
struct wait_bit_queue *wait_bit struct wait_bit_queue *wait_bit
= container_of(wq_entry, struct wait_bit_queue, wait); = container_of(wq_entry, struct wait_bit_queue, wq_entry);
if (wait_bit->key.flags != key->flags || if (wait_bit->key.flags != key->flags ||
wait_bit->key.bit_nr != key->bit_nr || wait_bit->key.bit_nr != key->bit_nr ||
@ -418,11 +418,11 @@ __wait_on_bit(struct wait_queue_head *wq_head, struct wait_bit_queue *q,
int ret = 0; int ret = 0;
do { do {
prepare_to_wait(wq_head, &q->wait, mode); prepare_to_wait(wq_head, &q->wq_entry, mode);
if (test_bit(q->key.bit_nr, q->key.flags)) if (test_bit(q->key.bit_nr, q->key.flags))
ret = (*action)(&q->key, mode); ret = (*action)(&q->key, mode);
} while (test_bit(q->key.bit_nr, q->key.flags) && !ret); } while (test_bit(q->key.bit_nr, q->key.flags) && !ret);
finish_wait(wq_head, &q->wait); finish_wait(wq_head, &q->wq_entry);
return ret; return ret;
} }
EXPORT_SYMBOL(__wait_on_bit); EXPORT_SYMBOL(__wait_on_bit);
@ -431,9 +431,9 @@ int __sched out_of_line_wait_on_bit(void *word, int bit,
wait_bit_action_f *action, unsigned mode) wait_bit_action_f *action, unsigned mode)
{ {
struct wait_queue_head *wq_head = bit_waitqueue(word, bit); struct wait_queue_head *wq_head = bit_waitqueue(word, bit);
DEFINE_WAIT_BIT(wait, word, bit); DEFINE_WAIT_BIT(wq_entry, word, bit);
return __wait_on_bit(wq_head, &wait, action, mode); return __wait_on_bit(wq_head, &wq_entry, action, mode);
} }
EXPORT_SYMBOL(out_of_line_wait_on_bit); EXPORT_SYMBOL(out_of_line_wait_on_bit);
@ -442,10 +442,10 @@ int __sched out_of_line_wait_on_bit_timeout(
unsigned mode, unsigned long timeout) unsigned mode, unsigned long timeout)
{ {
struct wait_queue_head *wq_head = bit_waitqueue(word, bit); struct wait_queue_head *wq_head = bit_waitqueue(word, bit);
DEFINE_WAIT_BIT(wait, word, bit); DEFINE_WAIT_BIT(wq_entry, word, bit);
wait.key.timeout = jiffies + timeout; wq_entry.key.timeout = jiffies + timeout;
return __wait_on_bit(wq_head, &wait, action, mode); return __wait_on_bit(wq_head, &wq_entry, action, mode);
} }
EXPORT_SYMBOL_GPL(out_of_line_wait_on_bit_timeout); EXPORT_SYMBOL_GPL(out_of_line_wait_on_bit_timeout);
@ -456,7 +456,7 @@ __wait_on_bit_lock(struct wait_queue_head *wq_head, struct wait_bit_queue *q,
int ret = 0; int ret = 0;
for (;;) { for (;;) {
prepare_to_wait_exclusive(wq_head, &q->wait, mode); prepare_to_wait_exclusive(wq_head, &q->wq_entry, mode);
if (test_bit(q->key.bit_nr, q->key.flags)) { if (test_bit(q->key.bit_nr, q->key.flags)) {
ret = action(&q->key, mode); ret = action(&q->key, mode);
/* /*
@ -466,11 +466,11 @@ __wait_on_bit_lock(struct wait_queue_head *wq_head, struct wait_bit_queue *q,
* smp_mb__after_atomic() before wake_up_page(). * smp_mb__after_atomic() before wake_up_page().
*/ */
if (ret) if (ret)
finish_wait(wq_head, &q->wait); finish_wait(wq_head, &q->wq_entry);
} }
if (!test_and_set_bit(q->key.bit_nr, q->key.flags)) { if (!test_and_set_bit(q->key.bit_nr, q->key.flags)) {
if (!ret) if (!ret)
finish_wait(wq_head, &q->wait); finish_wait(wq_head, &q->wq_entry);
return 0; return 0;
} else if (ret) { } else if (ret) {
return ret; return ret;
@ -483,9 +483,9 @@ int __sched out_of_line_wait_on_bit_lock(void *word, int bit,
wait_bit_action_f *action, unsigned mode) wait_bit_action_f *action, unsigned mode)
{ {
struct wait_queue_head *wq_head = bit_waitqueue(word, bit); struct wait_queue_head *wq_head = bit_waitqueue(word, bit);
DEFINE_WAIT_BIT(wait, word, bit); DEFINE_WAIT_BIT(wq_entry, word, bit);
return __wait_on_bit_lock(wq_head, &wait, action, mode); return __wait_on_bit_lock(wq_head, &wq_entry, action, mode);
} }
EXPORT_SYMBOL(out_of_line_wait_on_bit_lock); EXPORT_SYMBOL(out_of_line_wait_on_bit_lock);
@ -538,8 +538,7 @@ static int wake_atomic_t_function(struct wait_queue_entry *wq_entry, unsigned mo
void *arg) void *arg)
{ {
struct wait_bit_key *key = arg; struct wait_bit_key *key = arg;
struct wait_bit_queue *wait_bit struct wait_bit_queue *wait_bit = container_of(wq_entry, struct wait_bit_queue, wq_entry);
= container_of(wq_entry, struct wait_bit_queue, wait);
atomic_t *val = key->flags; atomic_t *val = key->flags;
if (wait_bit->key.flags != key->flags || if (wait_bit->key.flags != key->flags ||
@ -562,24 +561,24 @@ int __wait_on_atomic_t(struct wait_queue_head *wq_head, struct wait_bit_queue *q
int ret = 0; int ret = 0;
do { do {
prepare_to_wait(wq_head, &q->wait, mode); prepare_to_wait(wq_head, &q->wq_entry, mode);
val = q->key.flags; val = q->key.flags;
if (atomic_read(val) == 0) if (atomic_read(val) == 0)
break; break;
ret = (*action)(val); ret = (*action)(val);
} while (!ret && atomic_read(val) != 0); } while (!ret && atomic_read(val) != 0);
finish_wait(wq_head, &q->wait); finish_wait(wq_head, &q->wq_entry);
return ret; return ret;
} }
#define DEFINE_WAIT_ATOMIC_T(name, p) \ #define DEFINE_WAIT_ATOMIC_T(name, p) \
struct wait_bit_queue name = { \ struct wait_bit_queue name = { \
.key = __WAIT_ATOMIC_T_KEY_INITIALIZER(p), \ .key = __WAIT_ATOMIC_T_KEY_INITIALIZER(p), \
.wait = { \ .wq_entry = { \
.private = current, \ .private = current, \
.func = wake_atomic_t_function, \ .func = wake_atomic_t_function, \
.task_list = \ .task_list = \
LIST_HEAD_INIT((name).wait.task_list), \ LIST_HEAD_INIT((name).wq_entry.task_list), \
}, \ }, \
} }
@ -587,9 +586,9 @@ __sched int out_of_line_wait_on_atomic_t(atomic_t *p, int (*action)(atomic_t *),
unsigned mode) unsigned mode)
{ {
struct wait_queue_head *wq_head = atomic_t_waitqueue(p); struct wait_queue_head *wq_head = atomic_t_waitqueue(p);
DEFINE_WAIT_ATOMIC_T(wait, p); DEFINE_WAIT_ATOMIC_T(wq_entry, p);
return __wait_on_atomic_t(wq_head, &wait, action, mode); return __wait_on_atomic_t(wq_head, &wq_entry, action, mode);
} }
EXPORT_SYMBOL(out_of_line_wait_on_atomic_t); EXPORT_SYMBOL(out_of_line_wait_on_atomic_t);