aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/drbd/drbd_int.h4
-rw-r--r--drivers/block/drbd/drbd_main.c22
-rw-r--r--drivers/block/drbd/drbd_receiver.c16
-rw-r--r--drivers/block/drbd/drbd_worker.c2
4 files changed, 22 insertions, 22 deletions
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 9f1f0f56f71e..a4ac5837054b 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1113,7 +1113,7 @@ extern int _conn_send_state_req(struct drbd_tconn *, int vnr, enum drbd_packet c
1113 union drbd_state, union drbd_state); 1113 union drbd_state, union drbd_state);
1114extern int _drbd_send_state(struct drbd_conf *mdev); 1114extern int _drbd_send_state(struct drbd_conf *mdev);
1115extern int drbd_send_state(struct drbd_conf *mdev); 1115extern int drbd_send_state(struct drbd_conf *mdev);
1116extern int _conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct socket *sock, 1116extern int _conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct drbd_socket *sock,
1117 enum drbd_packet cmd, struct p_header *h, size_t size, 1117 enum drbd_packet cmd, struct p_header *h, size_t size,
1118 unsigned msg_flags); 1118 unsigned msg_flags);
1119extern int conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct drbd_socket *sock, 1119extern int conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct drbd_socket *sock,
@@ -1860,7 +1860,7 @@ static inline void request_ping(struct drbd_tconn *tconn)
1860 wake_asender(tconn); 1860 wake_asender(tconn);
1861} 1861}
1862 1862
1863static inline int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock, 1863static inline int _drbd_send_cmd(struct drbd_conf *mdev, struct drbd_socket *sock,
1864 enum drbd_packet cmd, struct p_header *h, size_t size, 1864 enum drbd_packet cmd, struct p_header *h, size_t size,
1865 unsigned msg_flags) 1865 unsigned msg_flags)
1866{ 1866{
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 3e32836db550..4c94be25a770 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -719,14 +719,14 @@ static void prepare_header(struct drbd_conf *mdev, struct p_header *h,
719} 719}
720 720
721/* the appropriate socket mutex must be held already */ 721/* the appropriate socket mutex must be held already */
722int _conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct socket *sock, 722int _conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct drbd_socket *sock,
723 enum drbd_packet cmd, struct p_header *h, size_t size, 723 enum drbd_packet cmd, struct p_header *h, size_t size,
724 unsigned msg_flags) 724 unsigned msg_flags)
725{ 725{
726 int err; 726 int err;
727 727
728 _prepare_header(tconn, vnr, h, cmd, size - sizeof(struct p_header)); 728 _prepare_header(tconn, vnr, h, cmd, size - sizeof(struct p_header));
729 err = drbd_send_all(tconn, sock, h, size, msg_flags); 729 err = drbd_send_all(tconn, sock->socket, h, size, msg_flags);
730 if (err && !signal_pending(current)) 730 if (err && !signal_pending(current))
731 conn_warn(tconn, "short send %s size=%d\n", 731 conn_warn(tconn, "short send %s size=%d\n",
732 cmdname(cmd), (int)size); 732 cmdname(cmd), (int)size);
@@ -743,7 +743,7 @@ int conn_send_cmd(struct drbd_tconn *tconn, int vnr, struct drbd_socket *sock,
743 743
744 mutex_lock(&sock->mutex); 744 mutex_lock(&sock->mutex);
745 if (sock->socket) 745 if (sock->socket)
746 err = _conn_send_cmd(tconn, vnr, sock->socket, cmd, h, size, 0); 746 err = _conn_send_cmd(tconn, vnr, sock, cmd, h, size, 0);
747 mutex_unlock(&sock->mutex); 747 mutex_unlock(&sock->mutex);
748 return err; 748 return err;
749} 749}
@@ -780,7 +780,7 @@ int drbd_send_ping_ack(struct drbd_tconn *tconn)
780int drbd_send_sync_param(struct drbd_conf *mdev) 780int drbd_send_sync_param(struct drbd_conf *mdev)
781{ 781{
782 struct p_rs_param_95 *p; 782 struct p_rs_param_95 *p;
783 struct socket *sock; 783 struct drbd_socket *sock;
784 int size, err; 784 int size, err;
785 const int apv = mdev->tconn->agreed_pro_version; 785 const int apv = mdev->tconn->agreed_pro_version;
786 786
@@ -791,9 +791,9 @@ int drbd_send_sync_param(struct drbd_conf *mdev)
791 : /* apv >= 95 */ sizeof(struct p_rs_param_95); 791 : /* apv >= 95 */ sizeof(struct p_rs_param_95);
792 792
793 mutex_lock(&mdev->tconn->data.mutex); 793 mutex_lock(&mdev->tconn->data.mutex);
794 sock = mdev->tconn->data.socket; 794 sock = &mdev->tconn->data;
795 795
796 if (likely(sock != NULL)) { 796 if (likely(sock->socket != NULL)) {
797 enum drbd_packet cmd = 797 enum drbd_packet cmd =
798 apv >= 89 ? P_SYNC_PARAM89 : P_SYNC_PARAM; 798 apv >= 89 ? P_SYNC_PARAM89 : P_SYNC_PARAM;
799 799
@@ -979,16 +979,16 @@ int drbd_send_sizes(struct drbd_conf *mdev, int trigger_reply, enum dds_flags fl
979 */ 979 */
980int drbd_send_state(struct drbd_conf *mdev) 980int drbd_send_state(struct drbd_conf *mdev)
981{ 981{
982 struct socket *sock; 982 struct drbd_socket *sock;
983 struct p_state p; 983 struct p_state p;
984 int err = -EIO; 984 int err = -EIO;
985 985
986 mutex_lock(&mdev->tconn->data.mutex); 986 mutex_lock(&mdev->tconn->data.mutex);
987 987
988 p.state = cpu_to_be32(mdev->state.i); /* Within the send mutex */ 988 p.state = cpu_to_be32(mdev->state.i); /* Within the send mutex */
989 sock = mdev->tconn->data.socket; 989 sock = &mdev->tconn->data;
990 990
991 if (likely(sock != NULL)) 991 if (likely(sock->socket != NULL))
992 err = _drbd_send_cmd(mdev, sock, P_STATE, &p.head, sizeof(p), 0); 992 err = _drbd_send_cmd(mdev, sock, P_STATE, &p.head, sizeof(p), 0);
993 993
994 mutex_unlock(&mdev->tconn->data.mutex); 994 mutex_unlock(&mdev->tconn->data.mutex);
@@ -1157,7 +1157,7 @@ send_bitmap_rle_or_plain(struct drbd_conf *mdev, struct bm_xfer_ctx *c)
1157 1157
1158 if (len) { 1158 if (len) {
1159 dcbp_set_code(p, RLE_VLI_Bits); 1159 dcbp_set_code(p, RLE_VLI_Bits);
1160 err = _drbd_send_cmd(mdev, mdev->tconn->data.socket, 1160 err = _drbd_send_cmd(mdev, &mdev->tconn->data,
1161 P_COMPRESSED_BITMAP, &p->head, 1161 P_COMPRESSED_BITMAP, &p->head,
1162 sizeof(*p) + len, 0); 1162 sizeof(*p) + len, 0);
1163 1163
@@ -1175,7 +1175,7 @@ send_bitmap_rle_or_plain(struct drbd_conf *mdev, struct bm_xfer_ctx *c)
1175 if (len) 1175 if (len)
1176 drbd_bm_get_lel(mdev, c->word_offset, num_words, 1176 drbd_bm_get_lel(mdev, c->word_offset, num_words,
1177 (unsigned long *)h->payload); 1177 (unsigned long *)h->payload);
1178 err = _drbd_send_cmd(mdev, mdev->tconn->data.socket, P_BITMAP, 1178 err = _drbd_send_cmd(mdev, &mdev->tconn->data, P_BITMAP,
1179 h, sizeof(struct p_header80) + len, 0); 1179 h, sizeof(struct p_header80) + len, 0);
1180 c->word_offset += num_words; 1180 c->word_offset += num_words;
1181 c->bit_offset = c->word_offset * BITS_PER_LONG; 1181 c->bit_offset = c->word_offset * BITS_PER_LONG;
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index bfec09a2232f..40cecd6c7e33 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -729,7 +729,7 @@ out:
729 return s_estab; 729 return s_estab;
730} 730}
731 731
732static int drbd_send_fp(struct drbd_tconn *tconn, struct socket *sock, enum drbd_packet cmd) 732static int drbd_send_fp(struct drbd_tconn *tconn, struct drbd_socket *sock, enum drbd_packet cmd)
733{ 733{
734 struct p_header *h = tconn->data.sbuf; 734 struct p_header *h = tconn->data.sbuf;
735 735
@@ -738,13 +738,13 @@ static int drbd_send_fp(struct drbd_tconn *tconn, struct socket *sock, enum drbd
738 738
739static enum drbd_packet drbd_recv_fp(struct drbd_tconn *tconn, struct socket *sock) 739static enum drbd_packet drbd_recv_fp(struct drbd_tconn *tconn, struct socket *sock)
740{ 740{
741 struct p_header80 *h = tconn->data.rbuf; 741 struct p_header80 h;
742 int rr; 742 int rr;
743 743
744 rr = drbd_recv_short(sock, h, sizeof(*h), 0); 744 rr = drbd_recv_short(sock, &h, sizeof(h), 0);
745 745
746 if (rr == sizeof(*h) && h->magic == cpu_to_be32(DRBD_MAGIC)) 746 if (rr == sizeof(h) && h.magic == cpu_to_be32(DRBD_MAGIC))
747 return be16_to_cpu(h->command); 747 return be16_to_cpu(h.command);
748 748
749 return 0xffff; 749 return 0xffff;
750} 750}
@@ -833,10 +833,10 @@ static int drbd_connect(struct drbd_tconn *tconn)
833 if (s) { 833 if (s) {
834 if (!tconn->data.socket) { 834 if (!tconn->data.socket) {
835 tconn->data.socket = s; 835 tconn->data.socket = s;
836 drbd_send_fp(tconn, tconn->data.socket, P_HAND_SHAKE_S); 836 drbd_send_fp(tconn, &tconn->data, P_HAND_SHAKE_S);
837 } else if (!tconn->meta.socket) { 837 } else if (!tconn->meta.socket) {
838 tconn->meta.socket = s; 838 tconn->meta.socket = s;
839 drbd_send_fp(tconn, tconn->meta.socket, P_HAND_SHAKE_M); 839 drbd_send_fp(tconn, &tconn->meta, P_HAND_SHAKE_M);
840 } else { 840 } else {
841 conn_err(tconn, "Logic error in drbd_connect()\n"); 841 conn_err(tconn, "Logic error in drbd_connect()\n");
842 goto out_release_sockets; 842 goto out_release_sockets;
@@ -4195,7 +4195,7 @@ static int drbd_send_handshake(struct drbd_tconn *tconn)
4195 memset(p, 0, sizeof(*p)); 4195 memset(p, 0, sizeof(*p));
4196 p->protocol_min = cpu_to_be32(PRO_VERSION_MIN); 4196 p->protocol_min = cpu_to_be32(PRO_VERSION_MIN);
4197 p->protocol_max = cpu_to_be32(PRO_VERSION_MAX); 4197 p->protocol_max = cpu_to_be32(PRO_VERSION_MAX);
4198 err = _conn_send_cmd(tconn, 0, tconn->data.socket, P_HAND_SHAKE, 4198 err = _conn_send_cmd(tconn, 0, &tconn->data, P_HAND_SHAKE,
4199 &p->head, sizeof(*p), 0); 4199 &p->head, sizeof(*p), 0);
4200 mutex_unlock(&tconn->data.mutex); 4200 mutex_unlock(&tconn->data.mutex);
4201 return err; 4201 return err;
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index c3d1f5f5853a..6e02b4efe9a0 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -1215,7 +1215,7 @@ int w_send_barrier(struct drbd_work *w, int cancel)
1215 /* inc_ap_pending was done where this was queued. 1215 /* inc_ap_pending was done where this was queued.
1216 * dec_ap_pending will be done in got_BarrierAck 1216 * dec_ap_pending will be done in got_BarrierAck
1217 * or (on connection loss) in w_clear_epoch. */ 1217 * or (on connection loss) in w_clear_epoch. */
1218 err = _drbd_send_cmd(mdev, mdev->tconn->data.socket, P_BARRIER, 1218 err = _drbd_send_cmd(mdev, &mdev->tconn->data, P_BARRIER,
1219 &p->head, sizeof(*p), 0); 1219 &p->head, sizeof(*p), 0);
1220 drbd_put_data_sock(mdev->tconn); 1220 drbd_put_data_sock(mdev->tconn);
1221 1221