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

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
Loading
Loading
Loading
Loading
+35 −36
Original line number Diff line number Diff line
@@ -494,7 +494,17 @@ __acquires(&gl->gl_lockref.lock)
	list_for_each_entry_safe(gh, tmp, &gl->gl_holders, gh_list) {
		if (!test_bit(HIF_WAIT, &gh->gh_iflags))
			continue;
		if (may_grant(gl, first_gh, gh)) {
		if (!may_grant(gl, first_gh, gh)) {
			/*
			 * If we get here, it means we may not grant this holder for
			 * some reason. If this holder is the head of the list, it
			 * 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;
		}
		if (!incompat_holders_demoted) {
			demote_incompat_holders(gl, first_gh);
			incompat_holders_demoted = true;
@@ -525,17 +535,6 @@ __acquires(&gl->gl_lockref.lock)
		set_bit(HIF_HOLDER, &gh->gh_iflags);
		trace_gfs2_promote(gh);
		gfs2_holder_wake(gh);
			continue;
		}
		/*
		 * If we get here, it means we may not grant this holder for
		 * some reason. If this holder is the head of the list, it
		 * 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;
}