From patchwork Sat Apr 27 12:33:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2497091 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 16A42DF23A for ; Sat, 27 Apr 2013 12:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754444Ab3D0Mdy (ORCPT ); Sat, 27 Apr 2013 08:33:54 -0400 Received: from mail-ia0-f175.google.com ([209.85.210.175]:46071 "EHLO mail-ia0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753343Ab3D0Mdy (ORCPT ); Sat, 27 Apr 2013 08:33:54 -0400 Received: by mail-ia0-f175.google.com with SMTP id i38so4348130iae.6 for ; Sat, 27 Apr 2013 05:33:53 -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=STQCIXBQcV+G8speyztJBKnNFNGZWcIMfI+gNMivLCw=; b=THnNj3C7GvjNWVmAQ+oMC+4gKM8G+xebcqc4bdF2Lqa9cEhteZHqPXmbHfTy+R1089 aiVIWSNWIxYYQco2Wj6G2unIIEnmQTqi3eKdD0HeNNpQlnTPumtM6lStnvgsL9pWSwFw sNyuOp1WjuaG2l5vtPBjUN07uBQsGVFWCkGgBcH2geiibU/1NqDJ+TM9PaXZD5YMBq5z 8bOQ+rCCa/0MN2D017nxVYnl+pVogxk3liecLvCIQEw0EEFetNTx4OY1D0etkPsoDUQc cJ5TVTCmzWUYE5M0es0dEofof2j5nBdQ26gy9BZi/nap2r4bdbCd4R/YSEB6blgYIyU8 MSjA== X-Received: by 10.50.136.138 with SMTP id qa10mr4040320igb.74.1367066033638; Sat, 27 Apr 2013 05:33:53 -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 ve9sm8452062igb.3.2013.04.27.05.33.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Apr 2013 05:33:53 -0700 (PDT) Message-ID: <517BC5B0.3040106@inktank.com> Date: Sat, 27 Apr 2013 07:33:52 -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/4] rbd: defer setting the mapping size and features References: <517BC525.8090403@inktank.com> In-Reply-To: <517BC525.8090403@inktank.com> X-Gm-Message-State: ALoCoQmhEkoHAVwFvB+NE/80IQyHYmvuy1+a69kKUC23PSZyjEdmQ7hXaIETLlFVHkCBr5+ZF+CK Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org There's no need to set the size/features for a mapped device until we're about to make it available for use. So wait until then to do it. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) @@ -4774,10 +4770,15 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev) if (ret) goto err_out_bus; - /* Everything's ready. Announce the disk to the world. */ + ret = rbd_dev_set_mapping(rbd_dev); + if (ret) + goto err_out_bus; set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); set_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); + + /* Everything's ready. Announce the disk to the world. */ + add_disk(rbd_dev->disk); pr_info("%s: added with size 0x%llx\n", rbd_dev->disk->disk_name, diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 12bc89f..b10348c 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4712,10 +4712,6 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev) if (ret) goto err_out_snaps; - ret = rbd_dev_set_mapping(rbd_dev); - if (ret) - goto err_out_snaps; - /* generate unique id: find highest unique id, add one */ rbd_dev_id_get(rbd_dev);