drbd: Implemented conn_lowest_disk()
authorPhilipp Reisner <philipp.reisner@linbit.com>
Tue, 29 Mar 2011 16:15:49 +0000 (18:15 +0200)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:45:05 +0000 (16:45 +0100)
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_state.c
drivers/block/drbd/drbd_state.h

index 36703fee3b0cebb4d87d8ee03f60c53f3d151fae..896d5dc833cbad52be724fd1a0ffc455c6f441a8 100644 (file)
@@ -121,6 +121,18 @@ enum drbd_disk_state conn_highest_disk(struct drbd_tconn *tconn)
        return ds;
 }
 
+enum drbd_disk_state conn_lowest_disk(struct drbd_tconn *tconn)
+{
+       enum drbd_disk_state ds = D_MASK;
+       struct drbd_conf *mdev;
+       int vnr;
+
+       idr_for_each_entry(&tconn->volumes, mdev, vnr)
+               ds = min_t(enum drbd_disk_state, ds, mdev->state.disk);
+
+       return ds;
+}
+
 enum drbd_disk_state conn_highest_pdsk(struct drbd_tconn *tconn)
 {
        enum drbd_disk_state ds = D_DISKLESS;
index 286af0612dc48522702abef87cbbbaebdb9f2160..757f9d93643fd042db6236c28b777d23447cae2f 100644 (file)
@@ -153,6 +153,7 @@ static inline int drbd_request_state(struct drbd_conf *mdev,
 enum drbd_role conn_highest_role(struct drbd_tconn *tconn);
 enum drbd_role conn_highest_peer(struct drbd_tconn *tconn);
 enum drbd_disk_state conn_highest_disk(struct drbd_tconn *tconn);
+enum drbd_disk_state conn_lowest_disk(struct drbd_tconn *tconn);
 enum drbd_disk_state conn_highest_pdsk(struct drbd_tconn *tconn);
 enum drbd_conns conn_lowest_conn(struct drbd_tconn *tconn);