diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-02-09 08:38:52 -0500 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2011-09-28 04:33:17 -0400 |
commit | d50eee21c45769252f0b54a5804e8b2db735d288 (patch) | |
tree | 4d966ff7104613debbdf93814ad13b140c9d23ef /drivers/block/drbd/drbd_state.c | |
parent | 2a67d8b93b3363d4a5608d16d510a4bf6b3863fb (diff) |
drbd: Extracted after_conn_state_ch() out of after_state_ch()
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.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index d5777159a2b1..18feba6a27ed 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c | |||
@@ -45,10 +45,6 @@ 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); |
46 | static void after_conn_state_ch(struct drbd_tconn *tconn, union drbd_state os, | 46 | static 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); |
48 | static enum drbd_state_rv is_valid_state(struct drbd_conf *, union drbd_state); | ||
49 | static enum drbd_state_rv is_valid_soft_transition(union drbd_state, union drbd_state); | ||
50 | static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state os, | ||
51 | union drbd_state ns, const char **warn_sync_abort); | ||
52 | 48 | ||
53 | /** | 49 | /** |
54 | * cl_wide_st_chg() - true if the state change is a cluster wide one | 50 | * cl_wide_st_chg() - true if the state change is a cluster wide one |
@@ -98,6 +94,15 @@ void drbd_force_state(struct drbd_conf *mdev, | |||
98 | drbd_change_state(mdev, CS_HARD, mask, val); | 94 | drbd_change_state(mdev, CS_HARD, mask, val); |
99 | } | 95 | } |
100 | 96 | ||
97 | static enum drbd_state_rv is_valid_state(struct drbd_conf *, union drbd_state); | ||
98 | static enum drbd_state_rv is_valid_state_transition(struct drbd_conf *, | ||
99 | union drbd_state, | ||
100 | union drbd_state); | ||
101 | static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state os, | ||
102 | union drbd_state ns, const char **warn_sync_abort); | ||
103 | int drbd_send_state_req(struct drbd_conf *, | ||
104 | union drbd_state, union drbd_state); | ||
105 | |||
101 | static enum drbd_state_rv | 106 | static enum drbd_state_rv |
102 | _req_st_cond(struct drbd_conf *mdev, union drbd_state mask, | 107 | _req_st_cond(struct drbd_conf *mdev, union drbd_state mask, |
103 | union drbd_state val) | 108 | union drbd_state val) |
@@ -123,7 +128,7 @@ _req_st_cond(struct drbd_conf *mdev, union drbd_state mask, | |||
123 | if (!rv) { | 128 | if (!rv) { |
124 | rv = is_valid_state(mdev, ns); | 129 | rv = is_valid_state(mdev, ns); |
125 | if (rv == SS_SUCCESS) { | 130 | if (rv == SS_SUCCESS) { |
126 | rv = is_valid_soft_transition(os, ns); | 131 | rv = is_valid_state_transition(mdev, ns, os); |
127 | if (rv == SS_SUCCESS) | 132 | if (rv == SS_SUCCESS) |
128 | rv = SS_UNKNOWN_ERROR; /* cont waiting, otherwise fail. */ | 133 | rv = SS_UNKNOWN_ERROR; /* cont waiting, otherwise fail. */ |
129 | } | 134 | } |
@@ -166,7 +171,7 @@ drbd_req_state(struct drbd_conf *mdev, union drbd_state mask, | |||
166 | if (cl_wide_st_chg(mdev, os, ns)) { | 171 | if (cl_wide_st_chg(mdev, os, ns)) { |
167 | rv = is_valid_state(mdev, ns); | 172 | rv = is_valid_state(mdev, ns); |
168 | if (rv == SS_SUCCESS) | 173 | if (rv == SS_SUCCESS) |
169 | rv = is_valid_soft_transition(os, ns); | 174 | rv = is_valid_state_transition(mdev, ns, os); |
170 | spin_unlock_irqrestore(&mdev->tconn->req_lock, flags); | 175 | spin_unlock_irqrestore(&mdev->tconn->req_lock, flags); |
171 | 176 | ||
172 | if (rv < SS_SUCCESS) { | 177 | if (rv < SS_SUCCESS) { |
@@ -339,13 +344,14 @@ is_valid_state(struct drbd_conf *mdev, union drbd_state ns) | |||
339 | } | 344 | } |
340 | 345 | ||
341 | /** | 346 | /** |
342 | * is_valid_soft_transition() - Returns an SS_ error code if the state transition is not possible | 347 | * is_valid_state_transition() - Returns an SS_ error code if the state transition is not possible |
343 | * @mdev: DRBD device. | 348 | * @mdev: DRBD device. |
344 | * @ns: new state. | 349 | * @ns: new state. |
345 | * @os: old state. | 350 | * @os: old state. |
346 | */ | 351 | */ |
347 | static enum drbd_state_rv | 352 | static enum drbd_state_rv |
348 | is_valid_soft_transition(union drbd_state os, union drbd_state ns) | 353 | is_valid_state_transition(struct drbd_conf *mdev, union drbd_state ns, |
354 | union drbd_state os) | ||
349 | { | 355 | { |
350 | enum drbd_state_rv rv = SS_SUCCESS; | 356 | enum drbd_state_rv rv = SS_SUCCESS; |
351 | 357 | ||
@@ -651,9 +657,9 @@ __drbd_set_state(struct drbd_conf *mdev, union drbd_state ns, | |||
651 | this happen...*/ | 657 | this happen...*/ |
652 | 658 | ||
653 | if (is_valid_state(mdev, os) == rv) | 659 | if (is_valid_state(mdev, os) == rv) |
654 | rv = is_valid_soft_transition(os, ns); | 660 | rv = is_valid_state_transition(mdev, ns, os); |
655 | } else | 661 | } else |
656 | rv = is_valid_soft_transition(os, ns); | 662 | rv = is_valid_state_transition(mdev, ns, os); |
657 | } | 663 | } |
658 | 664 | ||
659 | if (rv < SS_SUCCESS) { | 665 | if (rv < SS_SUCCESS) { |