From patchwork Thu Jul 24 08:42:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 4615061 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D022C9F295 for ; Thu, 24 Jul 2014 08:43:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 034042017D for ; Thu, 24 Jul 2014 08:43:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2930820160 for ; Thu, 24 Jul 2014 08:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934462AbaGXInN (ORCPT ); Thu, 24 Jul 2014 04:43:13 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:59506 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934448AbaGXInL (ORCPT ); Thu, 24 Jul 2014 04:43:11 -0400 Received: by mail-lb0-f179.google.com with SMTP id v6so2010712lbi.10 for ; Thu, 24 Jul 2014 01:43:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=PjIyUZQxU+EhX0PeG0yJmpRgT1Xt7nn4sk9g2t32fTM=; b=YUVUwYM0f/pfxkaBVcKXGCrU5Ac97P3+j+jiZu1ss/+uLoF+xIQ8V26rVn+tEH3TVW aAVKgtOJIj5JeNdN2qx/IaSswEmw0F8SVefWE+OXaB23Vu+3kC6g83nBMEJpMSaTiE26 zhzeFwRfhAxH31rUkHckqmpl+XJAzhJ7u4lczJXsh4mX2WEPZyimCalHb8c4mtKAMuIM eM6N5AQNiHccs9/oXRTQW0Nv4b6qwYql8TnwRiteWvH1ti9imqCGG7E/G8JygHpMU4+Z 4bfR1mkQPqhzkIpjS6tvuUrG46WP0RJH/DfjKrzQSqaj1uyHUX6C9wvEOfkY/Whb14l+ BnRg== X-Gm-Message-State: ALoCoQn2eUqgEf0TkLwkSnYIxjK4MfKo/7jCXh1AQFrC4yhwP7MSsDS3eLf5J9uLHFO0ALCfWIJc X-Received: by 10.152.5.167 with SMTP id t7mr8053080lat.54.1406191389896; Thu, 24 Jul 2014 01:43:09 -0700 (PDT) Received: from localhost ([109.110.66.237]) by mx.google.com with ESMTPSA id qa9sm9604849lbb.35.2014.07.24.01.43.08 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 24 Jul 2014 01:43:09 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 6/8] rbd: update mapping size only on refresh Date: Thu, 24 Jul 2014 12:42:47 +0400 Message-Id: <1406191369-6746-7-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1406191369-6746-1-git-send-email-ilya.dryomov@inktank.com> References: <1406191369-6746-1-git-send-email-ilya.dryomov@inktank.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is no sense in trying to update the mapping size before it's even been set. Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder Reviewed-by: Alex Elder --- drivers/block/rbd.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 5dd6f5057ef4..16f388f2960b 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -971,12 +971,6 @@ static int rbd_header_from_disk(struct rbd_device *rbd_dev, header->snap_names = snap_names; header->snap_sizes = snap_sizes; - /* Make sure mapping size is consistent with header info */ - - if (rbd_dev->spec->snap_id == CEPH_NOSNAP || first_time) - if (rbd_dev->mapping.size != header->image_size) - rbd_dev->mapping.size = header->image_size; - return 0; out_2big: ret = -EIO; @@ -3520,9 +3514,14 @@ static int rbd_dev_refresh(struct rbd_device *rbd_dev) ret = rbd_dev_header_info(rbd_dev); - /* If it's a mapped snapshot, validate its EXISTS flag */ + if (rbd_dev->spec->snap_id == CEPH_NOSNAP) { + if (rbd_dev->mapping.size != rbd_dev->header.image_size) + rbd_dev->mapping.size = rbd_dev->header.image_size; + } else { + /* validate mapped snapshot's EXISTS flag */ + rbd_exists_validate(rbd_dev); + } - rbd_exists_validate(rbd_dev); up_write(&rbd_dev->header_rwsem); if (mapping_size != rbd_dev->mapping.size) { @@ -4505,10 +4504,6 @@ static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev) "is EXPERIMENTAL!"); } - if (rbd_dev->spec->snap_id == CEPH_NOSNAP) - if (rbd_dev->mapping.size != rbd_dev->header.image_size) - rbd_dev->mapping.size = rbd_dev->header.image_size; - ret = rbd_dev_v2_snap_context(rbd_dev); dout("rbd_dev_v2_snap_context returned %d\n", ret);