From patchwork Tue May 7 01:52:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2529841 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 C84003FD85 for ; Tue, 7 May 2013 01:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932713Ab3EGBwv (ORCPT ); Mon, 6 May 2013 21:52:51 -0400 Received: from mail-qc0-f181.google.com ([209.85.216.181]:54190 "EHLO mail-qc0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759546Ab3EGBwu (ORCPT ); Mon, 6 May 2013 21:52:50 -0400 Received: by mail-qc0-f181.google.com with SMTP id s10so30327qcv.12 for ; Mon, 06 May 2013 18:52:49 -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=RAUGz/tgAh1mPvcyoE//mob2+43AK5fBxjKMfJm4ssU=; b=hAmDNbCuy2QE33xeEgqOnHtF5W59tTHEO07yUjBDDxJuqnCi23FKcMmb0tCm4VOq6n UlToPXerpsshimp1n7siW/WR0Rb4gWo24c+sejal+RHyoQfDGuExoPtIi7OpxHArzv89 3NSpSRtNicXVIST3bhhnS3GCW7yZfAVg1XM1N7SUszgKqNbOxB/p3lUS3pvdrGhN+8Sn 1iT/v5xMSHsAwr78ZpfecYTKZYJLc4u/bVPSx7ocnQBwxfg+so6jfR7FME+FG2E64zyx GyIRA4C699oj61dUUsNu/gmks0MpB1u5JRpfybKdFMGuKirTsH9XYA2MnFu+wS3cWYLj hpVQ== X-Received: by 10.49.81.200 with SMTP id c8mr30388640qey.50.1367891569704; Mon, 06 May 2013 18:52:49 -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 s10sm42556082qam.7.2013.05.06.18.52.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 May 2013 18:52:49 -0700 (PDT) Message-ID: <51885E70.2070901@inktank.com> Date: Mon, 06 May 2013 20:52:48 -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 2/7] rbd: zero format 1 header structure earlier References: <51885E06.8020201@inktank.com> In-Reply-To: <51885E06.8020201@inktank.com> X-Gm-Message-State: ALoCoQmbD6XFJBqYnl46jktlwihz6rS2VWECg5CcZftigW5UD+LpRKSpea8NVpieAkKdaPcOck6M Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The passed-in header structure is zeroed in rbd_header_from_disk(). Instead, have the caller do it. Note that there are two callers, rbd_dev_v1_refresh() and rbd_dev_v1_probe(). The latter already has a zeroed header structure so zeroing it isn't necessary there. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) len = strnlen(ondisk->object_prefix, sizeof (ondisk->object_prefix)); @@ -3103,6 +3101,7 @@ static int rbd_dev_v1_refresh(struct rbd_device *rbd_dev) int ret; struct rbd_image_header h; + memset(&h, 0, sizeof (h)); ret = rbd_read_header(rbd_dev, &h); if (ret < 0) return ret; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 357a11f..cdba93b 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -738,8 +738,6 @@ static int rbd_header_from_disk(struct rbd_image_header *header, size_t size; u32 i; - memset(header, 0, sizeof (*header)); - snap_count = le32_to_cpu(ondisk->snap_count);