Lines Matching full:os

25 	union drbd_state os;  member
280 static void after_state_ch(struct drbd_device *device, union drbd_state os,
285 static enum drbd_state_rv is_valid_transition(union drbd_state os, union drbd_state ns);
286 static union drbd_state sanitize_state(struct drbd_device *device, union drbd_state os,
464 * @os: old (current) state.
468 union drbd_state os, union drbd_state ns) in cl_wide_st_chg() argument
470 return (os.conn >= C_CONNECTED && ns.conn >= C_CONNECTED && in cl_wide_st_chg()
471 ((os.role != R_PRIMARY && ns.role == R_PRIMARY) || in cl_wide_st_chg()
472 (os.conn != C_STARTING_SYNC_T && ns.conn == C_STARTING_SYNC_T) || in cl_wide_st_chg()
473 (os.conn != C_STARTING_SYNC_S && ns.conn == C_STARTING_SYNC_S) || in cl_wide_st_chg()
474 (os.disk != D_FAILED && ns.disk == D_FAILED))) || in cl_wide_st_chg()
475 (os.conn >= C_CONNECTED && ns.conn == C_DISCONNECTING) || in cl_wide_st_chg()
476 (os.conn == C_CONNECTED && ns.conn == C_VERIFY_S) || in cl_wide_st_chg()
477 (os.conn == C_CONNECTED && ns.conn == C_WF_REPORT_PARAMS); in cl_wide_st_chg()
481 apply_mask_val(union drbd_state os, union drbd_state mask, union drbd_state val) in apply_mask_val() argument
484 ns.i = (os.i & ~mask.i) | val.i; in apply_mask_val()
520 union drbd_state os, ns; in _req_st_cond() local
531 os = drbd_read_state(device); in _req_st_cond()
532 ns = sanitize_state(device, os, apply_mask_val(os, mask, val), NULL); in _req_st_cond()
533 rv = is_valid_transition(os, ns); in _req_st_cond()
537 if (!cl_wide_st_chg(device, os, ns)) in _req_st_cond()
542 rv = is_valid_soft_transition(os, ns, first_peer_device(device)->connection); in _req_st_cond()
568 union drbd_state os, ns; in drbd_req_state() local
580 os = drbd_read_state(device); in drbd_req_state()
581 ns = sanitize_state(device, os, apply_mask_val(os, mask, val), NULL); in drbd_req_state()
582 rv = is_valid_transition(os, ns); in drbd_req_state()
588 if (cl_wide_st_chg(device, os, ns)) { in drbd_req_state()
591 rv = is_valid_soft_transition(os, ns, first_peer_device(device)->connection); in drbd_req_state()
596 print_st_err(device, os, ns, rv); in drbd_req_state()
603 print_st_err(device, os, ns, rv); in drbd_req_state()
612 print_st_err(device, os, ns, rv); in drbd_req_state()
733 void print_st_err(struct drbd_device *device, union drbd_state os, in print_st_err() argument
739 print_st(device, " state", os); in print_st_err()
743 static long print_state_change(char *pb, union drbd_state os, union drbd_state ns, in print_state_change() argument
750 if (ns.role != os.role && flags & CS_DC_ROLE) in print_state_change()
752 drbd_role_str(os.role), in print_state_change()
754 if (ns.peer != os.peer && flags & CS_DC_PEER) in print_state_change()
756 drbd_role_str(os.peer), in print_state_change()
758 if (ns.conn != os.conn && flags & CS_DC_CONN) in print_state_change()
760 drbd_conn_str(os.conn), in print_state_change()
762 if (ns.disk != os.disk && flags & CS_DC_DISK) in print_state_change()
764 drbd_disk_str(os.disk), in print_state_change()
766 if (ns.pdsk != os.pdsk && flags & CS_DC_PDSK) in print_state_change()
768 drbd_disk_str(os.pdsk), in print_state_change()
774 static void drbd_pr_state_change(struct drbd_device *device, union drbd_state os, union drbd_state … in drbd_pr_state_change() argument
780 pbp += print_state_change(pbp, os, ns, flags ^ CS_DC_MASK); in drbd_pr_state_change()
782 if (ns.aftr_isp != os.aftr_isp) in drbd_pr_state_change()
784 os.aftr_isp, in drbd_pr_state_change()
786 if (ns.peer_isp != os.peer_isp) in drbd_pr_state_change()
788 os.peer_isp, in drbd_pr_state_change()
790 if (ns.user_isp != os.user_isp) in drbd_pr_state_change()
792 os.user_isp, in drbd_pr_state_change()
799 static void conn_pr_state_change(struct drbd_connection *connection, union drbd_state os, union drb… in conn_pr_state_change() argument
805 pbp += print_state_change(pbp, os, ns, flags); in conn_pr_state_change()
807 if (is_susp(ns) != is_susp(os) && flags & CS_DC_SUSP) in conn_pr_state_change()
809 is_susp(os), in conn_pr_state_change()
907 * @os: old state.
912 is_valid_soft_transition(union drbd_state os, union drbd_state ns, struct drbd_connection *connecti… in is_valid_soft_transition() argument
917 os.conn > C_CONNECTED) in is_valid_soft_transition()
920 if (ns.conn == C_DISCONNECTING && os.conn == C_STANDALONE) in is_valid_soft_transition()
923 if (ns.disk > D_ATTACHING && os.disk == D_DISKLESS) in is_valid_soft_transition()
926 if (ns.conn == C_WF_CONNECTION && os.conn < C_UNCONNECTED) in is_valid_soft_transition()
929 if (ns.disk == D_OUTDATED && os.disk < D_OUTDATED && os.disk != D_ATTACHING) in is_valid_soft_transition()
932 if (ns.conn == C_DISCONNECTING && os.conn == C_UNCONNECTED) in is_valid_soft_transition()
938 !((ns.conn == C_WF_REPORT_PARAMS && os.conn == C_WF_CONNECTION) || in is_valid_soft_transition()
939 (ns.conn >= C_CONNECTED && os.conn == C_WF_REPORT_PARAMS))) in is_valid_soft_transition()
945 if (os.role != R_PRIMARY && ns.role == R_PRIMARY in is_valid_soft_transition()
948 && (ns.conn <= C_WF_SYNC_UUID || ns.conn != os.conn)) in is_valid_soft_transition()
951 if ((ns.conn == C_VERIFY_S || ns.conn == C_VERIFY_T) && os.conn < C_CONNECTED) in is_valid_soft_transition()
955 ns.conn != os.conn && os.conn > C_CONNECTED) in is_valid_soft_transition()
959 os.conn < C_CONNECTED) in is_valid_soft_transition()
963 && os.conn < C_WF_REPORT_PARAMS) in is_valid_soft_transition()
967 os.conn < C_CONNECTED && os.pdsk > D_OUTDATED) in is_valid_soft_transition()
1011 * @os: old state.
1014 is_valid_transition(union drbd_state os, union drbd_state ns) in is_valid_transition() argument
1018 rv = is_valid_conn_transition(os.conn, ns.conn); in is_valid_transition()
1021 if (ns.disk == D_FAILED && os.disk == D_DISKLESS) in is_valid_transition()
1045 * @os: old state.
1052 static union drbd_state sanitize_state(struct drbd_device *device, union drbd_state os, in sanitize_state() argument
1195 !(os.role == R_PRIMARY && os.conn < C_CONNECTED && os.pdsk > D_OUTDATED)) in sanitize_state()
1200 !(os.role == R_PRIMARY && os.disk < D_UP_TO_DATE && os.pdsk < D_UP_TO_DATE)) in sanitize_state()
1268 union drbd_state os; in _drbd_set_state() local
1274 os = drbd_read_state(device); in _drbd_set_state()
1276 ns = sanitize_state(device, os, ns, &ssw); in _drbd_set_state()
1277 if (ns.i == os.i) in _drbd_set_state()
1280 rv = is_valid_transition(os, ns); in _drbd_set_state()
1293 if (is_valid_state(device, os) == rv) in _drbd_set_state()
1294 rv = is_valid_soft_transition(os, ns, connection); in _drbd_set_state()
1296 rv = is_valid_soft_transition(os, ns, connection); in _drbd_set_state()
1301 print_st_err(device, os, ns, rv); in _drbd_set_state()
1307 drbd_pr_state_change(device, os, ns, flags); in _drbd_set_state()
1313 conn_pr_state_change(connection, os, ns, in _drbd_set_state()
1320 if ((os.disk != D_FAILED && ns.disk == D_FAILED) || in _drbd_set_state()
1321 (os.disk != D_DISKLESS && ns.disk == D_DISKLESS)) in _drbd_set_state()
1324 if (!is_sync_state(os.conn) && is_sync_state(ns.conn)) in _drbd_set_state()
1343 if (drbd_should_do_remote((union drbd_dev_state)os.i) != in _drbd_set_state()
1347 if (os.disk == D_ATTACHING && ns.disk >= D_NEGOTIATING) in _drbd_set_state()
1351 if (os.conn == C_WF_REPORT_PARAMS && ns.conn != C_WF_REPORT_PARAMS && in _drbd_set_state()
1363 if ((os.conn == C_VERIFY_S || os.conn == C_VERIFY_T) && in _drbd_set_state()
1372 if ((os.conn == C_PAUSED_SYNC_T || os.conn == C_PAUSED_SYNC_S) && in _drbd_set_state()
1381 if ((os.conn == C_SYNC_TARGET || os.conn == C_SYNC_SOURCE) && in _drbd_set_state()
1387 if (os.conn == C_CONNECTED && in _drbd_set_state()
1435 if (os.disk < D_CONSISTENT && ns.disk >= D_CONSISTENT) in _drbd_set_state()
1441 if (os.disk == D_INCONSISTENT && os.pdsk == D_INCONSISTENT && in _drbd_set_state()
1442 os.peer == R_SECONDARY && ns.peer == R_PRIMARY) in _drbd_set_state()
1446 if (os.conn != C_DISCONNECTING && ns.conn == C_DISCONNECTING) in _drbd_set_state()
1450 if (os.conn != C_STANDALONE && ns.conn == C_STANDALONE) in _drbd_set_state()
1454 if (os.conn > C_WF_CONNECTION && in _drbd_set_state()
1459 if (os.conn < C_CONNECTED && ns.conn >= C_CONNECTED) { in _drbd_set_state()
1467 if ((os.disk == D_ATTACHING || os.disk == D_NEGOTIATING) && in _drbd_set_state()
1473 ascw->os = os; in _drbd_set_state()
1495 after_state_ch(device, ascw->os, ascw->ns, ascw->flags, ascw->state_change); in w_after_state_ch()
1681 static bool lost_contact_to_peer_data(enum drbd_disk_state os, enum drbd_disk_state ns) in lost_contact_to_peer_data() argument
1683 if ((os >= D_INCONSISTENT && os != D_UNKNOWN && os != D_OUTDATED) in lost_contact_to_peer_data()
1693 if (os == D_UNKNOWN in lost_contact_to_peer_data()
1703 * @os: old state.
1708 static void after_state_ch(struct drbd_device *device, union drbd_state os, in after_state_ch() argument
1720 sib.os = os; in after_state_ch()
1723 if ((os.disk != D_UP_TO_DATE || os.pdsk != D_UP_TO_DATE) in after_state_ch()
1733 if (!(os.role == R_PRIMARY && os.disk < D_UP_TO_DATE && os.pdsk < D_UP_TO_DATE) && in after_state_ch()
1744 if (os.conn < C_CONNECTED && conn_lowest_conn(connection) >= C_CONNECTED) in after_state_ch()
1747 if ((os.disk == D_ATTACHING || os.disk == D_NEGOTIATING) && in after_state_ch()
1792 if ((os.conn != C_SYNC_SOURCE && os.conn != C_PAUSED_SYNC_S) && in after_state_ch()
1800 if (os.pdsk == D_DISKLESS && in after_state_ch()
1815 if (os.conn != C_WF_BITMAP_S && ns.conn == C_WF_BITMAP_S && in after_state_ch()
1822 if (lost_contact_to_peer_data(os.pdsk, ns.pdsk)) { in after_state_ch()
1838 if (os.peer != R_PRIMARY && ns.peer == R_PRIMARY && in after_state_ch()
1844 if (os.peer == R_PRIMARY && ns.peer == R_SECONDARY) in after_state_ch()
1856 if (os.role == R_PRIMARY && ns.role == R_SECONDARY && in after_state_ch()
1867 os.disk == D_ATTACHING && ns.disk == D_NEGOTIATING) { in after_state_ch()
1875 ((os.aftr_isp != ns.aftr_isp) || in after_state_ch()
1876 (os.user_isp != ns.user_isp))) in after_state_ch()
1880 if ((!os.aftr_isp && !os.peer_isp && !os.user_isp) && in after_state_ch()
1886 if (os.conn == C_WF_REPORT_PARAMS && ns.conn >= C_CONNECTED) in after_state_ch()
1889 if (os.conn != C_AHEAD && ns.conn == C_AHEAD) in after_state_ch()
1893 if ((os.conn != C_STARTING_SYNC_T && ns.conn == C_STARTING_SYNC_T) || in after_state_ch()
1894 (os.conn != C_STARTING_SYNC_S && ns.conn == C_STARTING_SYNC_S)) in after_state_ch()
1903 if (os.disk != D_FAILED && ns.disk == D_FAILED) { in after_state_ch()
1964 if (os.disk != D_DISKLESS && ns.disk == D_DISKLESS) { in after_state_ch()
1980 if (os.disk == D_UP_TO_DATE && ns.disk == D_INCONSISTENT && ns.conn >= C_CONNECTED) in after_state_ch()
1991 if ((os.conn > C_CONNECTED && ns.conn <= C_CONNECTED) || in after_state_ch()
1992 (os.peer_isp && !ns.peer_isp) || in after_state_ch()
1993 (os.user_isp && !ns.user_isp)) in after_state_ch()
1998 if (os.disk < D_UP_TO_DATE && os.conn >= C_SYNC_SOURCE && ns.conn == C_CONNECTED) in after_state_ch()
2004 if (os.conn == C_VERIFY_S && ns.conn == C_CONNECTED in after_state_ch()
2019 if ((os.conn > C_CONNECTED && os.conn < C_AHEAD) && in after_state_ch()
2030 if (os.aftr_isp != ns.aftr_isp) in after_state_ch()
2118 union drbd_dev_state os, cs = { in conn_old_common_state() local
2129 os = device->state; in conn_old_common_state()
2132 cs = os; in conn_old_common_state()
2137 if (cs.role != os.role) in conn_old_common_state()
2140 if (cs.peer != os.peer) in conn_old_common_state()
2143 if (cs.conn != os.conn) in conn_old_common_state()
2146 if (cs.disk != os.disk) in conn_old_common_state()
2149 if (cs.pdsk != os.pdsk) in conn_old_common_state()
2164 union drbd_state ns, os; in conn_is_valid_transition() local
2171 os = drbd_read_state(device); in conn_is_valid_transition()
2172 ns = sanitize_state(device, os, apply_mask_val(os, mask, val), NULL); in conn_is_valid_transition()
2174 if (flags & CS_IGN_OUTD_FAIL && ns.disk == D_OUTDATED && os.disk < D_OUTDATED) in conn_is_valid_transition()
2175 ns.disk = os.disk; in conn_is_valid_transition()
2177 if (ns.i == os.i) in conn_is_valid_transition()
2180 rv = is_valid_transition(os, ns); in conn_is_valid_transition()
2185 if (is_valid_state(device, os) == rv) in conn_is_valid_transition()
2186 rv = is_valid_soft_transition(os, ns, connection); in conn_is_valid_transition()
2188 rv = is_valid_soft_transition(os, ns, connection); in conn_is_valid_transition()
2193 print_st_err(device, os, ns, rv); in conn_is_valid_transition()
2206 union drbd_state ns, os, ns_max = { }; in conn_set_state() local
2232 os = drbd_read_state(device); in conn_set_state()
2233 ns = apply_mask_val(os, mask, val); in conn_set_state()
2234 ns = sanitize_state(device, os, ns, NULL); in conn_set_state()
2236 if (flags & CS_IGN_OUTD_FAIL && ns.disk == D_OUTDATED && os.disk < D_OUTDATED) in conn_set_state()
2237 ns.disk = os.disk; in conn_set_state()
2299 union drbd_state ns_max, ns_min, os; in _conn_request_state() local
2348 conn_old_common_state(connection, &os, &flags); in _conn_request_state()
2351 conn_pr_state_change(connection, os, ns_max, flags); in _conn_request_state()
2356 acscw->oc = os.conn; in _conn_request_state()