drbd: Implemented conn_send_state_req()
authorPhilipp Reisner <philipp.reisner@linbit.com>
Fri, 11 Feb 2011 14:11:24 +0000 (15:11 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Fri, 14 Oct 2011 14:45:02 +0000 (16:45 +0200)
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_int.h
drivers/block/drbd/drbd_main.c
drivers/block/drbd/drbd_state.c

index 152d07bcfb9ff5291c91a6ea6ad930a5ad07a67d..4e7454958b855082a01e8c0b841e6280cd4e0bf9 100644 (file)
@@ -221,8 +221,10 @@ enum drbd_packet {
        P_DELAY_PROBE         = 0x27, /* is used on BOTH sockets */
        P_OUT_OF_SYNC         = 0x28, /* Mark as out of sync (Outrunning), data socket */
        P_RS_CANCEL           = 0x29, /* meta: Used to cancel RS_DATA_REQUEST packet by SyncSource */
+       P_CONN_ST_CHG_REQ     = 0x2a, /* data sock: Connection wide state request */
+       P_CONN_ST_CHG_REPLY   = 0x2b, /* meta sock: Connection side state req reply */
 
-       P_MAX_CMD             = 0x2A,
+       P_MAX_CMD             = 0x2c,
        P_MAY_IGNORE          = 0x100, /* Flag to test if (cmd > P_MAY_IGNORE) ... */
        P_MAX_OPT_CMD         = 0x101,
 
@@ -1177,6 +1179,8 @@ extern int drbd_send_uuids(struct drbd_conf *mdev);
 extern int drbd_send_uuids_skip_initial_sync(struct drbd_conf *mdev);
 extern int drbd_gen_and_send_sync_uuid(struct drbd_conf *mdev);
 extern int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags flags);
+extern int _conn_send_state_req(struct drbd_tconn *, int vnr, enum drbd_packet cmd,
+                               union drbd_state, union drbd_state);
 extern int _drbd_send_state(struct drbd_conf *mdev);
 extern int drbd_send_state(struct drbd_conf *mdev);
 extern int _conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct socket *sock,
@@ -1896,6 +1900,19 @@ static inline int drbd_send_ping_ack(struct drbd_tconn *tconn)
        return conn_send_cmd(tconn, 0, USE_META_SOCKET, P_PING_ACK, &h, sizeof(h));
 }
 
+static inline int drbd_send_state_req(struct drbd_conf *mdev,
+                                     union drbd_state mask, union drbd_state val)
+{
+       return _conn_send_state_req(mdev->tconn, mdev->vnr, P_STATE_CHG_REQ, mask, val);
+}
+
+static inline int conn_send_state_req(struct drbd_tconn *tconn,
+                                     union drbd_state mask, union drbd_state val)
+{
+       enum drbd_packet cmd = tconn->agreed_pro_version < 100 ? P_STATE_CHG_REQ : P_CONN_ST_CHG_REQ;
+       return _conn_send_state_req(tconn, 0, cmd, mask, val);
+}
+
 static inline void drbd_thread_stop(struct drbd_thread *thi)
 {
        _drbd_thread_stop(thi, false, true);
index 1781d0ad35e11f9f264769307a073a15c13b9914..e0efc918a5e6c1b1c28d3fc357d4ebb6aa4f6405 100644 (file)
@@ -970,15 +970,15 @@ int drbd_send_state(struct drbd_conf *mdev)
        return ok;
 }
 
-int drbd_send_state_req(struct drbd_conf *mdev,
-       union drbd_state mask, union drbd_state val)
+int _conn_send_state_req(struct drbd_tconn *tconn, int vnr, enum drbd_packet cmd,
+                        union drbd_state mask, union drbd_state val)
 {
        struct p_req_state p;
 
        p.mask    = cpu_to_be32(mask.i);
        p.val     = cpu_to_be32(val.i);
 
-       return drbd_send_cmd(mdev, USE_DATA_SOCKET, P_STATE_CHG_REQ, &p.head, sizeof(p));
+       return conn_send_cmd(tconn, vnr, USE_DATA_SOCKET, cmd, &p.head, sizeof(p));
 }
 
 int drbd_send_sr_reply(struct drbd_conf *mdev, enum drbd_state_rv retcode)
index 2cd4fcef554a73b10bb373d224e155123ddc0ea2..f34e7d4c888680e2b37fa2f7d1c6043b283eae6e 100644 (file)
@@ -37,9 +37,7 @@ struct after_state_chg_work {
        struct completion *done;
 };
 
-
 extern void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what);
-int drbd_send_state_req(struct drbd_conf *, union drbd_state, union drbd_state);
 static int w_after_state_ch(struct drbd_work *w, int unused);
 static void after_state_ch(struct drbd_conf *mdev, union drbd_state os,
                           union drbd_state ns, enum chg_state_flags flags);
This page took 0.031048 seconds and 5 git commands to generate.