From patchwork Fri Apr 12 02:17:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2433851 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9B578DF230 for ; Fri, 12 Apr 2013 02:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750875Ab3DLCRG (ORCPT ); Thu, 11 Apr 2013 22:17:06 -0400 Received: from mail-ia0-f179.google.com ([209.85.210.179]:38326 "EHLO mail-ia0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731Ab3DLCRF (ORCPT ); Thu, 11 Apr 2013 22:17:05 -0400 Received: by mail-ia0-f179.google.com with SMTP id l25so1979009iad.38 for ; Thu, 11 Apr 2013 19:17:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=YIPe3gPqB7i66z3LS6r7p3PU5W5OIz19wyVG4A5TpMc=; b=Sf+Gyip0X56OWn5+fN1bBJvbehzu2qHtQM5cnUzRyzHak/CQLrsxRKZIC/PYD3mjCL V4yFMtxHqVY5DJ61zVQFbxt3vDW08RAz8RmNEL0yHhMzJHNN7axddz4mupAkLjTBkSg3 X0QAqMSY1Zt+6uy+JK5qWXqNRcsYboubjqS7FYHiOrey7oFDHzShqBZmVtuXEQHTfSYo IND5aVngVdMGQvg0mWdshtVX3mYGTXOZ9eAKQN3NlmXAfW2oX6kn4g9V3v5FwTq5AY9r QNG61ggs8iFSnTN7aKT/j0QTjEDa+eNnK+x1X+9HWop4KBc+x4BNW5A+fVXG2m5q4flk LkRg== X-Received: by 10.50.37.212 with SMTP id a20mr403324igk.88.1365733023688; Thu, 11 Apr 2013 19:17:03 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id ur12sm1072438igb.8.2013.04.11.19.17.02 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Apr 2013 19:17:02 -0700 (PDT) Message-ID: <51676E9F.3030607@inktank.com> Date: Thu, 11 Apr 2013 21:17:03 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 01/11] rbd: record overall image request result References: <51676E0F.2010504@inktank.com> In-Reply-To: <51676E0F.2010504@inktank.com> X-Gm-Message-State: ALoCoQlqTSkmCE+EU46Is/F9v1gHWarFIXijjmOntK4vq6B0bgO3Iusc68/4r9kjlo5670khbg8g Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org 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 --- drivers/block/rbd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) which++; 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);