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 01/12] drbd: validate_req_change_req_state(): Return 0 upon success and an error code otherwise
Date: Thu, 29 Sep 2011 10:15:20 +0200	[thread overview]
Message-ID: <1317284131-17464-2-git-send-email-philipp.reisner@linbit.com> (raw)
In-Reply-To: <1317284131-17464-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_receiver.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index 7539253..af9c2c0 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -4587,14 +4587,14 @@ validate_req_change_req_state(struct drbd_conf *mdev, u64 id, sector_t sector,
 	req = find_request(mdev, root, id, sector, missing_ok, func);
 	if (unlikely(!req)) {
 		spin_unlock_irq(&mdev->tconn->req_lock);
-		return false;
+		return -EIO;
 	}
 	__req_mod(req, what, &m);
 	spin_unlock_irq(&mdev->tconn->req_lock);
 
 	if (m.bio)
 		complete_master_bio(mdev, &m);
-	return true;
+	return 0;
 }
 
 static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi)
@@ -4642,9 +4642,9 @@ static int got_BlockAck(struct drbd_tconn *tconn, struct packet_info *pi)
 		return false;
 	}
 
-	return validate_req_change_req_state(mdev, p->block_id, sector,
-					     &mdev->write_requests, __func__,
-					     what, false);
+	return !validate_req_change_req_state(mdev, p->block_id, sector,
+					      &mdev->write_requests, __func__,
+					      what, false);
 }
 
 static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi)
@@ -4655,7 +4655,7 @@ static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi)
 	int size = be32_to_cpu(p->blksize);
 	bool missing_ok = tconn->net_conf->wire_protocol == DRBD_PROT_A ||
 			  tconn->net_conf->wire_protocol == DRBD_PROT_B;
-	bool found;
+	int err;
 
 	mdev = vnr_to_mdev(tconn, pi->vnr);
 	if (!mdev)
@@ -4669,10 +4669,10 @@ static int got_NegAck(struct drbd_tconn *tconn, struct packet_info *pi)
 		return true;
 	}
 
-	found = validate_req_change_req_state(mdev, p->block_id, sector,
-					      &mdev->write_requests, __func__,
-					      NEG_ACKED, missing_ok);
-	if (!found) {
+	err = validate_req_change_req_state(mdev, p->block_id, sector,
+					    &mdev->write_requests, __func__,
+					    NEG_ACKED, missing_ok);
+	if (err) {
 		/* Protocol A has no P_WRITE_ACKs, but has P_NEG_ACKs.
 		   The master bio might already be completed, therefore the
 		   request is no longer in the collision hash. */
@@ -4700,9 +4700,9 @@ static int got_NegDReply(struct drbd_tconn *tconn, struct packet_info *pi)
 	dev_err(DEV, "Got NegDReply; Sector %llus, len %u; Fail original request.\n",
 	    (unsigned long long)sector, be32_to_cpu(p->blksize));
 
-	return validate_req_change_req_state(mdev, p->block_id, sector,
-					     &mdev->read_requests, __func__,
-					     NEG_ACKED, false);
+	return !validate_req_change_req_state(mdev, p->block_id, sector,
+					      &mdev->read_requests, __func__,
+					      NEG_ACKED, false);
 }
 
 static int got_NegRSDReply(struct drbd_tconn *tconn, struct packet_info *pi)
-- 
1.7.4.1


  reply	other threads:[~2011-09-29  8:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-29  8:15 [RFC 00/12] drbd: part 11 of adding multiple volume support to drbd Philipp Reisner
2011-09-29  8:15 ` Philipp Reisner [this message]
2011-09-29  8:15 ` [PATCH 02/12] drbd: Make all asynchronous command handlers return 0 upon success and an error code otherwise Philipp Reisner
2011-09-29  8:15 ` [PATCH 03/12] drbd: drbd_init_ee() no longer exists Philipp Reisner
2011-09-29  8:15 ` [PATCH 04/12] drbd: Rename drbd_alloc_ee() to drbd_alloc_peer_req() Philipp Reisner
2011-09-29  8:15 ` [PATCH 05/12] drbd: Rename drbd_free_ee() and variants to *_peer_req() Philipp Reisner
2011-09-29  8:15 ` [PATCH 06/12] drbd: Rename drbd_release_ee() to drbd_free_peer_reqs() Philipp Reisner
2011-09-29  8:15 ` [PATCH 07/12] drbd: Rename reclaim_net_ee(), drbd_process_done_ee(), drbd_process_done_ee(), tconn_process_done_ee() to *_peer_reqs Philipp Reisner
2011-09-29  8:15 ` [PATCH 08/12] drbd: Rename drbd_{ ee -> peer_req }_has_active_page Philipp Reisner
2011-09-29  8:15 ` [PATCH 09/12] drbd: Make drbd_wait_ee_list_empty() and _drbd_wait_ee_list_empty() static Philipp Reisner
2011-09-29  8:15 ` [PATCH 10/12] drbd: Rename drbd_pp_first_pages_or_try_alloc() to __drbd_alloc_pages() Philipp Reisner
2011-09-29  8:15 ` [PATCH 11/12] drbd: Rename drbd_pp_alloc() to drbd_alloc_pages() and make it non-static Philipp Reisner
2011-09-29  8:15 ` [PATCH 12/12] drbd: Rename drbd_pp_free() to drbd_free_pages() 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=1317284131-17464-2-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®