From patchwork Sat Apr 27 12:33:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2497081 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 0D4A4DF23A for ; Sat, 27 Apr 2013 12:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753059Ab3D0Mdl (ORCPT ); Sat, 27 Apr 2013 08:33:41 -0400 Received: from mail-ie0-f178.google.com ([209.85.223.178]:41033 "EHLO mail-ie0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752440Ab3D0Mdl (ORCPT ); Sat, 27 Apr 2013 08:33:41 -0400 Received: by mail-ie0-f178.google.com with SMTP id aq17so5783563iec.23 for ; Sat, 27 Apr 2013 05:33:39 -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=m0dorAVv1vhOsI0bEqi2B+UFRIYkX8cVkQDwJh/M6lM=; b=YnKIKdBGXJKf1tSCR3J/8/2W0h2u+i3m3yq/CDnDjqUz8P4d9M2cI4B5n6jEhvreR2 w4LaP0rliKoxtk/48dWv9olrYLJ8z6VLMwAgIev2/hxE6b7rFaWEPvwIYqLHEdgHunoy 1sZzpQGaO4p9s3lFWi8eITbCBVhWiBtbqSmMrN53/qehav1yDNWkM1RwnPt906cplfW4 Sc2p/1WNaxLEjtI0kUexZEhF0LpAuihi2Np0JlB5f5rqbEgUGNWwFzsGZe7BkorLagO8 v2NlssdoHJZssudEL02gSek2qCEEQLw5iqLrOwpFNBRjbk+0SAPHv2pIfAODfWBzrueh 6JgA== X-Received: by 10.43.8.133 with SMTP id os5mr26091246icb.38.1367066019611; Sat, 27 Apr 2013 05:33:39 -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 hi4sm8436500igc.6.2013.04.27.05.33.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Apr 2013 05:33:38 -0700 (PDT) Message-ID: <517BC5A2.5000604@inktank.com> Date: Sat, 27 Apr 2013 07:33:38 -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 3/4] rbd: defer setting disk capacity References: <517BC525.8090403@inktank.com> In-Reply-To: <517BC525.8090403@inktank.com> X-Gm-Message-State: ALoCoQmoyKhVWsCvdyqR7w7JaOSNQLqVItUS9aWwftu/PPyxQyq3Ieyb5tM0UJP7hoTdNHuUrhQS Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Don't set the disk capacity until right before we announce the device as available for use. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index b04e3e1..12bc89f 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -3147,8 +3147,6 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) rbd_dev->disk = disk; - set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); - return 0; out_disk: put_disk(disk); @@ -4778,6 +4776,7 @@ static int rbd_dev_probe_finish(struct rbd_device *rbd_dev) /* Everything's ready. Announce the disk to the world. */ + set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); set_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); add_disk(rbd_dev->disk);