mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Reisner <philipp.reisner@linbit.com>
To: linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Cc: drbd-dev@lists.linbit.com
Subject: [PATCH 05/54] drbd: _drbd_send_cmd(): Return 0 upon success and an error code otherwise
Date: Mon,  5 Sep 2011 13:44:56 +0200	[thread overview]
Message-ID: <1315223145-20640-6-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1315223145-20640-1-git-send-email-philipp.reisner@linbit.com>

From: Andreas Gruenbacher <agruen@linbit.com>

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
 drivers/block/drbd/drbd_int.h    |    2 +-
 drivers/block/drbd/drbd_main.c   |   15 +++++++--------
 drivers/block/drbd/drbd_worker.c |    4 ++--
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 9badc52..32799ea 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -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,
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 58141ba..cf13c75 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -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;
 
diff --git a/drivers/block/drbd/drbd_worker.c b/drivers/block/drbd/drbd_worker.c
index 39e4915..d726309 100644
--- a/drivers/block/drbd/drbd_worker.c
+++ b/drivers/block/drbd/drbd_worker.c
@@ -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;
-- 
1.7.4.1


  parent reply	other threads:[~2011-09-05 11:46 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-05 11:44 [RFC 00/54] drbd: part 6 of adding multiple volume support to drbd Philipp Reisner
2011-09-05 11:44 ` [PATCH 01/54] drbd: drbd_get_data_sock(): Return 0 upon success and an error code otherwise Philipp Reisner
2011-09-05 11:44 ` [PATCH 02/54] drbd: Add drbd_send_all(): Send an entire buffer Philipp Reisner
2011-09-05 11:44 ` [PATCH 03/54] drbd: conn_send_cmd2(): Return 0 upon success and an error code otherwise Philipp Reisner
2011-09-05 11:44 ` [PATCH 04/54] drbd: _conn_send_cmd(): " Philipp Reisner
2011-09-05 11:44 ` Philipp Reisner [this message]
2011-09-05 11:44 ` [PATCH 06/54] drbd: conn_send_cmd(): " Philipp Reisner
2011-09-05 11:44 ` [PATCH 07/54] drbd: Get rid of USE_DATA_SOCKET and USE_META_SOCKET Philipp Reisner
2011-09-05 11:44 ` [PATCH 08/54] drbd: drbd_send_cmd(): Return 0 upon success and an error code otherwise Philipp Reisner
2011-09-05 11:45 ` [PATCH 09/54] drbd: drbd_send_sync_param(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 10/54] drbd: drbd_send_state(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 11/54] drbd: drbd_send_handshake(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 12/54] drbd: drbd_send_protocol(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 13/54] drbd: drbd_send_uuids() and its variants: " Philipp Reisner
2011-09-05 11:45 ` [PATCH 14/54] drbd: drbd_gen_and_send_sync_uuid(): Return void: the result is never used Philipp Reisner
2011-09-05 11:45 ` [PATCH 15/54] drbd: drbd_send_sizes(): Return 0 upon success and an error code otherwise Philipp Reisner
2011-09-05 11:45 ` [PATCH 16/54] drbd: _conn_send_state_req(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 17/54] drbd: conn_send_state_req(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 18/54] drbd: drbd_send_state_req(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 19/54] drbd: drbd_send_sr_reply(): Return void: the result is never used Philipp Reisner
2011-09-05 11:45 ` [PATCH 20/54] drbd: drbd_send_b_ack(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 21/54] drbd: _drbd_send_ack(): Return 0 upon success and an error code otherwise Philipp Reisner
2011-09-05 11:45 ` [PATCH 22/54] drbd: drbd_send_ack(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 23/54] drbd: drbd_send_ack_{dp,rp}(): Return void: the result is never used Philipp Reisner
2011-09-05 11:45 ` [PATCH 24/54] drbd: drbd_send_ack_ex(): Return 0 upon success and an error code otherwise Philipp Reisner
2011-09-05 11:45 ` [PATCH 25/54] drbd: drbd_send_drequest(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 26/54] drbd: drbd_send_drequest_csum(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 27/54] drbd: drbd_send_oos(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 28/54] drbd: _drbd_no_send_page(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 29/54] drbd: _drbd_send_page(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 30/54] drbd: _drbd_send_zc_ee(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 31/54] drbd: drbd_send_block(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 32/54] drbd: _drbd_send_bio(), _drbd_send_zc_bio(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 33/54] drbd: drbd_send_dblock(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 34/54] drbd: drbd_send_short_cmd(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 35/54] drbd: Temporarily change the return type of all worker callbacks Philipp Reisner
2011-09-05 11:45 ` [PATCH 36/54] drbd: Make all worker callbacks return 0 upon success and an error code otherwise Philipp Reisner
2011-09-05 11:45 ` [PATCH 37/54] drbd: drbd_process_done_ee(): Return " Philipp Reisner
2011-09-05 11:45 ` [PATCH 38/54] drbd: decode_header(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 39/54] drbd: drbd_recv_header(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 40/54] drbd: drbd_drain_block(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 41/54] drbd: recv_dless_read(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 42/54] drbd: recv_resync_read(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 43/54] drbd: send_bitmap_rle_or_plain(): Error handling cleanup Philipp Reisner
2011-09-05 11:45 ` [PATCH 44/54] drbd: Add drbd_recv_all(): Receive an entire buffer Philipp Reisner
2011-09-05 11:45 ` [PATCH 45/54] drbd: Make all command handlers return 0 upon success and an error code otherwise Philipp Reisner
2011-09-05 11:45 ` [PATCH 46/54] drbd: drbd_bm_read() never returns a positive value through drbd_bitmap_io() Philipp Reisner
2011-09-05 11:45 ` [PATCH 47/54] drbd: _drbd_md_sync_page_io(): Return 0 upon success and an error code otherwise Philipp Reisner
2011-09-05 11:45 ` [PATCH 48/54] drbd: drbd_md_sync_page_io(): " Philipp Reisner
2011-09-05 11:45 ` [PATCH 49/54] drbd: Remove duplicate initialization Philipp Reisner
2011-09-05 11:45 ` [PATCH 50/54] drbd: Remove unnecessary assertion Philipp Reisner
2011-09-05 11:45 ` [PATCH 51/54] drbd: drbd_may_do_local_read(): Use bool/true/false Philipp Reisner
2011-09-05 11:45 ` [PATCH 52/54] drbd: Rename various functions from *_oos_* to *_out_of_sync_* for clarity Philipp Reisner
2011-09-05 11:45 ` [PATCH 53/54] drbd: Get rid of typedef drbd_work_cb Philipp Reisner
2011-09-05 11:45 ` [PATCH 54/54] drbd: Introduce and use drbd_recv_all_warn() Philipp Reisner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315223145-20640-6-git-send-email-philipp.reisner@linbit.com \
    --to=philipp.reisner@linbit.com \
    --cc=axboe@kernel.dk \
    --cc=drbd-dev@lists.linbit.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®