Skip to content

Commit a91323e

Browse files
Andreas GruenbacherAstralBob
authored andcommitted
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 <[email protected]> Signed-off-by: Bob Peterson <[email protected]>
1 parent 6a1c8f6 commit a91323e

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

fs/gfs2/glock.c

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,6 @@ static wait_queue_head_t *glock_waitqueue(struct lm_lockname *name)
112112
return glock_wait_table + hash_32(hash, GLOCK_WAIT_TABLE_BITS);
113113
}
114114

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-
132115
/**
133116
* wake_up_glock - Wake up waiters on a glock
134117
* @gl: the glock
@@ -754,11 +737,15 @@ static struct gfs2_glock *find_insert_glock(struct lm_lockname *name,
754737
struct gfs2_glock *new)
755738
{
756739
struct wait_glock_queue wait;
757-
wait_queue_head_t *wq;
740+
wait_queue_head_t *wq = glock_waitqueue(name);
758741
struct gfs2_glock *gl;
759742

743+
wait.name = name;
744+
init_wait(&wait.wait);
745+
wait.wait.func = glock_wake_function;
746+
760747
again:
761-
prepare_to_wait_on_glock(&wq, &wait, name);
748+
prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
762749
rcu_read_lock();
763750
if (new) {
764751
gl = rhashtable_lookup_get_insert_fast(&gl_hash_table,
@@ -776,7 +763,7 @@ static struct gfs2_glock *find_insert_glock(struct lm_lockname *name,
776763
}
777764
out:
778765
rcu_read_unlock();
779-
finish_wait_on_glock(wq, &wait);
766+
finish_wait(wq, &wait.wait);
780767
return gl;
781768
}
782769

0 commit comments

Comments
 (0)