All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 01/11] rbd: record overall image request result
Date: Thu, 11 Apr 2013 21:17:03 -0500	[thread overview]
Message-ID: <51676E9F.3030607@inktank.com> (raw)
In-Reply-To: <51676E0F.2010504@inktank.com>

If any image object request produces a non-zero result, preserve
that as the result of the overall image request.  If multiple
objects have non-zero results, save only the first one.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 503e64f..69eab66 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -214,6 +214,7 @@ struct rbd_img_request {
 	spinlock_t		completion_lock;/* protects next_completion */
 	u32			next_completion;
 	rbd_img_callback_t	callback;
+	int			result;	/* first nonzero obj_request result */

 	u32			obj_request_count;
 	struct list_head	obj_requests;	/* rbd_obj_request structs */
@@ -1488,6 +1489,7 @@ static struct rbd_img_request *rbd_img_request_create(
 	spin_lock_init(&img_request->completion_lock);
 	img_request->next_completion = 0;
 	img_request->callback = NULL;
+	img_request->result = 0;
 	img_request->obj_request_count = 0;
 	INIT_LIST_HEAD(&img_request->obj_requests);
 	kref_init(&img_request->kref);
@@ -1552,13 +1554,16 @@ static void rbd_img_obj_callback(struct
rbd_obj_request *obj_request)
 		if (!obj_request_done_test(obj_request))
 			break;

-		rbd_assert(obj_request->xferred <= (u64) UINT_MAX);
-		xferred = (unsigned int) obj_request->xferred;
-		result = (int) obj_request->result;
-		if (result)
+		rbd_assert(obj_request->xferred <= (u64)UINT_MAX);
+		xferred = (unsigned int)obj_request->xferred;
+		result = obj_request->result;
+		if (result) {
 			rbd_warn(NULL, "obj_request %s result %d xferred %u\n",
 				img_request->write_request ? "write" : "read",
 				result, xferred);
+			if (!img_request->result)
+				img_request->result = result;
+		}

 		more = blk_end_request(img_request->rq, result, xferred);
 		which++;
-- 
1.7.9.5


  reply	other threads:[~2013-04-12  2:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12  2:14 [PATCH 00/11] rbd: layered read functionality Alex Elder
2013-04-12  2:17 ` Alex Elder [this message]
2013-04-12  2:17 ` [PATCH 02/11] rbd: record aggregate image transfer count Alex Elder
2013-04-12  2:17 ` [PATCH 03/11] rbd: record image-relative offset in object requests Alex Elder
2013-04-12  2:17 ` [PATCH 04/11] rbd: define image request flags Alex Elder
2013-04-12  2:17 ` [PATCH 05/11] rbd: define image request originator flag Alex Elder
2013-04-12  2:18 ` [PATCH 06/11] rbd: define image request layered flag Alex Elder
2013-04-12  2:18 ` [PATCH 07/11] rbd: encapsulate image object end request handling Alex Elder
2013-04-12  2:18 ` [PATCH 08/11] rbd: define an rbd object request flags field Alex Elder
2013-04-12  2:18 ` [PATCH 09/11] rbd: add an object request flag for image data objects Alex Elder
2013-04-12  2:18 ` [PATCH 10/11] rbd: probe the parent of an image if present Alex Elder
2013-04-12  2:19 ` [PATCH 11/11] rbd: implement layered reads Alex Elder
2013-04-14 17:22 ` [PATCH 00/11] rbd: layered read functionality Josh Durgin

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=51676E9F.3030607@inktank.com \
    --to=elder@inktank.com \
    --cc=ceph-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.