提交 d0456c72 编写于 作者: L Lars Ellenberg 提交者: Philipp Reisner

drbd: simplify conn_all_vols_unconf, make it bool

Get rid of a temporary variable and, funny bitand assignment.
Just short circuit, returning false, once we encounter the first
still configured volume.

FIXME verify call sites for need of rcu_read_lock or stronger.
Signed-off-by: NPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: NLars Ellenberg <lars.ellenberg@linbit.com>
上级 543cc10b
...@@ -47,20 +47,18 @@ static enum drbd_state_rv is_valid_transition(union drbd_state os, union drbd_st ...@@ -47,20 +47,18 @@ static enum drbd_state_rv is_valid_transition(union drbd_state os, union drbd_st
static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns, static union drbd_state sanitize_state(struct drbd_conf *mdev, union drbd_state ns,
const char **warn_sync_abort); const char **warn_sync_abort);
int conn_all_vols_unconf(struct drbd_tconn *tconn) bool conn_all_vols_unconf(struct drbd_tconn *tconn)
{ {
struct drbd_conf *mdev; struct drbd_conf *mdev;
int minor, uncfg = 1; int minor;
idr_for_each_entry(&tconn->volumes, mdev, minor) { idr_for_each_entry(&tconn->volumes, mdev, minor) {
uncfg &= (mdev->state.disk == D_DISKLESS && if (mdev->state.disk != D_DISKLESS ||
mdev->state.conn == C_STANDALONE && mdev->state.conn != C_STANDALONE ||
mdev->state.role == R_SECONDARY); mdev->state.role != R_SECONDARY)
if (!uncfg) return false;
break;
} }
return true;
return uncfg;
} }
/** /**
......
...@@ -91,7 +91,7 @@ conn_request_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_s ...@@ -91,7 +91,7 @@ conn_request_state(struct drbd_tconn *tconn, union drbd_state mask, union drbd_s
enum chg_state_flags flags); enum chg_state_flags flags);
extern void drbd_resume_al(struct drbd_conf *mdev); extern void drbd_resume_al(struct drbd_conf *mdev);
extern int conn_all_vols_unconf(struct drbd_tconn *tconn); extern bool conn_all_vols_unconf(struct drbd_tconn *tconn);
/** /**
* drbd_request_state() - Reqest a state change * drbd_request_state() - Reqest a state change
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册