提交 04dfa137 编写于 作者: A Andreas Gruenbacher 提交者: Philipp Reisner

drbd: _drbd_send_cmd(): Return 0 upon success and an error code otherwise

Signed-off-by: NPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: NLars Ellenberg <lars.ellenberg@linbit.com>
上级 ecf2363c
......@@ -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,
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册