From patchwork Fri Sep 7 15:45:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1423611 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 899063FC85 for ; Fri, 7 Sep 2012 15:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752798Ab2IGPp3 (ORCPT ); Fri, 7 Sep 2012 11:45:29 -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 S1751857Ab2IGPp3 (ORCPT ); Fri, 7 Sep 2012 11:45:29 -0400 Received: by mail-iy0-f174.google.com with SMTP id k25so3327563iah.19 for ; Fri, 07 Sep 2012 08:45:28 -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=q5y3XeJD18kQxyQ6h19OWiCRSi904bguHDmvVJMJH/s=; b=ngzwOjNJ+zRHfxVH/kUZUwKTpjVay6BcLIYs9jUnkndr8y9VMUUungNbH+5fgFI8ME +YefbgnukhONlt6PmVnju01CBZYlYOCXOOPduxnu5iurmjXvuMRIPhtKxOxpskAiax7/ xT7eASKv7FjZThp4h1rsvwoz05sco1u8i4/32x8C3mQjDoO5b/7u1Wqqj8vVW9ISmOjW na9esmybogD944h+oYOqDSUWUvUKf4l3wag96+Aki0Elb3EeCofw9yrUeCa8wqAIODme IDNQLJupuYcacexY4y+b04GrUDl3vlUuaEoL/nyfc4Vbjo8vd96+CL9l+7DlroIZIaUg xAow== Received: by 10.50.33.138 with SMTP id r10mr9560937igi.31.1347032728538; Fri, 07 Sep 2012 08:45:28 -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 aa4sm8514541igc.15.2012.09.07.08.45.26 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 08:45:27 -0700 (PDT) Message-ID: <504A1695.8060504@inktank.com> Date: Fri, 07 Sep 2012 10:45:25 -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 8/9] rbd: set initial capacity in rbd_init_disk() References: <504A152E.4000905@inktank.com> In-Reply-To: <504A152E.4000905@inktank.com> X-Gm-Message-State: ALoCoQnFeod4v3SFYRBKtF4Saz1H4jUm5YCSkm7L989JxWj2jyra86yDwkK4+Vk6RBLBWWgkOhIB Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Move the setting of the initial capacity for an rbd image mapping into rb_init_disk(). Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index e6af38f..51e1d21 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1901,6 +1901,8 @@ 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); @@ -2642,7 +2644,6 @@ static ssize_t rbd_add(struct bus_type *bus, /* Everything's ready. Announce the disk to the world. */ - set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); add_disk(rbd_dev->disk); pr_info("%s: added with size 0x%llx\n", rbd_dev->disk->disk_name, (unsigned long long) rbd_dev->mapping.size);