diff options
author | Lars Ellenberg | 2011-03-10 23:28:13 +0100 |
---|---|---|
committer | Philipp Reisner | 2012-11-04 00:16:19 +0100 |
commit | d0456c72df5fb3b800ba9b0ec2465fdbcaf29a7f (patch) | |
tree | b9b7174176a29502ab045dad3c947cf1e7a885f1 /drivers/block/drbd/drbd_state.c | |
parent | drbd: drbd_adm_get_status needs to show some more detail (diff) | |
download | kernel-qcow2-linux-d0456c72df5fb3b800ba9b0ec2465fdbcaf29a7f.tar.gz kernel-qcow2-linux-d0456c72df5fb3b800ba9b0ec2465fdbcaf29a7f.tar.xz kernel-qcow2-linux-d0456c72df5fb3b800ba9b0ec2465fdbcaf29a7f.zip |
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: 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 | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index a280bc238acd..c27d3778cae6 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c @@ -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, 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; - int minor, uncfg = 1; + int minor; idr_for_each_entry(&tconn->volumes, mdev, minor) { - uncfg &= (mdev->state.disk == D_DISKLESS && - mdev->state.conn == C_STANDALONE && - mdev->state.role == R_SECONDARY); - if (!uncfg) - break; + if (mdev->state.disk != D_DISKLESS || + mdev->state.conn != C_STANDALONE || + mdev->state.role != R_SECONDARY) + return false; } - - return uncfg; + return true; } /** |