From patchwork Sat Apr 27 19:39:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2497401 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 06FFFDF23A for ; Sat, 27 Apr 2013 19:39:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754120Ab3D0TjV (ORCPT ); Sat, 27 Apr 2013 15:39:21 -0400 Received: from mail-ie0-f179.google.com ([209.85.223.179]:38224 "EHLO mail-ie0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753986Ab3D0TjU (ORCPT ); Sat, 27 Apr 2013 15:39:20 -0400 Received: by mail-ie0-f179.google.com with SMTP id 16so6022957iea.38 for ; Sat, 27 Apr 2013 12:39:20 -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=m5p3kkfkvVrIYqdQFq6viRxBjlMh5cvFp/9SN1VpzFA=; b=LdU4GXgZA4YzPf4RU6r0Kd2cPkhwWCWk6CVhc60YmUl5/vfMsT2QueIXzoT8Fw2huI pDg/WsiMRLIJnIkJEcFtaf/wN1mnBiAGZlp95/NYetOZU4v24/50vnf85Etigg7W5dBS NUebUDdR+F+OsxRPkNd0h2Sg4e7HX8w++wRF1lB6M/f9sKnm1towFIzt/8m4ZKp4f5oW qv6nWYlfwtFxVEMQ9Zj+/tCYp/dpHcWvn+fcqnm0/JQz8jTdpK7NVlusGoKE/7XrcTWd TKtRDag1Mt0OiwQ8wQvV3I5uT2/CMa5OnznAP2Pc2LHh6jU+ztGt2EMr1LI6iwv6mgRU qTnw== X-Received: by 10.50.118.7 with SMTP id ki7mr4662607igb.35.1367091560473; Sat, 27 Apr 2013 12:39:20 -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 ESMTPSA id o10sm10147045igh.2.2013.04.27.12.39.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Apr 2013 12:39:19 -0700 (PDT) Message-ID: <517C2966.5040103@inktank.com> Date: Sat, 27 Apr 2013 14:39:18 -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 1/5] rbd: move more initialization into rbd_dev_probe_image() References: <517C2914.8030400@inktank.com> In-Reply-To: <517C2914.8030400@inktank.com> X-Gm-Message-State: ALoCoQnCI0EM+spUvouTL+wo16j2TIcSToev1hN81NC7kNwEzK8YFVkmKXGL7hUkBNcSDaZtbLxS Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Move a block of initialization related to the "ceph-side" of an rbd image out of rbd_dev_probe_finish() and into rbd_dev_probe_image(). Signed-off-by: Alex Elder --- drivers/block/rbd.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) @@ -4817,8 +4804,6 @@ err_out_id: rbd_dev_id_put(rbd_dev); if (rbd_dev->parent); rbd_dev_remove_parent(rbd_dev); -err_out_snaps: - rbd_remove_all_snaps(rbd_dev); return ret; } @@ -4849,11 +4834,29 @@ static int rbd_dev_probe_image(struct rbd_device *rbd_dev) if (ret) goto out_err; + ret = rbd_dev_snaps_update(rbd_dev); + if (ret) + goto out_err; + + ret = rbd_dev_spec_update(rbd_dev); + if (ret) + goto err_out_snaps; + + ret = rbd_dev_probe_parent(rbd_dev); + if (ret) + goto err_out_snaps; + ret = rbd_dev_probe_finish(rbd_dev); if (ret) - rbd_header_free(&rbd_dev->header); + goto err_out_parent; return ret; +err_out_parent: + rbd_header_free(&rbd_dev->header); + if (rbd_dev->parent); + rbd_dev_remove_parent(rbd_dev); +err_out_snaps: + rbd_remove_all_snaps(rbd_dev); out_err: kfree(rbd_dev->spec->image_id); rbd_dev->spec->image_id = NULL; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 5fd923f..8a9ad60 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4742,19 +4742,6 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev) { int ret; - /* no need to lock here, as rbd_dev is not registered yet */ - ret = rbd_dev_snaps_update(rbd_dev); - if (ret) - return ret; - - ret = rbd_dev_spec_update(rbd_dev); - if (ret) - goto err_out_snaps; - - ret = rbd_dev_probe_parent(rbd_dev); - if (ret) - goto err_out_snaps; - /* generate unique id: find highest unique id, add one */ rbd_dev_id_get(rbd_dev);