diff options
| author | Andreas Gruenbacher <agruenba@redhat.com> | 2017-08-04 08:40:45 -0400 |
|---|---|---|
| committer | Bob Peterson <rpeterso@redhat.com> | 2017-08-10 11:51:02 -0400 |
| commit | a91323e255fa8bc84b0acf63376b395c534a38fa (patch) | |
| tree | f193b2fd5dbe00591267426cf09021bb599d35d1 | |
| parent | 6a1c8f6dcf815d96197a2723781cf700925d17ed (diff) | |
gfs2: Clean up waiting on glocks
The prepare_to_wait_on_glock and finish_wait_on_glock functions introduced in
commit 56a365be "gfs2: gfs2_glock_get: Wait on freeing glocks" are
better removed, resulting in cleaner code.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
| -rw-r--r-- | fs/gfs2/glock.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index 5ad757f0ce60..ffca19598525 100644 --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c | |||
| @@ -112,23 +112,6 @@ static wait_queue_head_t *glock_waitqueue(struct lm_lockname *name) | |||
| 112 | return glock_wait_table + hash_32(hash, GLOCK_WAIT_TABLE_BITS); | 112 | return glock_wait_table + hash_32(hash, GLOCK_WAIT_TABLE_BITS); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | static void prepare_to_wait_on_glock(wait_queue_head_t **wq, | ||
| 116 | struct wait_glock_queue *wait, | ||
| 117 | struct lm_lockname *name) | ||
| 118 | { | ||
| 119 | wait->name = name; | ||
| 120 | init_wait(&wait->wait); | ||
| 121 | wait->wait.func = glock_wake_function; | ||
| 122 | *wq = glock_waitqueue(name); | ||
| 123 | prepare_to_wait(*wq, &wait->wait, TASK_UNINTERRUPTIBLE); | ||
| 124 | } | ||
| 125 | |||
| 126 | static void finish_wait_on_glock(wait_queue_head_t *wq, | ||
| 127 | struct wait_glock_queue *wait) | ||
| 128 | { | ||
| 129 | finish_wait(wq, &wait->wait); | ||
| 130 | } | ||
| 131 | |||
| 132 | /** | 115 | /** |
| 133 | * wake_up_glock - Wake up waiters on a glock | 116 | * wake_up_glock - Wake up waiters on a glock |
| 134 | * @gl: the glock | 117 | * @gl: the glock |
| @@ -754,11 +737,15 @@ static struct gfs2_glock *find_insert_glock(struct lm_lockname *name, | |||
| 754 | struct gfs2_glock *new) | 737 | struct gfs2_glock *new) |
| 755 | { | 738 | { |
| 756 | struct wait_glock_queue wait; | 739 | struct wait_glock_queue wait; |
| 757 | wait_queue_head_t *wq; | 740 | wait_queue_head_t *wq = glock_waitqueue(name); |
| 758 | struct gfs2_glock *gl; | 741 | struct gfs2_glock *gl; |
| 759 | 742 | ||
| 743 | wait.name = name; | ||
| 744 | init_wait(&wait.wait); | ||
| 745 | wait.wait.func = glock_wake_function; | ||
| 746 | |||
| 760 | again: | 747 | again: |
| 761 | prepare_to_wait_on_glock(&wq, &wait, name); | 748 | prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE); |
| 762 | rcu_read_lock(); | 749 | rcu_read_lock(); |
| 763 | if (new) { | 750 | if (new) { |
| 764 | gl = rhashtable_lookup_get_insert_fast(&gl_hash_table, | 751 | gl = rhashtable_lookup_get_insert_fast(&gl_hash_table, |
| @@ -776,7 +763,7 @@ again: | |||
| 776 | } | 763 | } |
| 777 | out: | 764 | out: |
| 778 | rcu_read_unlock(); | 765 | rcu_read_unlock(); |
| 779 | finish_wait_on_glock(wq, &wait); | 766 | finish_wait(wq, &wait.wait); |
| 780 | return gl; | 767 | return gl; |
| 781 | } | 768 | } |
| 782 | 769 | ||
