From patchwork Fri Apr 12 02:18:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2433911 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 DAF27DF230 for ; Fri, 12 Apr 2013 02:18:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752451Ab3DLCSQ (ORCPT ); Thu, 11 Apr 2013 22:18:16 -0400 Received: from mail-ia0-f180.google.com ([209.85.210.180]:32996 "EHLO mail-ia0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751202Ab3DLCSP (ORCPT ); Thu, 11 Apr 2013 22:18:15 -0400 Received: by mail-ia0-f180.google.com with SMTP id l29so1965710iag.25 for ; Thu, 11 Apr 2013 19:18:15 -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=DlaqvE/Pf5XuZTCAUqvLHQUoMF1n6uy0++nR+Vsfz8I=; b=ONcR5ZOgPyLUCQWmKU2+hSwAZ0QWmcSwTt78R9kVlRsQkfL++4wDFWcwhlTjXBGLGc XFIUnYJetBaQoZuaeTNairAOX4eJyHksIg8uuMNnxP8VHkrjsMSXIssJPJNMD2BAV04k j7hekag7AuLkiKRm+fnYgAap3c+Q3FRlxoxiDn4cnO0hzcn4ABQ4vwfi93LgScQeJ7Va P4iwqgH7SVoJB26zSQm7Do68Jr1TA4W2phzOqQUklOMUJuUqGcI8zvBMOP4yoRx8xlgc sndxOtp38SSnNs8fHS+vEXlqAih/754gbJjJPXp7O2WuUPwNhJ7sLs6PSOdMwfyaHstg bpdw== X-Received: by 10.43.8.200 with SMTP id ot8mr5363065icb.11.1365733095453; Thu, 11 Apr 2013 19:18:15 -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 wn10sm1042244igb.2.2013.04.11.19.18.14 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 11 Apr 2013 19:18:14 -0700 (PDT) Message-ID: <51676EE7.6070103@inktank.com> Date: Thu, 11 Apr 2013 21:18:15 -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 07/11] rbd: encapsulate image object end request handling References: <51676E0F.2010504@inktank.com> In-Reply-To: <51676E0F.2010504@inktank.com> X-Gm-Message-State: ALoCoQn/SATwCPo9q23S12WcfOgjHWdjvnFhyP11Om/5YcfkbM1vrSgLnCTA7q0WIleGaDgGtEKm Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Encapsulate the code that completes processing of an object request that's part of an image request. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 54 +++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 25 deletions(-) struct rbd_img_request *img_request; @@ -1613,9 +1641,6 @@ static void rbd_img_obj_callback(struct rbd_obj_request *obj_request) dout("%s: img %p obj %p\n", __func__, img_request, obj_request); rbd_assert(img_request != NULL); - rbd_assert(!img_request_child_test(img_request)) - rbd_assert(img_request->rq != NULL); - rbd_assert(img_request->obj_request_count > 0); rbd_assert(which != BAD_WHICH); rbd_assert(which < img_request->obj_request_count); @@ -1626,33 +1651,12 @@ static void rbd_img_obj_callback(struct rbd_obj_request *obj_request) goto out; for_each_obj_request_from(img_request, obj_request) { - unsigned int xferred; - int result; - rbd_assert(more); rbd_assert(which < img_request->obj_request_count); if (!obj_request_done_test(obj_request)) break; - - rbd_assert(obj_request->xferred <= (u64)UINT_MAX); - xferred = (unsigned int)obj_request->xferred; - result = obj_request->result; - if (result) { - struct rbd_device *rbd_dev = img_request->rbd_dev; - - rbd_warn(rbd_dev, "%s %llx at %llx (%llx)\n", - img_request_write_test(img_request) ? "write" - : "read", - obj_request->length, obj_request->img_offset, - obj_request->offset); - rbd_warn(rbd_dev, " result %d xferred %x\n", - result, xferred); - if (!img_request->result) - img_request->result = result; - } - - more = blk_end_request(img_request->rq, result, xferred); + more = rbd_img_obj_end_request(obj_request); which++; } diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index a77157d..2d27115 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1603,6 +1603,34 @@ static void rbd_img_request_destroy(struct kref *kref) kfree(img_request); } +static bool rbd_img_obj_end_request(struct rbd_obj_request *obj_request) +{ + struct rbd_img_request *img_request = obj_request->img_request; + unsigned int xferred; + int result; + + rbd_assert(!img_request_child_test(img_request)); + rbd_assert(img_request->rq != NULL); + + rbd_assert(obj_request->xferred <= (u64)UINT_MAX); + xferred = (unsigned int)obj_request->xferred; + result = obj_request->result; + if (result) { + struct rbd_device *rbd_dev = img_request->rbd_dev; + + rbd_warn(rbd_dev, "%s %llx at %llx (%llx)\n", + img_request_write_test(img_request) ? "write" : "read", + obj_request->length, obj_request->img_offset, + obj_request->offset); + rbd_warn(rbd_dev, " result %d xferred %x\n", + result, xferred); + if (!img_request->result) + img_request->result = result; + } + + return blk_end_request(img_request->rq, result, xferred); +} + static void rbd_img_obj_callback(struct rbd_obj_request *obj_request) {