Lines Matching +full:even +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) {
66 WARN_ON(o2nm_single_cluster->cl_fence_method >=
96 spin_lock_bh(&qs->qs_lock);
98 lowest_hb = find_first_bit(qs->qs_hb_bm, O2NM_MAX_NODES);
100 lowest_reachable = test_bit(lowest_hb, qs->qs_conn_bm);
103 "lowest: %d (%sreachable)\n", qs->qs_heartbeating,
104 qs->qs_connected, lowest_hb, lowest_reachable ? "" : "un");
106 if (!test_bit(o2nm_this_node(), qs->qs_hb_bm) ||
107 qs->qs_heartbeating == 1)
110 if (qs->qs_heartbeating & 1) {
111 /* the odd numbered cluster case is straight forward --
113 quorum = (qs->qs_heartbeating + 1)/2;
114 if (qs->qs_connected < quorum) {
118 qs->qs_connected, quorum,
119 qs->qs_heartbeating);
123 /* the even numbered cluster adds the possibility of each half
126 * the lowest numbered node */
127 quorum = qs->qs_heartbeating / 2;
128 if (qs->qs_connected < quorum) {
132 qs->qs_connected, quorum,
133 qs->qs_heartbeating);
136 else if ((qs->qs_connected == quorum) &&
139 "connected to a half-quorum of %u out of %u "
141 "node %u\n", quorum, qs->qs_heartbeating,
149 spin_unlock_bh(&qs->qs_lock);
154 qs->qs_heartbeating, qs->qs_connected, lowest_hb,
156 spin_unlock_bh(&qs->qs_lock);
164 assert_spin_locked(&qs->qs_lock);
166 if (!test_and_set_bit(node, qs->qs_hold_bm)) {
167 qs->qs_holds++;
168 mlog_bug_on_msg(qs->qs_holds == O2NM_MAX_NODES,
170 mlog(0, "node %u, %d total\n", node, qs->qs_holds);
176 assert_spin_locked(&qs->qs_lock);
178 if (test_and_clear_bit(node, qs->qs_hold_bm)) {
179 mlog(0, "node %u, %d total\n", node, qs->qs_holds - 1);
180 if (--qs->qs_holds == 0) {
181 if (qs->qs_pending) {
182 qs->qs_pending = 0;
183 schedule_work(&qs->qs_work);
186 mlog_bug_on_msg(qs->qs_holds < 0, "node %u, holds %d\n",
187 node, qs->qs_holds);
199 spin_lock_bh(&qs->qs_lock);
201 qs->qs_heartbeating++;
202 mlog_bug_on_msg(qs->qs_heartbeating == O2NM_MAX_NODES,
204 mlog_bug_on_msg(test_bit(node, qs->qs_hb_bm), "node %u\n", node);
205 set_bit(node, qs->qs_hb_bm);
207 mlog(0, "node %u, %d total\n", node, qs->qs_heartbeating);
209 if (!test_bit(node, qs->qs_conn_bm))
214 spin_unlock_bh(&qs->qs_lock);
223 spin_lock_bh(&qs->qs_lock);
225 qs->qs_heartbeating--;
226 mlog_bug_on_msg(qs->qs_heartbeating < 0,
228 node, qs->qs_heartbeating);
229 mlog_bug_on_msg(!test_bit(node, qs->qs_hb_bm), "node %u\n", node);
230 clear_bit(node, qs->qs_hb_bm);
232 mlog(0, "node %u, %d total\n", node, qs->qs_heartbeating);
236 spin_unlock_bh(&qs->qs_lock);
240 * even though we've lost it's conn. it must only be called after conn_err
248 spin_lock_bh(&qs->qs_lock);
252 qs->qs_pending = 1;
255 spin_unlock_bh(&qs->qs_lock);
267 spin_lock_bh(&qs->qs_lock);
269 qs->qs_connected++;
270 mlog_bug_on_msg(qs->qs_connected == O2NM_MAX_NODES,
272 mlog_bug_on_msg(test_bit(node, qs->qs_conn_bm), "node %u\n", node);
273 set_bit(node, qs->qs_conn_bm);
275 mlog(0, "node %u, %d total\n", node, qs->qs_connected);
277 if (!test_bit(node, qs->qs_hb_bm))
282 spin_unlock_bh(&qs->qs_lock);
293 spin_lock_bh(&qs->qs_lock);
295 if (test_bit(node, qs->qs_conn_bm)) {
296 qs->qs_connected--;
297 mlog_bug_on_msg(qs->qs_connected < 0,
299 node, qs->qs_connected);
301 clear_bit(node, qs->qs_conn_bm);
303 if (test_bit(node, qs->qs_hb_bm))
307 mlog(0, "node %u, %d total\n", node, qs->qs_connected);
310 spin_unlock_bh(&qs->qs_lock);
317 spin_lock_init(&qs->qs_lock);
318 INIT_WORK(&qs->qs_work, o2quo_make_decision);
325 flush_work(&qs->qs_work);