aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd/drbd_state.c
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-02-09 09:10:33 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-09-28 04:33:18 -0400
commita75f34ad0cb37f6fc03ffb109a9a702668b67fe2 (patch)
tree1df36bd453029bf29dc5d4dbb97b6212f00736bb /drivers/block/drbd/drbd_state.c
parentd50eee21c45769252f0b54a5804e8b2db735d288 (diff)
drbd: Renamed is_valid_state_transition() to is_valid_soft_transition()
And removed the unused mdev parameter, and made the order of the state parameters: os, ns Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd/drbd_state.c')
-rw-r--r--drivers/block/drbd/drbd_state.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c
index 18feba6a27ed..d5777159a2b1 100644
--- a/drivers/block/drbd/drbd_state.c
+++ b/drivers/block/drbd/drbd_state.c
@@ -45,6 +45,10 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
45 union drbd_state ns, enum chg_state_flags flags); 45 union drbd_state ns, enum chg_state_flags flags);
46static void after_conn_state_ch(struct drbd_tconn *tconn, union drbd_state os, 46static void after_conn_state_ch(struct drbd_tconn *tconn, union drbd_state os,
47 union drbd_state ns, enum chg_state_flags flags); 47 union drbd_state ns, enum chg_state_flags flags);
48static enum drbd_state_rv is_valid_state(struct drbd_conf *, union drbd_state);
49static enum drbd_state_rv is_valid_soft_transition(union drbd_state, union drbd_state);
50static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state os,
51 union drbd_state ns, const char **warn_sync_abort);
48 52
49/** 53/**
50 * cl_wide_st_chg() - true if the state change is a cluster wide one 54 * cl_wide_st_chg() - true if the state change is a cluster wide one
@@ -94,15 +98,6 @@ void drbd_force_state(struct drbd_conf *mdev,
94 drbd_change_state(mdev, CS_HARD, mask, val); 98 drbd_change_state(mdev, CS_HARD, mask, val);
95} 99}
96 100
97static enum drbd_state_rv is_valid_state(struct drbd_conf *, union drbd_state);
98static enum drbd_state_rv is_valid_state_transition(struct drbd_conf *,
99 union drbd_state,
100 union drbd_state);
101static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state os,
102 union drbd_state ns, const char **warn_sync_abort);
103int drbd_send_state_req(struct drbd_conf *,
104 union drbd_state, union drbd_state);
105
106static enum drbd_state_rv 101static enum drbd_state_rv
107_req_st_cond(struct drbd_conf *mdev, union drbd_state mask, 102_req_st_cond(struct drbd_conf *mdev, union drbd_state mask,
108 union drbd_state val) 103 union drbd_state val)
@@ -128,7 +123,7 @@ _req_st_cond(struct drbd_conf *mdev, union drbd_state mask,
128 if (!rv) { 123 if (!rv) {
129 rv = is_valid_state(mdev, ns); 124 rv = is_valid_state(mdev, ns);
130 if (rv == SS_SUCCESS) { 125 if (rv == SS_SUCCESS) {
131 rv = is_valid_state_transition(mdev, ns, os); 126 rv = is_valid_soft_transition(os, ns);
132 if (rv == SS_SUCCESS) 127 if (rv == SS_SUCCESS)
133 rv = SS_UNKNOWN_ERROR; /* cont waiting, otherwise fail. */ 128 rv = SS_UNKNOWN_ERROR; /* cont waiting, otherwise fail. */
134 } 129 }
@@ -171,7 +166,7 @@ drbd_req_state(struct drbd_conf *mdev, union drbd_state mask,
171 if (cl_wide_st_chg(mdev, os, ns)) { 166 if (cl_wide_st_chg(mdev, os, ns)) {
172 rv = is_valid_state(mdev, ns); 167 rv = is_valid_state(mdev, ns);
173 if (rv == SS_SUCCESS) 168 if (rv == SS_SUCCESS)
174 rv = is_valid_state_transition(mdev, ns, os); 169 rv = is_valid_soft_transition(os, ns);
175 spin_unlock_irqrestore(&mdev->tconn->req_lock, flags); 170 spin_unlock_irqrestore(&mdev->tconn->req_lock, flags);
176 171
177 if (rv < SS_SUCCESS) { 172 if (rv < SS_SUCCESS) {
@@ -344,14 +339,13 @@ is_valid_state(struct drbd_conf *mdev, union drbd_state ns)
344} 339}
345 340
346/** 341/**
347 * is_valid_state_transition() - Returns an SS_ error code if the state transition is not possible 342 * is_valid_soft_transition() - Returns an SS_ error code if the state transition is not possible
348 * @mdev: DRBD device. 343 * @mdev: DRBD device.
349 * @ns: new state. 344 * @ns: new state.
350 * @os: old state. 345 * @os: old state.
351 */ 346 */
352static enum drbd_state_rv 347static enum drbd_state_rv
353is_valid_state_transition(struct drbd_conf *mdev, union drbd_state ns, 348is_valid_soft_transition(union drbd_state os, union drbd_state ns)
354 union drbd_state os)
355{ 349{
356 enum drbd_state_rv rv = SS_SUCCESS; 350 enum drbd_state_rv rv = SS_SUCCESS;
357 351
@@ -657,9 +651,9 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns,
657 this happen...*/ 651 this happen...*/
658 652
659 if (is_valid_state(mdev, os) == rv) 653 if (is_valid_state(mdev, os) == rv)
660 rv = is_valid_state_transition(mdev, ns, os); 654 rv = is_valid_soft_transition(os, ns);
661 } else 655 } else
662 rv = is_valid_state_transition(mdev, ns, os); 656 rv = is_valid_soft_transition(os, ns);
663 } 657 }
664 658
665 if (rv < SS_SUCCESS) { 659 if (rv < SS_SUCCESS) {