drbd: Implemented conn_lowest_conn()
authorPhilipp Reisner <philipp.reisner@linbit.com>
Tue, 29 Mar 2011 12:21:03 +0000 (14:21 +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_nl.c
drivers/block/drbd/drbd_state.c
drivers/block/drbd/drbd_state.h

index ed08dce9aaf55febc1a533355aa2526d899a0cb0..5cf116471aa3a390d9f1629063aba2de87efedcf 100644 (file)
@@ -1590,7 +1590,7 @@ int drbd_adm_attach(struct sk_buff *skb, struct genl_info *info)
 
 static int adm_detach(struct drbd_conf *mdev)
 {
-       enum drbd_ret_code retcode;
+       enum drbd_state_rv retcode;
        drbd_suspend_io(mdev); /* so no-one is stuck in drbd_al_begin_io */
        retcode = drbd_request_state(mdev, NS(disk, D_DISKLESS));
        wait_event(mdev->misc_wait,
index 0ce665366d698e41e03e8dffe2cd3ea1cd0f0f9b..36703fee3b0cebb4d87d8ee03f60c53f3d151fae 100644 (file)
@@ -133,6 +133,18 @@ enum drbd_disk_state conn_highest_pdsk(struct drbd_tconn *tconn)
        return ds;
 }
 
+enum drbd_conns conn_lowest_conn(struct drbd_tconn *tconn)
+{
+       enum drbd_conns conn = C_MASK;
+       struct drbd_conf *mdev;
+       int vnr;
+
+       idr_for_each_entry(&tconn->volumes, mdev, vnr)
+               conn = min_t(enum drbd_conns, conn, mdev->state.conn);
+
+       return conn;
+}
+
 /**
  * cl_wide_st_chg() - true if the state change is a cluster wide one
  * @mdev:      DRBD device.
index 0f8441de29cde54cfb4da34cd0f5be37b737ab1a..286af0612dc48522702abef87cbbbaebdb9f2160 100644 (file)
@@ -154,5 +154,6 @@ 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_highest_pdsk(struct drbd_tconn *tconn);
+enum drbd_conns conn_lowest_conn(struct drbd_tconn *tconn);
 
 #endif