Lines Matching +full:odd +full:- +full:numbered
1 // SPDX-License-Identifier: GPL-2.0-or-later
52 /* this is horribly heavy-handed. It should instead flip the file
60 switch (o2nm_single_cluster->cl_fence_method) { in o2quo_fence_self()
66 WARN_ON(o2nm_single_cluster->cl_fence_method >= in o2quo_fence_self()
96 spin_lock_bh(&qs->qs_lock); in o2quo_make_decision()
98 lowest_hb = find_first_bit(qs->qs_hb_bm, O2NM_MAX_NODES); in o2quo_make_decision()
100 lowest_reachable = test_bit(lowest_hb, qs->qs_conn_bm); in o2quo_make_decision()
103 "lowest: %d (%sreachable)\n", qs->qs_heartbeating, in o2quo_make_decision()
104 qs->qs_connected, lowest_hb, lowest_reachable ? "" : "un"); in o2quo_make_decision()
106 if (!test_bit(o2nm_this_node(), qs->qs_hb_bm) || in o2quo_make_decision()
107 qs->qs_heartbeating == 1) in o2quo_make_decision()
110 if (qs->qs_heartbeating & 1) { in o2quo_make_decision()
111 /* the odd numbered cluster case is straight forward -- in o2quo_make_decision()
113 quorum = (qs->qs_heartbeating + 1)/2; in o2quo_make_decision()
114 if (qs->qs_connected < quorum) { in o2quo_make_decision()
118 qs->qs_connected, quorum, in o2quo_make_decision()
119 qs->qs_heartbeating); in o2quo_make_decision()
123 /* the even numbered cluster adds the possibility of each half in o2quo_make_decision()
126 * the lowest numbered node */ in o2quo_make_decision()
127 quorum = qs->qs_heartbeating / 2; in o2quo_make_decision()
128 if (qs->qs_connected < quorum) { in o2quo_make_decision()
132 qs->qs_connected, quorum, in o2quo_make_decision()
133 qs->qs_heartbeating); in o2quo_make_decision()
136 else if ((qs->qs_connected == quorum) && in o2quo_make_decision()
139 "connected to a half-quorum of %u out of %u " in o2quo_make_decision()
141 "node %u\n", quorum, qs->qs_heartbeating, in o2quo_make_decision()
149 spin_unlock_bh(&qs->qs_lock); in o2quo_make_decision()
154 qs->qs_heartbeating, qs->qs_connected, lowest_hb, in o2quo_make_decision()
156 spin_unlock_bh(&qs->qs_lock); in o2quo_make_decision()
164 assert_spin_locked(&qs->qs_lock); in o2quo_set_hold()
166 if (!test_and_set_bit(node, qs->qs_hold_bm)) { in o2quo_set_hold()
167 qs->qs_holds++; in o2quo_set_hold()
168 mlog_bug_on_msg(qs->qs_holds == O2NM_MAX_NODES, in o2quo_set_hold()
170 mlog(0, "node %u, %d total\n", node, qs->qs_holds); in o2quo_set_hold()
176 assert_spin_locked(&qs->qs_lock); in o2quo_clear_hold()
178 if (test_and_clear_bit(node, qs->qs_hold_bm)) { in o2quo_clear_hold()
179 mlog(0, "node %u, %d total\n", node, qs->qs_holds - 1); in o2quo_clear_hold()
180 if (--qs->qs_holds == 0) { in o2quo_clear_hold()
181 if (qs->qs_pending) { in o2quo_clear_hold()
182 qs->qs_pending = 0; in o2quo_clear_hold()
183 schedule_work(&qs->qs_work); in o2quo_clear_hold()
186 mlog_bug_on_msg(qs->qs_holds < 0, "node %u, holds %d\n", in o2quo_clear_hold()
187 node, qs->qs_holds); in o2quo_clear_hold()
199 spin_lock_bh(&qs->qs_lock); in o2quo_hb_up()
201 qs->qs_heartbeating++; in o2quo_hb_up()
202 mlog_bug_on_msg(qs->qs_heartbeating == O2NM_MAX_NODES, in o2quo_hb_up()
204 mlog_bug_on_msg(test_bit(node, qs->qs_hb_bm), "node %u\n", node); in o2quo_hb_up()
205 set_bit(node, qs->qs_hb_bm); in o2quo_hb_up()
207 mlog(0, "node %u, %d total\n", node, qs->qs_heartbeating); in o2quo_hb_up()
209 if (!test_bit(node, qs->qs_conn_bm)) in o2quo_hb_up()
214 spin_unlock_bh(&qs->qs_lock); in o2quo_hb_up()
223 spin_lock_bh(&qs->qs_lock); in o2quo_hb_down()
225 qs->qs_heartbeating--; in o2quo_hb_down()
226 mlog_bug_on_msg(qs->qs_heartbeating < 0, in o2quo_hb_down()
228 node, qs->qs_heartbeating); in o2quo_hb_down()
229 mlog_bug_on_msg(!test_bit(node, qs->qs_hb_bm), "node %u\n", node); in o2quo_hb_down()
230 clear_bit(node, qs->qs_hb_bm); in o2quo_hb_down()
232 mlog(0, "node %u, %d total\n", node, qs->qs_heartbeating); in o2quo_hb_down()
236 spin_unlock_bh(&qs->qs_lock); in o2quo_hb_down()
248 spin_lock_bh(&qs->qs_lock); in o2quo_hb_still_up()
252 qs->qs_pending = 1; in o2quo_hb_still_up()
255 spin_unlock_bh(&qs->qs_lock); in o2quo_hb_still_up()
267 spin_lock_bh(&qs->qs_lock); in o2quo_conn_up()
269 qs->qs_connected++; in o2quo_conn_up()
270 mlog_bug_on_msg(qs->qs_connected == O2NM_MAX_NODES, in o2quo_conn_up()
272 mlog_bug_on_msg(test_bit(node, qs->qs_conn_bm), "node %u\n", node); in o2quo_conn_up()
273 set_bit(node, qs->qs_conn_bm); in o2quo_conn_up()
275 mlog(0, "node %u, %d total\n", node, qs->qs_connected); in o2quo_conn_up()
277 if (!test_bit(node, qs->qs_hb_bm)) in o2quo_conn_up()
282 spin_unlock_bh(&qs->qs_lock); in o2quo_conn_up()
293 spin_lock_bh(&qs->qs_lock); in o2quo_conn_err()
295 if (test_bit(node, qs->qs_conn_bm)) { in o2quo_conn_err()
296 qs->qs_connected--; in o2quo_conn_err()
297 mlog_bug_on_msg(qs->qs_connected < 0, in o2quo_conn_err()
299 node, qs->qs_connected); in o2quo_conn_err()
301 clear_bit(node, qs->qs_conn_bm); in o2quo_conn_err()
303 if (test_bit(node, qs->qs_hb_bm)) in o2quo_conn_err()
307 mlog(0, "node %u, %d total\n", node, qs->qs_connected); in o2quo_conn_err()
310 spin_unlock_bh(&qs->qs_lock); in o2quo_conn_err()
317 spin_lock_init(&qs->qs_lock); in o2quo_init()
318 INIT_WORK(&qs->qs_work, o2quo_make_decision); in o2quo_init()
325 flush_work(&qs->qs_work); in o2quo_exit()