From patchwork Fri Sep 7 13:39:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1422481 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 7C05ADF283 for ; Fri, 7 Sep 2012 13:40:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754114Ab2IGNkQ (ORCPT ); Fri, 7 Sep 2012 09:40:16 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:58520 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760098Ab2IGNjw (ORCPT ); Fri, 7 Sep 2012 09:39:52 -0400 Received: by iahk25 with SMTP id k25so3202941iah.19 for ; Fri, 07 Sep 2012 06:39:51 -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=hQAgmuAxZok82s6ev4e4s1iKEc9tB89VmYLkSuvAKAw=; b=chBVJuIWQ51yX4NU+goIMIIo8XynsBovU+Ae7Z/9YjQmsCU2JL5sXGgz4LZgGictCp mQ7QSy8xpDnt1zU2U9xdDC2//08F6FK4otaydzwxG1rDNfCAcZQov9FJGSSuJ7GBHDlY M5JpUiRqxp6MsxJDjbccY+jwmz2xdf4+FpkES88HnvJ9Rgmb/p7N024DiIkxZWWpFW+A eBX5oL5MmZem0P3yUZMu7n9MatMd202QQ/MTz9m+O/G1Cn415HFlX9643xKG7vGoDhJC drFp2NuexoaWFx0ZokLUF3KHHTro3xMw2ojjOyxiLjkp3IV9EmWdW+61lQD6oBaEV3Kx 7UaQ== Received: by 10.50.168.106 with SMTP id zv10mr28966667igb.13.1347025191689; Fri, 07 Sep 2012 06:39:51 -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 i17sm8147386igd.5.2012.09.07.06.39.49 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 06:39:50 -0700 (PDT) Message-ID: <5049F925.5050001@inktank.com> Date: Fri, 07 Sep 2012 08:39:49 -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 5/5] rbd: kill rbd_image_header->total_snaps References: <5049F7F5.1070609@inktank.com> In-Reply-To: <5049F7F5.1070609@inktank.com> X-Gm-Message-State: ALoCoQlo8ajhlz7QBB/FKNHE2CdJE2XIClSHtpALrcqebGUQEMrZ0KFwePwOxBwY2vOjqpia1Vx9 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The "total_snaps" field in an rbd header structure is never any different from the value of "num_snaps" stored within a snapshot context. Avoid any confusion by just using the value held within the snapshot context, and get rid of the "total_snaps" field. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) @@ -624,7 +622,8 @@ static int snap_by_name(struct rbd_image_header *header, const char *snap_name, int i; char *p = header->snap_names; - for (i = 0; i < header->total_snaps; i++) { + rbd_assert(header->snapc != NULL); + for (i = 0; i < header->snapc->num_snaps; i++) { if (!strcmp(snap_name, p)) { /* Found it. Pass back its id and/or size */ @@ -1839,7 +1838,6 @@ static int __rbd_refresh_header(struct rbd_device *rbd_dev, u64 *hver) *hver = h.obj_version; rbd_dev->header.obj_version = h.obj_version; rbd_dev->header.image_size = h.image_size; - rbd_dev->header.total_snaps = h.total_snaps; rbd_dev->header.snapc = h.snapc; rbd_dev->header.snap_names = h.snap_names; rbd_dev->header.snap_sizes = h.snap_sizes; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 774a36b..eb6b772 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -87,7 +87,6 @@ struct rbd_image_header { __u8 crypt_type; __u8 comp_type; struct ceph_snap_context *snapc; - u32 total_snaps; char *snap_names; u64 *snap_sizes; @@ -588,7 +587,6 @@ static int rbd_header_from_disk(struct rbd_image_header *header, header->obj_order = ondisk->options.order; header->crypt_type = ondisk->options.crypt_type; header->comp_type = ondisk->options.comp_type; - header->total_snaps = snap_count; /* Allocate and fill in the snapshot context */