From patchwork Fri Sep 7 15:45:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1423591 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 6E4B33FC85 for ; Fri, 7 Sep 2012 15:45:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752148Ab2IGPpP (ORCPT ); Fri, 7 Sep 2012 11:45:15 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:36790 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857Ab2IGPpO (ORCPT ); Fri, 7 Sep 2012 11:45:14 -0400 Received: by mail-iy0-f174.google.com with SMTP id k25so3327563iah.19 for ; Fri, 07 Sep 2012 08:45:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=FUIigCxR00onEWti5w0Zdnq24Z2+LntTJ6rrwnQzOtA=; b=S4p0mc1W7WCasm66fidGzLnmbl51k3++3taz/KwWNBtfbmLFOBbKlwbqNfUXNvZSPo 5dm/v5NMvcjK4HToYhF/MbnXxxjIDJOCfIU/ekrAxHJj/TZR5/pTi56poI4kv5DvpKLN V41XphKJ1wRLC3iDZ0Scvr2QX1cknbMVgvhDP+nmjWA3GdZVPXJkbwJgEUSfVPj6GpZD mEwMNBXVliuwgdscIiPjYscRbzBFeM14IPF2Xb20Vqhaf6zn4OM+SbL1pj8n/rCs2jYs 6aQUIooT1jBzB0N4Y1y5LoxOY3IGtS3cGKlJeYmhIhVbHeGJ3RHnCx2V5PCjaoUgp+/8 Og5g== Received: by 10.50.10.227 with SMTP id l3mr28604698igb.71.1347032713952; Fri, 07 Sep 2012 08:45:13 -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 p5sm8514435igm.13.2012.09.07.08.45.12 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 08:45:13 -0700 (PDT) Message-ID: <504A1687.9080104@inktank.com> Date: Fri, 07 Sep 2012 10:45:11 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 6/9] rbd: call rbd_init_disk() sooner References: <504A152E.4000905@inktank.com> In-Reply-To: <504A152E.4000905@inktank.com> X-Gm-Message-State: ALoCoQkKY/hPOGEj+txkJOQkBm97mVfNnzhdzFibCSMU08LPpFAbOZ5+E22X7Zy1Kw8bNv3cJ5uM Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Call rbd_init_disk() from rbd_add() as soon as we have the major device number for the mapping. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 53e5308..8e82610 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2619,10 +2619,16 @@ static ssize_t rbd_add(struct bus_type *bus, goto err_out_id; rbd_dev->major = rc; - rc = rbd_bus_add_dev(rbd_dev); + /* Set up the blkdev mapping. */ + + rc = rbd_init_disk(rbd_dev); if (rc) goto err_out_blkdev; + rc = rbd_bus_add_dev(rbd_dev); + if (rc) + goto err_out_disk; + /* * At this point cleanup in the event of an error is the job * of the sysfs code (initiated by rbd_bus_del_dev()). @@ -2634,12 +2640,6 @@ static ssize_t rbd_add(struct bus_type *bus, up_write(&rbd_dev->header_rwsem); - /* Set up the blkdev mapping. */ - - rc = rbd_init_disk(rbd_dev); - if (rc) - goto err_out_bus; - /* Everything's ready. Announce the disk to the world. */ set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); @@ -2662,6 +2662,8 @@ err_out_bus: kfree(options); return rc; +err_out_disk: + rbd_free_disk(rbd_dev); err_out_blkdev: unregister_blkdev(rbd_dev->major, rbd_dev->name); err_out_id: