diff options
author | Alex Elder <elder@inktank.com> | 2013-01-24 16:13:36 -0600 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-01 21:18:37 -0700 |
commit | a5a337d4382dfe0f9e9e072e7d3eaad8e05e4b0b (patch) | |
tree | 5683b236830708689357809ef97c18ff8dde9124 /drivers/block | |
parent | 5cbf6f12c48121199cc214c93dea98cce719343b (diff) |
rbd: record overall image request result
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>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 503e64f51fe1..69eab66b6c67 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++; |