drbd: _drbd_send_cmd(): Return 0 upon success and an error code otherwise
authorAndreas Gruenbacher <agruen@linbit.com>
Tue, 15 Mar 2011 22:51:21 +0000 (23:51 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:44:31 +0000 (16:44 +0100)
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_worker.c

index 1f17d83..0bd8c2a 100644 (file)
@@ -1926,7 +1926,7 @@ static inline int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock,
                                  enum drbd_packet cmd, struct p_header *h, size_t size,
                                  unsigned msg_flags)
 {
-       return !_conn_send_cmd(mdev->tconn, mdev->vnr, sock, cmd, h, size, msg_flags);
+       return _conn_send_cmd(mdev->tconn, mdev->vnr, sock, cmd, h, size, msg_flags);
 }
 
 static inline int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket,
index ff0085b..2177915 100644 (file)
@@ -827,7 +827,7 @@ int drbd_send_sync_param(struct drbd_conf *mdev)
                if (apv >= 89)
                        strcpy(p->csums_alg, mdev->tconn->net_conf->csums_alg);
 
-               rv = _drbd_send_cmd(mdev, sock, cmd, &p->head, size, 0);
+               rv = !_drbd_send_cmd(mdev, sock, cmd, &p->head, size, 0);
        } else
                rv = 0; /* not ok */
 
@@ -995,9 +995,8 @@ int drbd_send_state(struct drbd_conf *mdev)
        p.state = cpu_to_be32(mdev->state.i); /* Within the send mutex */
        sock = mdev->tconn->data.socket;
 
-       if (likely(sock != NULL)) {
-               ok = _drbd_send_cmd(mdev, sock, P_STATE, &p.head, sizeof(p), 0);
-       }
+       if (likely(sock != NULL))
+               ok = !_drbd_send_cmd(mdev, sock, P_STATE, &p.head, sizeof(p), 0);
 
        mutex_unlock(&mdev->tconn->data.mutex);
 
@@ -1150,8 +1149,8 @@ send_bitmap_rle_or_plain(struct drbd_conf *mdev,
 
        if (len) {
                DCBP_set_code(p, RLE_VLI_Bits);
-               ok = _drbd_send_cmd(mdev, mdev->tconn->data.socket, P_COMPRESSED_BITMAP, h,
-                       sizeof(*p) + len, 0);
+               ok = !_drbd_send_cmd(mdev, mdev->tconn->data.socket, P_COMPRESSED_BITMAP, h,
+                                    sizeof(*p) + len, 0);
 
                c->packets[0]++;
                c->bytes[0] += sizeof(*p) + len;
@@ -1165,8 +1164,8 @@ send_bitmap_rle_or_plain(struct drbd_conf *mdev,
                len = num_words * sizeof(long);
                if (len)
                        drbd_bm_get_lel(mdev, c->word_offset, num_words, (unsigned long*)h->payload);
-               ok = _drbd_send_cmd(mdev, mdev->tconn->data.socket, P_BITMAP,
-                                  h, sizeof(struct p_header80) + len, 0);
+               ok = !_drbd_send_cmd(mdev, mdev->tconn->data.socket, P_BITMAP,
+                                    h, sizeof(struct p_header80) + len, 0);
                c->word_offset += num_words;
                c->bit_offset = c->word_offset * BITS_PER_LONG;
 
index 39e4915..d726309 100644 (file)
@@ -1215,8 +1215,8 @@ int w_send_barrier(struct drbd_work *w, int cancel)
        /* inc_ap_pending was done where this was queued.
         * dec_ap_pending will be done in got_BarrierAck
         * or (on connection loss) in w_clear_epoch.  */
-       ok = _drbd_send_cmd(mdev, mdev->tconn->data.socket, P_BARRIER,
-                           &p->head, sizeof(*p), 0);
+       ok = !_drbd_send_cmd(mdev, mdev->tconn->data.socket, P_BARRIER,
+                            &p->head, sizeof(*p), 0);
        drbd_put_data_sock(mdev->tconn);
 
        return ok;