From patchwork Wed Nov 27 14:43:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 3248491 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DE2DDC045B for ; Wed, 27 Nov 2013 14:44:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BE4AD205BA for ; Wed, 27 Nov 2013 14:44:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2B79205B3 for ; Wed, 27 Nov 2013 14:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753614Ab3K0OoG (ORCPT ); Wed, 27 Nov 2013 09:44:06 -0500 Received: from mail-pb0-f52.google.com ([209.85.160.52]:44330 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751810Ab3K0OoE (ORCPT ); Wed, 27 Nov 2013 09:44:04 -0500 Received: by mail-pb0-f52.google.com with SMTP id uo5so10528902pbc.11 for ; Wed, 27 Nov 2013 06:44:03 -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; bh=M1peKq473wbJTq3inabIXExg2Yk7FEMg2qDAqdoiJ4o=; b=HqKWEgZie9i03Dez2Rc5KVyFgULEHMRhcXHobLalZgmMsAlRSGGbio4TIgJsjecj2Z icJ+H8gQ8Ud5rcAMkP53OGV6WVuZh84h9PMx1jlxUfoN1qdz6m4/uqCnQbPFy4nkd5On iBgUxzkN6moDU6Tcl37wNrIwS4gACpSODAFlChLNk+A2UjvwEotvnbdHjP+PFFCjRBRP B7G1RKlsZCdnGHj3LEJ1i9mkQ2onG+YQ9VAB61AFRpbYNcKsZn+wous9Dsaj0qlyheTM 75DaYHXnGhxoKcFA9Oct7Vx6+lFX+eRNKvL+oP3SgIzOXlAiQv0Wrt+ryHZI3PMU+P9H CsEA== X-Received: by 10.66.27.177 with SMTP id u17mr42201185pag.25.1385563443193; Wed, 27 Nov 2013 06:44:03 -0800 (PST) Received: from linux-b0ol.localdomain ([223.65.189.174]) by mx.google.com with ESMTPSA id gg10sm88430688pbc.46.2013.11.27.06.44.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Nov 2013 06:44:02 -0800 (PST) From: Wang Shilong To: linux-btrfs@vger.kernel.org Cc: guihc.fnst@cn.fujitsu.com Subject: [PATCH] Btrfs-progs: chunk-recover: use right size when allocating chunk root node Date: Wed, 27 Nov 2013 22:43:56 +0800 Message-Id: <1385563436-2598-1-git-send-email-wangshilong1991@gmail.com> X-Mailer: git-send-email 1.8.4 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 From: Wang Shilong When allocating chunk root node, we should use nodesize rather than sectorsize, this will casue regression when making other nodesize choice.(for example 16k size now) Reported-by: Gui Hecheng Signed-off-by: Wang Shilong --- chunk-recover.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chunk-recover.c b/chunk-recover.c index bcde39e..ef96921 100644 --- a/chunk-recover.c +++ b/chunk-recover.c @@ -1034,7 +1034,7 @@ static int __rebuild_chunk_root(struct btrfs_trans_handle *trans, disk_key.type = BTRFS_DEV_ITEM_KEY; disk_key.offset = min_devid; - cow = btrfs_alloc_free_block(trans, root, root->sectorsize, + cow = btrfs_alloc_free_block(trans, root, root->nodesize, BTRFS_CHUNK_TREE_OBJECTID, &disk_key, 0, 0, 0); btrfs_set_header_bytenr(cow, cow->start);