From patchwork Tue Mar 18 12:02:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Shilong X-Patchwork-Id: 3853251 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 DFE51BF540 for ; Wed, 19 Mar 2014 17:43:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0E1532011B for ; Wed, 19 Mar 2014 17:43:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 385A220176 for ; Wed, 19 Mar 2014 17:43:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754752AbaCRMFJ (ORCPT ); Tue, 18 Mar 2014 08:05:09 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:16503 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751553AbaCRMFB (ORCPT ); Tue, 18 Mar 2014 08:05:01 -0400 X-IronPort-AV: E=Sophos;i="4.97,677,1389715200"; d="scan'208";a="9718672" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 18 Mar 2014 20:01:04 +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 s2IC4u1r001918 for ; Tue, 18 Mar 2014 20:04:57 +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 2014031820020214-704830 ; Tue, 18 Mar 2014 20:02:02 +0800 From: Wang Shilong To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/6] Btrfs-progs: fsck: don't free @seen cache until we finish searching Date: Tue, 18 Mar 2014 20:02:42 +0800 Message-Id: <1395144167-775-1-git-send-email-wangsl.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.0 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:03, Serialize complete at 2014/03/18 20:02:03 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 @seen cache is used to avoid iterating same block more than once, and we can not free them until we have finished searching. Signed-off-by: Wang Shilong --- cmds-check.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index d1cafe1..c0b7f8c 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -3892,12 +3892,6 @@ static int run_next_block(struct btrfs_trans_handle *trans, remove_cache_extent(nodes, cache); free(cache); } - cache = lookup_cache_extent(seen, bytenr, size); - if (cache) { - remove_cache_extent(seen, cache); - free(cache); - } - cache = lookup_cache_extent(extent_cache, bytenr, size); if (cache) { struct extent_record *rec; @@ -5914,6 +5908,7 @@ out: free_device_cache_tree(&dev_cache); free_block_group_tree(&block_group_cache); free_device_extent_tree(&dev_extent_cache); + free_extent_cache_tree(&seen); return ret; }