Commit 17a6ecee authored by Bob Peterson's avatar Bob Peterson Committed by Andreas Gruenbacher

gfs2: re-factor function do_promote

This patch simply re-factors function do_promote to reduce the indents.
The logic should be unchanged. This makes future patches more readable.
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent d74d0ce5
...@@ -494,48 +494,47 @@ __acquires(&gl->gl_lockref.lock) ...@@ -494,48 +494,47 @@ __acquires(&gl->gl_lockref.lock)
list_for_each_entry_safe(gh, tmp, &gl->gl_holders, gh_list) { list_for_each_entry_safe(gh, tmp, &gl->gl_holders, gh_list) {
if (!test_bit(HIF_WAIT, &gh->gh_iflags)) if (!test_bit(HIF_WAIT, &gh->gh_iflags))
continue; continue;
if (may_grant(gl, first_gh, gh)) { if (!may_grant(gl, first_gh, gh)) {
if (!incompat_holders_demoted) { /*
demote_incompat_holders(gl, first_gh); * If we get here, it means we may not grant this holder for
incompat_holders_demoted = true; * some reason. If this holder is the head of the list, it
first_gh = gh; * means we have a blocked holder at the head, so return 1.
} */
if (gh->gh_list.prev == &gl->gl_holders && if (gh->gh_list.prev == &gl->gl_holders)
glops->go_instantiate) { return 1;
if (!(gh->gh_flags & GL_SKIP)) { do_error(gl, 0);
spin_unlock(&gl->gl_lockref.lock); break;
/* FIXME: eliminate this eventually */ }
ret = glops->go_instantiate(gh); if (!incompat_holders_demoted) {
spin_lock(&gl->gl_lockref.lock); demote_incompat_holders(gl, first_gh);
if (ret) { incompat_holders_demoted = true;
if (ret == 1) first_gh = gh;
return 2; }
gh->gh_error = ret; if (gh->gh_list.prev == &gl->gl_holders &&
list_del_init(&gh->gh_list); glops->go_instantiate) {
trace_gfs2_glock_queue(gh, 0); if (!(gh->gh_flags & GL_SKIP)) {
gfs2_holder_wake(gh); spin_unlock(&gl->gl_lockref.lock);
goto restart; /* FIXME: eliminate this eventually */
} ret = glops->go_instantiate(gh);
spin_lock(&gl->gl_lockref.lock);
if (ret) {
if (ret == 1)
return 2;
gh->gh_error = ret;
list_del_init(&gh->gh_list);
trace_gfs2_glock_queue(gh, 0);
gfs2_holder_wake(gh);
goto restart;
} }
set_bit(HIF_HOLDER, &gh->gh_iflags);
trace_gfs2_promote(gh);
gfs2_holder_wake(gh);
goto restart;
} }
set_bit(HIF_HOLDER, &gh->gh_iflags); set_bit(HIF_HOLDER, &gh->gh_iflags);
trace_gfs2_promote(gh); trace_gfs2_promote(gh);
gfs2_holder_wake(gh); gfs2_holder_wake(gh);
continue; goto restart;
} }
/* set_bit(HIF_HOLDER, &gh->gh_iflags);
* If we get here, it means we may not grant this holder for trace_gfs2_promote(gh);
* some reason. If this holder is the head of the list, it gfs2_holder_wake(gh);
* means we have a blocked holder at the head, so return 1.
*/
if (gh->gh_list.prev == &gl->gl_holders)
return 1;
do_error(gl, 0);
break;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment