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

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
Andreas Gruenbacher 2011-03-15 23:51:21 +01:00 committed by Philipp Reisner
parent ecf2363cb5
commit 04dfa13788
3 changed files with 10 additions and 11 deletions

View 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,

View 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;

View 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;