From patchwork Sun Jan 3 18:59:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Byongho Lee X-Patchwork-Id: 7943901 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1D51B9F38D for ; Sun, 3 Jan 2016 19:00:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 28DC520382 for ; Sun, 3 Jan 2016 19:00:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D1B320253 for ; Sun, 3 Jan 2016 19:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752258AbcACTAU (ORCPT ); Sun, 3 Jan 2016 14:00:20 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35130 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752135AbcACTAS (ORCPT ); Sun, 3 Jan 2016 14:00:18 -0500 Received: by mail-pa0-f46.google.com with SMTP id do7so398119pab.2 for ; Sun, 03 Jan 2016 11:00:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/qA8ra7QIlG1UZHkAf+KjQsbbrt6I29YelmaG8gUElQ=; b=QIUXYJN0bfjEiwPZZb1RvSTUw3JGgiw9w5M5vK0SMDrBgBnJcTRrtYpdqgazOG2/Ei Ye7guV6dW/BLrwy02OkX6fBLkXAhnHpVnrayMNR3ZCbOknhMjNng5szl+NjLE/2ZIdrb S/z6nADhSjNiRa9een5iuenh1N2UBN7lA2EZomAS16NK9V8FN39baTBAl7qZEAM/Lilz Odop1sqUs/5AuxsbOZ5w2/sgqIN8r7fM+wqo+Y71cAGqlNrCe4lvYelXn1ORyX6/BH9k Q6GbhNfti5Kl2j4ha+yPGARDKEV/aipKEBTDefwD4fd2vrFnMS0UfU9DjdAzHl3UjI1B Gztg== X-Received: by 10.66.120.200 with SMTP id le8mr121470825pab.61.1451847618028; Sun, 03 Jan 2016 11:00:18 -0800 (PST) Received: from arch-gct.localdomain ([175.114.213.172]) by smtp.gmail.com with ESMTPSA id fc6sm120726837pac.44.2016.01.03.11.00.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 03 Jan 2016 11:00:17 -0800 (PST) From: Byongho Lee To: linux-btrfs@vger.kernel.org Cc: Zach Brown Subject: [PATCH 4/6] btrfs-progs: fix endian bugs in chunk rebuilding Date: Mon, 4 Jan 2016 03:59:56 +0900 Message-Id: <1451847598-30666-5-git-send-email-bhlee.kernel@gmail.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1451847598-30666-1-git-send-email-bhlee.kernel@gmail.com> References: <1451847598-30666-1-git-send-email-bhlee.kernel@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 This is a same patch as Zach Brown's but we lost so I resend it based on current code. - 'commit 2cd95f945a61 ("fix endian bugs in chunk rebuilding")' Signed-off-by: Zach Brown Signed-off-by: Byongho Lee --- chunk-recover.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chunk-recover.c b/chunk-recover.c index 85dc1bca031a..b03330b4cda0 100644 --- a/chunk-recover.c +++ b/chunk-recover.c @@ -1159,9 +1159,9 @@ static int __rebuild_chunk_root(struct btrfs_trans_handle *trans, if (min_devid > dev->devid) min_devid = dev->devid; } - disk_key.objectid = BTRFS_DEV_ITEMS_OBJECTID; - disk_key.type = BTRFS_DEV_ITEM_KEY; - disk_key.offset = min_devid; + btrfs_set_disk_key_objectid(&disk_key, BTRFS_DEV_ITEMS_OBJECTID); + btrfs_set_disk_key_type(&disk_key, BTRFS_DEV_ITEM_KEY); + btrfs_set_disk_key_offset(&disk_key, min_devid); cow = btrfs_alloc_free_block(trans, root, root->nodesize, BTRFS_CHUNK_TREE_OBJECTID, @@ -1234,7 +1234,7 @@ static int __insert_chunk_item(struct btrfs_trans_handle *trans, key.offset = chunk_rec->offset; ret = btrfs_insert_item(trans, chunk_root, &key, chunk, - btrfs_chunk_item_size(chunk->num_stripes)); + btrfs_chunk_item_size(chunk_rec->num_stripes)); free(chunk); return ret; }