From patchwork Tue Apr 16 03:38: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: 2447391 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B0C593FD40 for ; Tue, 16 Apr 2013 03:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935531Ab3DPDiS (ORCPT ); Mon, 15 Apr 2013 23:38:18 -0400 Received: from mail-ia0-f176.google.com ([209.85.210.176]:36930 "EHLO mail-ia0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935355Ab3DPDiR (ORCPT ); Mon, 15 Apr 2013 23:38:17 -0400 Received: by mail-ia0-f176.google.com with SMTP id i9so47341iad.7 for ; Mon, 15 Apr 2013 20:38:17 -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=oVeQyGam2FUeHy1LRT2F65n6wnpszPkrEuI6+d6jKLU=; b=Z+wkuKe6mTV6t10qoQ+xPFwwnVyz8OmyisyXzHZU/+pLneM8hkflpMxg4I3+xje0NY eXJfQKtAPvVNhHFrIyzwkioDDGuDQNYdSuWzrqBJ0VvMu5jVapquOGhUoxmg3itW1ZkQ YpGCOIwpEgTCsbUal+VktIuiJOiXOLau24PAvAkcIXm42biQzrORapMiw6zjCzlcnHc3 FTupfa682uinTXmf/DPhWNNxp4p0j5JA14K0+7vLO4As5j+8KVyz079qYqHHyXaicuFQ GmmV0RWw2EtGmhaOQwUQoxb3HQGRWIVnaA88OCr7EL+C1YVHKa/nF6jia5cfB62MIOru mHRw== X-Received: by 10.50.5.180 with SMTP id t20mr6654304igt.80.1366083497208; Mon, 15 Apr 2013 20:38:17 -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 vb15sm188049igb.9.2013.04.15.20.38.16 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Apr 2013 20:38:16 -0700 (PDT) Message-ID: <516CC7A7.5060907@inktank.com> Date: Mon, 15 Apr 2013 22:38: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 4/7] rbd: adjust image object request ref counting References: <516CC6E4.6070307@inktank.com> In-Reply-To: <516CC6E4.6070307@inktank.com> X-Gm-Message-State: ALoCoQkHTzS2AxMnZnVQA34I/utatVWxCht3VzsLgbVEJcoiMvEhntM+EzjA84nGGxuNJi5BAXKZ Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org An extra reference is taken when an object request is added as one of the requests making up an image object. A reference is dropped again when the image's object requests get submitted. The original reference for the object request will remain throughout this period, so we don't need to add and then take away an extra one. This can be interpreted as the image request inheriting the original object request's reference. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) rbd_assert(!obj_request_img_data_test(obj_request)); @@ -1815,12 +1815,6 @@ static int rbd_img_request_submit(struct rbd_img_request *img_request) ret = rbd_obj_request_submit(osdc, obj_request); if (ret) return ret; - /* - * The image request has its own reference to each - * of its object requests, so we can safely drop the - * initial one here. - */ - rbd_obj_request_put(obj_request); } return 0; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 8e8b876..81751cd 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1167,7 +1167,7 @@ static inline void rbd_img_obj_request_add(struct rbd_img_request *img_request, { rbd_assert(obj_request->img_request == NULL); - rbd_obj_request_get(obj_request); + /* Image request now owns object's original reference */ obj_request->img_request = img_request; obj_request->which = img_request->obj_request_count;