Lines Matching refs:qs

94 	struct o2quo_state *qs = &o2quo_state;
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) {
113 quorum = (qs->qs_heartbeating + 1)/2;
114 if (qs->qs_connected < quorum) {
118 qs->qs_connected, quorum,
119 qs->qs_heartbeating);
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) &&
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);
162 static void o2quo_set_hold(struct o2quo_state *qs, u8 node)
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);
174 static void o2quo_clear_hold(struct o2quo_state *qs, u8 node)
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);
197 struct o2quo_state *qs = &o2quo_state;
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))
210 o2quo_set_hold(qs, node);
212 o2quo_clear_hold(qs, node);
214 spin_unlock_bh(&qs->qs_lock);
221 struct o2quo_state *qs = &o2quo_state;
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);
234 o2quo_clear_hold(qs, node);
236 spin_unlock_bh(&qs->qs_lock);
246 struct o2quo_state *qs = &o2quo_state;
248 spin_lock_bh(&qs->qs_lock);
252 qs->qs_pending = 1;
253 o2quo_clear_hold(qs, node);
255 spin_unlock_bh(&qs->qs_lock);
265 struct o2quo_state *qs = &o2quo_state;
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))
278 o2quo_set_hold(qs, node);
280 o2quo_clear_hold(qs, node);
282 spin_unlock_bh(&qs->qs_lock);
291 struct o2quo_state *qs = &o2quo_state;
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))
304 o2quo_set_hold(qs, node);
307 mlog(0, "node %u, %d total\n", node, qs->qs_connected);
310 spin_unlock_bh(&qs->qs_lock);
315 struct o2quo_state *qs = &o2quo_state;
317 spin_lock_init(&qs->qs_lock);
318 INIT_WORK(&qs->qs_work, o2quo_make_decision);
323 struct o2quo_state *qs = &o2quo_state;
325 flush_work(&qs->qs_work);