From patchwork Tue Apr 26 02:49:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 8934441 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 CFD039F441 for ; Tue, 26 Apr 2016 02:50:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0F6182015A for ; Tue, 26 Apr 2016 02:50:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09DBB20155 for ; Tue, 26 Apr 2016 02:50:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751607AbcDZCud (ORCPT ); Mon, 25 Apr 2016 22:50:33 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:34331 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1750843AbcDZCud (ORCPT ); Mon, 25 Apr 2016 22:50:33 -0400 X-IronPort-AV: E=Sophos;i="5.20,367,1444665600"; d="scan'208";a="454936" Received: from unknown (HELO cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 26 Apr 2016 10:50:08 +0800 Received: from adam-work.localdomain (unknown [10.167.226.34]) by cn.fujitsu.com (Postfix) with ESMTP id 16A134056403; Tue, 26 Apr 2016 10:50:05 +0800 (CST) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH] btrfs-progs: fsck: Fix found bytes accounting error Date: Tue, 26 Apr 2016 10:49:49 +0800 Message-Id: <1461638989-5048-1-git-send-email-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.8.0 MIME-Version: 1.0 X-yoursite-MailScanner-ID: 16A134056403.A8EFD X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@cn.fujitsu.com X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the new add_extent_rec_nolookup() function, we add bytes_used to update found bytes accounting. However there is a typo that we used tmpl->nr, which should be rec->nr. This will make us to add 1 for data backref, instead the correct size. Reported-by: Lu Fengqi Signed-off-by: Qu Wenruo --- cmds-check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds-check.c b/cmds-check.c index d59968b..b207f8e 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -4550,7 +4550,7 @@ static int add_extent_rec_nolookup(struct cache_tree *extent_cache, rec->cache.size = tmpl->nr; ret = insert_cache_extent(extent_cache, &rec->cache); BUG_ON(ret); - bytes_used += tmpl->nr; + bytes_used += rec->nr; if (tmpl->metadata) rec->crossing_stripes = check_crossing_stripes(rec->start,