From patchwork Tue Mar 18 12:02:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 3853231 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 ED938BF540 for ; Wed, 19 Mar 2014 17:43:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9AF4220131 for ; Wed, 19 Mar 2014 17:43:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D4942017B for ; Wed, 19 Mar 2014 17:43:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754731AbaCRMFH (ORCPT ); Tue, 18 Mar 2014 08:05:07 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:38683 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754705AbaCRMFF (ORCPT ); Tue, 18 Mar 2014 08:05:05 -0400 X-IronPort-AV: E=Sophos;i="4.97,677,1389715200"; d="scan'208";a="9718675" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 18 Mar 2014 20:01:06 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s2IC4u1s001918 for ; Tue, 18 Mar 2014 20:04:58 +0800 Received: from wangs.fnst.cn.fujitsu.com ([10.167.226.104]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2014031820020281-704834 ; Tue, 18 Mar 2014 20:02:02 +0800 From: Wang Shilong To: linux-btrfs@vger.kernel.org Subject: [PATCH 5/6] Btrfs-progs: fsck: reduce memory usage of extent record struct Date: Tue, 18 Mar 2014 20:02:46 +0800 Message-Id: <1395144167-775-5-git-send-email-wangsl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1395144167-775-1-git-send-email-wangsl.fnst@cn.fujitsu.com> References: <1395144167-775-1-git-send-email-wangsl.fnst@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/03/18 20:02:02, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2014/03/18 20:02:04, Serialize complete at 2014/03/18 20:02:04 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Two changes: 1.use bit filed for @found_rec 2.u32 is enough to calculate duplicate extent number. Signed-off-by: Wang Shilong --- cmds-check.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index e1238d7..34f8fa6 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -92,7 +92,6 @@ struct extent_record { struct list_head list; struct cache_extent cache; struct btrfs_disk_key parent_key; - unsigned int found_rec; u64 start; u64 max_size; u64 nr; @@ -101,8 +100,9 @@ struct extent_record { u64 generation; u64 parent_generation; u64 info_objectid; - u64 num_duplicates; + u32 num_duplicates; u8 info_level; + unsigned int found_rec:1; unsigned int content_checked:1; unsigned int owner_ref_checked:1; unsigned int is_root:1; @@ -2742,7 +2742,10 @@ static int add_extent_rec(struct cache_tree *extent_cache, rec->start = start; rec->max_size = max_size; rec->nr = max(nr, max_size); - rec->found_rec = extent_rec; + if (extent_rec) + rec->found_rec = 1; + else + rec->found_rec = 0; rec->content_checked = 0; rec->owner_ref_checked = 0; rec->num_duplicates = 0;