From patchwork Fri Sep 15 09:04:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13386610 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0903EE644A for ; Fri, 15 Sep 2023 08:57:12 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qh4dV-0004bV-9Z; Fri, 15 Sep 2023 08:57:11 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qh4dT-0004bN-65 for linux-f2fs-devel@lists.sourceforge.net; Fri, 15 Sep 2023 08:57:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Vcg/BlOPPLSVDdAueTKxRQ7L+trTouB4xRipa78SnFE=; b=YtOQEJb1/O2gDP556j5AaCPowL Y1KXUiIch/nvnAEYoG6+mPDKTjqMztymaouP/2HNW5GEcEVDufQN3PJgMRskwh8558dez7rVa7YRY b9YNvvIMcgjDByeR9nKppHrdG3zDE/KxnXLw1btnHF1PWQqKdwklYpY7kgW8jtpGEHqE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Vcg/BlOPPLSVDdAueTKxRQ7L+trTouB4xRipa78SnFE=; b=bFRVIbH3bic1dPM22aY4XgvipK /tZLj/BH5INeqn6LU3nK2vhop2gTle7tkODXAymd4phzNHTYewqxiZrHnHj3bAKQTfJRAuNKb2bTW cmdD7mze5snqBONauXoisYFQYvDIiTHdlLeFBOT6XRtJZPttzqi1E/QJOafr1D9J8UEE=; Received: from mail-tyzapc01on2109.outbound.protection.outlook.com ([40.107.117.109] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qh4dQ-0076BY-Pr for linux-f2fs-devel@lists.sourceforge.net; Fri, 15 Sep 2023 08:57:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jkchxKDCNVIU5ImrjFEOK5HZOsu+BeRaT5RyMfNctyh1+oNpRZxxQF9LBHZZYcINsotYdlz5lgl0O2CUMW37FQSeal92rC4ICHQBmd8CMitLJiPnFiYyg7j6GZBieC6+m6+qMljvN0sU2cTzm15QBszo2ByOIk7WD99i4QTz5BL7lXd2HBtkOj960ELnkFcC296i+EB8v77UnzZu1tjFnfhGoXec7sshCTBSXZ6EhAbuCyJ7ciTEkTY2mxS9+7sPPp+BrqnggJ3w69rUlMlwWdfNoSshOUG8DyPaPFfRSR5he15MuWjc7SYWgb8psmuLoLWGQIB70wzvy8wtDfX7Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Vcg/BlOPPLSVDdAueTKxRQ7L+trTouB4xRipa78SnFE=; b=lEoPN+9pYnADlqiXM4T5DOXuzbLbS1xhvEe57yJD+jhOG1xXNTv896R4RbbHsmqtLZqGt+UG3Y6wVEDRF08drK6kYFOYGEl9OlnnGSyNz3oyccQPEJAuUhwsmXyKYSPiiOHhBVuOW0+aoNfc/5hfeFq5jRjDlq3WIFlUNZwhlcDrVBTXdbFj2wJ6Cb+D/AABmgbXKlBnmAjSvLgGCOjLApPn5Ou4UfNLVWXUdRDrKN1rGkn841bbP9DGYic9ld3Izw3ZWZ6U8JkAFbOAz/NIbNOk08MV/m7VcZ/wyC8IjA1lrEYApu+WwWTWA8i2MlIPxNIldBseS5Hr1BNq/BokiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Vcg/BlOPPLSVDdAueTKxRQ7L+trTouB4xRipa78SnFE=; b=ZeRKkKAFZ7zVeObisxjJD4vn0vXtO7Y+sTC0gmfVoU79mtP6LWxT8CNyzyMlIYLPsToQgl5ftGkD4Y8Y2FUoxEPfSk9vYx7dNIsbcQn0DH51L1eQ3bL/3egiMcC6G6XnJNwMjZq1sgY+kM1aC8tUzWP5PL1sPImCj4BdKzJtiHBHR3gEfqZihkVbrfuVexjO06D8U4zy2nbDxYs99oKGmEfFDMWm/vbV7ihFB2CUCnr27pyAhg/XocjlDUgB8aWnHh1AeBpw0GCxwHSR8y+VDPV8BhZhXie1M8XmjeLzEyAnWdJtU3UfadurZr3kgTPui493Fl6HJJ+xGJAU16GbYA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) by TYSPR06MB6693.apcprd06.prod.outlook.com (2603:1096:400:478::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Fri, 15 Sep 2023 08:56:58 +0000 Received: from SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::deb4:b884:ed42:e52e]) by SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::deb4:b884:ed42:e52e%4]) with mapi id 15.20.6792.020; Fri, 15 Sep 2023 08:56:58 +0000 To: Jaegeuk Kim , Chao Yu Date: Fri, 15 Sep 2023 03:04:43 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0037.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::6) To SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SL2PR06MB3017:EE_|TYSPR06MB6693:EE_ X-MS-Office365-Filtering-Correlation-Id: c0747da3-5774-4146-4ead-08dbb5c9b7ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WDep9s4cz8Vnm/hBKJ8k6Em3wpm3xErr1vXUjADDHTHKdE07EjBA3f4JLvrrxobhMzT6OFxL/rW6hghnroDMV0+7ecDMB/ImwFDrW63GB42RrMKj8F2fbmFC8nnpWkatQilZbXS8Kt9ZZF8Wcb3wCrSPJujssyscvsRz+qb4ScdiKt9HmCU9q6SkBvxoC5E8CIAlVjsQxbWcEISvzG9sT+NDsxc60IX9HODiDZbkVsia89dbZN8oQXF4y/GqmGJrN/b9fI9BsK7mM557+OWfT6A54rvgMVGFK8e+BJtZItJt7ztLDY80QpZUWtl//qDlvDtpJW2ezc1MZmSw3EnbceWXV1LAfhXV5h0FUzHiynG2BvhwK4YojxZjAcVSNYnhY/2QXBw/I6sfZirc3PQUOD1fQWXeaJ9SspSrrS+u9vDBmY0spueVdpVUvVh6qXtwCNmu/APCPi3hcOLavDP1KR9DOG7oA+5oKOyUWYk90v7q95JC9roKrgVHlWk94Exv2zLfooy7eGSHrf3M4JUIrwfuzuroxizW+Yv4pNP48Bob/ZtfiXjZXVWx+/faRM9XW7ynQsFWePzDjMU7dbWjRyrQ6YYdIqfWKUd+UB/9vrY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SL2PR06MB3017.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199024)(1800799009)(186009)(86362001)(83380400001)(6512007)(2906002)(2616005)(26005)(107886003)(6666004)(6506007)(6486002)(52116002)(478600001)(38350700002)(54906003)(66556008)(66476007)(66946007)(316002)(36756003)(38100700002)(5660300002)(41300700001)(110136005)(8936002)(4326008)(8676002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ccbJoqBl9HyBZEdg9ETGbxgR14ylGPuRl3b8WDXznABf3HLD90QYi4j44aOiTa9cuNFegvV3exdnEMagsYkikGj5IbQthYarXtvstsuhZkvsYr9VPoEvmoycFVjM1No3dti/14EJsTvLOKC7z0TX3UhamhSXvgwr7fKKMo0GQcIRkY4Jjmrz3fHQS0yf7EimUar+xM4NQkoMMIJJeHUoGDrkknq22j5BbdFbCHnSGIsAx+dthlXCk+TXWiGff1Zm5Go7L+fiKexbZzLqxtMU7LpgJMnXxFyBTD5uID+uFLBjxqHArqWgJCusmFjs27QYEYcnUlHuWB3QKUeeGgLXnQCBze7LKCB55CDigIl1WGG62nV4MPUfz5xF2Cgz1ofrfAYDBqnfCSJp/c27XBPTXgYUTGIMOfALdzIkDXTET6lcPD9M8/rHVVVLEi70xen75BS7mOqkwDbATyltLfp5gH+N0dO1pSOJLDre6KuHcA6fTeJbSf53sBepCNGlCv75CrSsMGOZkZ862vkZiw+R22Imy/slrEUUGs0QNbXkz0h+xSLNuprxyWLrO4SUtWSYbkqNHnWASP7PzMtwpqpJUssedoTHd5eQZ1itzhRlb7cnbw7RnuTewXkd7CG1sAQlvYYtiIdzjr/TkMWNrL92RVYuj71WfFEyirZ/1k2BEedEruNkQqYVJPXsntXcQU+VtuPU3gWbUFlq2+jj5XVBF6k04epwmlyRilB5sBxz1BKT9CSVXb2hX1l3q7dq2bzxTIlWFFcQhsR8w4ZMAC4CmdzyO76Ps4TB0K4jaNvuCqOT584Y9pVM50zZPxTRFE4/JIXsXRyxTQlWexZ2aVBPdpjspRQd55ds3zGEqMaaPt4Ve5u0McRgFimpDQIDGRdxBIM6meDwfcDEG6s0UG+vSXiOUdI77hZ/wcN7gI9UWWrVco5YXZEvoxitIeBInO1WbUVmqYuRtXmTWUhS52uF1o9rF3SI/0v0YYLcnVPoGaVVreGNujyPaj22IUGsz7R95rkhfsuikBJK33+Vr+pPl82qiGg5IXeX2p/8BUZVJBwk8mKW2Z36RRvfOfB9yh8Tt8Vn2Z/SERIt0cr1UBhPBzQZBMDKmhx/OLN7IMdQ7uPuwBUX1Dj30CwzbnnXzy8tbhthXxA5rCJ45zFwK6Y9eZ3VpPjFf7pAfuW3g4qRCBBF4oCo7+GjEmGZDMBuWCQVOMoL/y3qju6g7+SoBWNoLX9HpTkOTon6Q5UCs4NRuskM7cYwaRK3efc5A8gz+XPbjqmyP/iGn6kvvU43uUpdX7bAupquW0b1Sm5Bt938LGoEffRpX4thBq86Gw6pTPqWq+2ZNmre13c7hfXFFcoskkKlxmXtVAGTfgwIhHuFrgL4pjyRguZmZpPVHnjC2i5Ff6858mpHls3lpWbKHfeYRf9NyTnougjsoSJb53knUirlwZfVKNP85puhNZKKYuXYF9190pds8edugTVpfL4NBhbMaT8jberIGxBjlhBdjHTqjsJe9My6s/PGhdbRJGnUYR5STtqjT9mLwER2eK/uerV/fcK/CvyLhXnJkdR9h2hZNLWPulQvc8JqkVfh0PCs X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0747da3-5774-4146-4ead-08dbb5c9b7ba X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3017.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 08:56:58.0578 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +36JMx35Cyonmjiya/ekLUHkRoLJaXvi/uBR+s0uGxOaZOKGDUdCtXyovEEBwjaF9zi46qn+vXDO0jcslB30Rg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB6693 X-Headers-End: 1qh4dQ-0076BY-Pr Subject: [f2fs-dev] [PATCH 1/3] f2fs-tools: use 'IS_CUR_SEGNO()' to check if it is current segment X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Use IS_CUR_SEGNO() here can make code more concise and readable. --- fsck/mount.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/fsck/mount.c b/fsck/mount.c index df0314d..00940b8 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -2531,20 +2531,11 @@ void build_sit_area_bitmap(struct f2fs_sb_info *sbi) memcpy(ptr, se->cur_valid_map, SIT_VBLOCK_MAP_SIZE); ptr += SIT_VBLOCK_MAP_SIZE; - if (se->valid_blocks == 0x0 && is_usable_seg(sbi, segno)) { - if (le32_to_cpu(sbi->ckpt->cur_node_segno[0]) == segno || - le32_to_cpu(sbi->ckpt->cur_data_segno[0]) == segno || - le32_to_cpu(sbi->ckpt->cur_node_segno[1]) == segno || - le32_to_cpu(sbi->ckpt->cur_data_segno[1]) == segno || - le32_to_cpu(sbi->ckpt->cur_node_segno[2]) == segno || - le32_to_cpu(sbi->ckpt->cur_data_segno[2]) == segno) { - continue; - } else { - free_segs++; - } - } else { + if (se->valid_blocks == 0x0 && is_usable_seg(sbi, segno) && + !IS_CUR_SEGNO(sbi, segno)) + free_segs++; + else sum_vblocks += se->valid_blocks; - } } fsck->chk.sit_valid_blocks = sum_vblocks; fsck->chk.sit_free_segs = free_segs; From patchwork Fri Sep 15 09:04:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13386612 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62CB2EE6447 for ; Fri, 15 Sep 2023 08:57:14 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qh4dT-00069R-Kz; Fri, 15 Sep 2023 08:57:12 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qh4dR-00069J-U7 for linux-f2fs-devel@lists.sourceforge.net; Fri, 15 Sep 2023 08:57:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=8UUWe5urIBbJ2HGc1ajKJGq804H0It2/jj4Q7YbkDr8=; b=gLEbSyxsIPjTo8czlOFgawvYqG tXWI04rneQRyySrFwbi2xgyadKYJES178XpCHZcNiap11AKJDnjDVla2ZZhupSEcP0XHzyVxrQLWp JjF5XC8COKuM+Fp2HX9575iTVm+K5bh6KbIk972Ury9R4GYBm0bNP4g6hWYbhw/RfAl4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8UUWe5urIBbJ2HGc1ajKJGq804H0It2/jj4Q7YbkDr8=; b=VkXTvlWjyNbnZhO4whq1LxrD9V UPpRUmmew/R4/Ix58pUo+0CA+uomp/kxbMtUprkuQAquPiL/klXz7s3oaOqBqw6ONO5b8PTyzMh2w Xqttg4BsfO5nCe3ERIvrDLj7eZfo3rlJ6+C7ubP9VGf4szbulmt5Qu8fGKax4btq6UfY=; Received: from mail-tyzapc01on2109.outbound.protection.outlook.com ([40.107.117.109] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qh4dR-0076BY-T4 for linux-f2fs-devel@lists.sourceforge.net; Fri, 15 Sep 2023 08:57:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fsYyvqW6QzV1pV6fsdoqsWJtnJkLoKN1Ja2xbKho2hdcrigKHOzCM7YnoIaCMI+ZL0na6wrUsFiBCajvOqDtYZ4Cm844lAKMK6IrWjMyCeckQkcUIv9Tehpp/0D0G8dZljKNBZ/WzVZGbq16SOSZ3TENpD1Y1eQIc/Y0jdNYQ8flxk9cZTZBUjJIuZsCoaS84OTMJk4CMjPn+XpT6RDSeVHHWe4WSBybcGmBhxKXAw+Vcn9xg3ZxKYMtYyQo3alQpAPJK3GvVNLQslUMxMSl15+jszUXSVHg7yIcqaX9hO7tBUhjqaM4t2WOmt7TUwc6kbvtAlBc8AwRAaOFsGkyuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8UUWe5urIBbJ2HGc1ajKJGq804H0It2/jj4Q7YbkDr8=; b=nLjP4MmdppRauD24Md+j9Y3VpeBiXtPLV3bNoQznm+4g1kPXw6GiG4E52ASz07YuS/PnEN/51naCXBy89fH3jqkfaVfCLlRO20STqPcFrP4yyTzsecvGV2jUagZ0b8sUWPu7UrA7jTLBElNikagS5M3LKgXTQq+0TmWTWEhNKzVG5wfPOP8znlRJDc2jtpo6lST2HWMBw3ljnSNRgq9jKnjaOANERFQMkMu1DVNJtdYsJYT9Ju3WK+W5WAiaRvCX5A4AW1/7WEY0AjPkIWtOJ6h6SXMLNObuYfuFrrIBF1lcSxqjj32E6OUZ0Fs+dUdT/oyCMWCU8EF0Qf5MmeYy5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8UUWe5urIBbJ2HGc1ajKJGq804H0It2/jj4Q7YbkDr8=; b=ayUFBINYB+L8eu3g9L83C+TLB/M06jGuFtPJbznVuNxaXIoRMjkosWl6Px2NGOjYggzI4ySgoSkjcEkarrJzg1L7dnkoOtFxvbEjKdsrY2RsyjmPLjqbU4oulgBzYuZ2m71cv2QGE63AW+bdMHIDXTJTJVvvQTLWgujJjHKxzHGnhVGtAtVrFSkjiJeuFSoW4GhvGH6hS9mqUqE0u9o2cA1CpRPL8sD3JLvMfk2bfC6df+DRynchVGK8Pnu32AD2L9iutFVUH2ZANVlagFF4eec2e7f3HlYEVRX/c+qtT2mulmO04KLDmY+BKe2Z/0i7MTp5ASr2cvYNO3JNijmHuw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) by TYSPR06MB6693.apcprd06.prod.outlook.com (2603:1096:400:478::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Fri, 15 Sep 2023 08:57:02 +0000 Received: from SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::deb4:b884:ed42:e52e]) by SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::deb4:b884:ed42:e52e%4]) with mapi id 15.20.6792.020; Fri, 15 Sep 2023 08:57:02 +0000 To: Jaegeuk Kim , Chao Yu Date: Fri, 15 Sep 2023 03:04:44 -0600 Message-Id: <4ae9a0c9657efa47399953c6d8a5cd28135bc3df.1694768423.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0037.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::6) To SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SL2PR06MB3017:EE_|TYSPR06MB6693:EE_ X-MS-Office365-Filtering-Correlation-Id: 92a259d1-dcd8-4eec-9e8b-08dbb5c9ba1c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pNA7iFdelLDwp7iKnVxo5jxrfEcCIPjNcSPBfxhi7YjWj4JdmRGLOme22zHE06BbXtDH9147XHgGef1REWdNuVXAOKByin8RKbib1+Ido3RYpKtv0+H/ZgDCmhGvAh8KMRcI3TC6WfANnyuIdv0PybrCOsr+x/1/pE3Z3uQb0yA+59QKRJdLSnSv6DZyM6WpNBuuD4xMXTTNt4JMHAWyOiOtd+OcFWQfA1ROeWunUoR7hEe4K2fU+QaiLogtor55ayOSzQoX7A4x554vaEgmWK1mev0I3iJbBnjcEhw7owzm8ALGjAt+pIClCAoDtOGh0drIvIWSUS84H8k3nnxMs61+0Wta4cFzHmcCndAcnnMNJ4FtoWAnrzjv8ajDfwRJ3DyhqRaRrGEE35MIoNEAAVIA32NprYnd5ki1BEWYgCRaZhBaxVKrQ9hCoV4Ca9lR6OjZMR8NRhUipK/SWgFaNFAwegYqhSR8TwZlr2sCzUGTMTc7fSLyge1WJzLXlxmrk87CP3JXuegOAbN+HJVRF4gheNeNrtS+0TYzrLV5q0wlg/uc98fsvlH395zmKU0+AcHckB9e1CviONKLN3m2BGYQxfQFd7iuV81dhKn0hDvgv0feZw1RFNQDXobzX8Zr X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SL2PR06MB3017.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199024)(1800799009)(186009)(86362001)(6512007)(2906002)(2616005)(26005)(107886003)(6666004)(6506007)(6486002)(52116002)(478600001)(38350700002)(54906003)(66556008)(66476007)(66946007)(316002)(36756003)(38100700002)(5660300002)(41300700001)(110136005)(4744005)(8936002)(4326008)(8676002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: o7zLgelP0wD+8m7+V/WlmTB2ivgd/URhli6UvBRnY9HdzWSSjwiGefu0HgxbNQYDEAFhxpZIAOKCpPdYNPq8WJn1SYuhyTcLIharG9lIPI0lcLkJCUSalXJWZ3CyZzStd2Xf7KovPuwIa1kYNxp+Ly0Udc86Bv/ALnzVIN0x0ln8P3UtipLNRhFttlIbACGNzrRwnEbeQPM7Sa095uCzPJM3ATqEWnz60VW56OJhulS+3Bg/4hNNpmJ/nwQBoE8doLzcSRQoqjzLvstVBz5J2VIYntf78eSjPqEPgaimlDEc00R2qBmDKz7sxfyPSGSFC/LJMzr9H2OnGFcYU3XRbK5kwvrWFZOa1obQSwnRcrYqLI6VxNJFhrBgQizUMSwan9GQy3mU148i0/Y0F6gKl01J7l/QDfxhc+cXAjlrWCiAkagTjtjudhnghYlRpKjMlMZItpLpwwug9n6AJmu6QJp78lMPzvxWUlVMUc9DoPSlL9v/KKCd4Yul2xMNkBxXqFyA+2sCMPM4XJBUuFszZUCfMeuRJFUYBUChX00awRWh4SMzz6JmFkU9kQZwKGf0L5VrKGH9gRRkNzC1thFf5VqURNQrPbR+iPuxsccx0s8epf115RTYuDZkl932/KOFYaqhae/ofNpCP4UD+k82fVVOf6772vBo+b49SS9zGqF0KSclT+cHd2FenkL/ij9G0/9y9mt2BrPl6MvHRxd4IG6i9kTWcyBec2g1uzULzPCPKKp5y+ByV/I+9f8bwL+8K2VolBMHPLR49NKLlB9g/zxZHrZdpB3mHkzTwjkmk5HLw7aSlzIw7kK9xmsVFYTaB7ecy7zTC1sCYIuh+oFTV34piEL668M7hED2SQlK8kSRTfW7TAPsGuI67R8rViryrbx6y7jFnfqyF1CbBX2ikSXBGX6pf1o6AY+E14Uc6ap6fA+5YHSpb2N23xVra0rE8oEfRnnSZd0TG9/PzIiib3QTkVRBB7KVhDg5WHzdvXDM5GQs+N5r6rc2T0UBENgwjVQZcBVCMF1kmWxMN3J3LSc+TOGaNE4kTuyOWpgq/KIuJv7MLS5HZKKRExVpJjbYW6xFHiqEq7AdSg+2VQdUx5dV/uKSJd5ZpnKECs27FBSysSEL+yJaVUjjNCUNUWbnw+G+aNH/MswtUTTJUJNt1j39MEvsriDzGnsfAhgtTuBpvfigvFozv33ve5qZpafXEqa50v3TcqN74Mqqmx02rkuDYnAKrj7NVnF9rWxzHUmuNKDI9jwdJtRG21L0GF9Vap2eih0Tt3Xc/OsfC0aW4FhaLUkgDOUbfxnBH19qaMXAksqPPMdvB2nVmP2iv4hUwz9HFjpP+i0D90lGEZzlEf98+JPASmitZQ3lLSS33Por0Q/EbISXJidi9oY9lIZjeB/daBi+OOv8umNtHlXOxIaUCdN8GUugERirxgjB9O5AxPIXeWNOFcUUWd50q5CtkpqfH94KEWgqjoIvZamBc1jllAAzYNgYb7xchzaLMxSuVTdooGLl3Y0DA6Z9X3JNaSimgBA2l69OxuMFWC70wUU0118dzQgr/5FiT1Q2U7/lzDTnnKdmQnxLiQ4LkifJ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92a259d1-dcd8-4eec-9e8b-08dbb5c9ba1c X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3017.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 08:57:02.0936 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kefRdS6t4Ot+6xEb652bAcbGSdu0wOcZZwATqy9ppTZ57log4ZuAqAmzrLIeGDUXcKx40wBnFp6splv2Gr7bJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB6693 X-Headers-End: 1qh4dR-0076BY-T4 Subject: [f2fs-dev] [PATCH 2/3] f2fs-tools: skip not matched segment when finding free block X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net If the segment type is not matched, goto next segment to save time. --- fsck/mount.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fsck/mount.c b/fsck/mount.c index 00940b8..dccaae2 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -2854,6 +2854,8 @@ next_segment: if (type == want_type && !new_sec && !f2fs_test_bit(offset, (const char *)bitmap)) return 0; + if (type != want_type) + goto next_segment; *to = left ? *to - 1: *to + 1; } From patchwork Fri Sep 15 09:04:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13386611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D8B7EE644B for ; Fri, 15 Sep 2023 08:57:13 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qh4dW-0000fc-0W; Fri, 15 Sep 2023 08:57:12 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qh4dU-0000fV-FX for linux-f2fs-devel@lists.sourceforge.net; Fri, 15 Sep 2023 08:57:11 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=55obZ+kvwCHjLjYM2qB+/d5MrTQT4QQR23koeSEhJPE=; b=CBXAvPOxnl0NvZEbixk3r4lATc k2ddAR5jvcMm7MwmCI56CHxuy5zfbYV5xi9RXFfdB8VwxxCOOhZvrxN5PVnoSQ5KHn4zekgV4GXcy Vj0Dat2tVvTa5ylOaSOMGIpLSGAvm9UHBWkCQEI8HxrMlp82woEHy7km5XTVef6+6SMo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=55obZ+kvwCHjLjYM2qB+/d5MrTQT4QQR23koeSEhJPE=; b=BKxaJBGnZhc3m2+NbuwxLmnfst k9w6mKSXIrLNrekUmKJM/HIqOuv9bIVeAbvuVh6X8OA04kKcDStblVtzW0fFYkJJDe1fYQvCBAXIR 4F5T60SgmfstOF3y6UAtJHomKOG1HeqORoxLsDZ60aHSoirINQLscwehvIJ3s5D7EA6Q=; Received: from mail-tyzapc01on2109.outbound.protection.outlook.com ([40.107.117.109] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qh4dS-0076BY-OJ for linux-f2fs-devel@lists.sourceforge.net; Fri, 15 Sep 2023 08:57:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DaZ20t4mQzqSW6P8auerXgofjVbgufBVaQvsYuQQM4nX4oFXjuuL/VT2WlL1pQSXDH2xVPbpzYelJYs2+pUeQbAQq3Ocxh2bvPsZpe2/G5Wf2HjVstjbm6Pz847Uz4vTFjt45gpeoaNJ2RFuyFFRRvYSgsU5pdV4HpEwqEdsSMMg4zjJnEt5t5Zvr8OlEn8w86Z0zXcAQ3Fnc5m5+tXi4+IE8496USZ4G5kBHpHaw8vW6UUlkp9HhhcBhPOUpd6tLoFTy4OSgikK9Z9HXV1pqgmi6yMtJJ4nu+6ypZqKXCGafzx7S4oN3unrPJETM8GpVqBUdGwZxvAL9Tg285FiTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=55obZ+kvwCHjLjYM2qB+/d5MrTQT4QQR23koeSEhJPE=; b=mjVfdtL49zJJ+qcaKXbApJ+yieQs4n3ozuA4EDMmOfvCi6s9rW0Bg67cV/f6vgw4eIrUXv6GSFWJjfTHooXbRadqEDPa74Idr37TNF2+IyrbRBBCMAmdHOcELsVZEC6++nr0OUfEGC/nVRdOo7vvikDZD6zXNN70Vhtd1gP0OnOBqnRs7uKGCbPQF2mOr3cB+tFhX9qgkKj4fP1llwHtSL4nkPPRG26CqXS3oy8FM8qZsPHcJKUi5xaxnEnPxK2tEgUoAAYA9MZUHSLI5MFDCQyyOGvZihd+lzDrwj1YOV2fbztTm/nhqlyyLEUneecxEcgBEr3CCH8PQqSByD2lGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=55obZ+kvwCHjLjYM2qB+/d5MrTQT4QQR23koeSEhJPE=; b=CukVebCn+y2op6HzC8iP1nqME/tUvdjnCxwyBGyhpbH4gz6DxgIyyMygNLUxzGzlUgh8xOc8wUCrdXsoKmPJnAgZgto3vyqfg5p4ulJ9ayJYL2m22kknPRDtx8hQU0L8A3ZrZmiw6hUvK5vFosHJg7mvo3HvXfkEBbE53N3ylfUAkqHHwSrr4xA7dkGv0TV8BOn4/D68d071g7cCzK+Yj7hggOQLkA2VD3AUh1QO3CBB4iWVwuXPseVB6fDxAeZf8Eb7ta5AQLWwuYMnUzRvcaXHeEqj/o/apZjtq7TaMb9JDhAZwDh4HqoFEvOw3tYCwp4NL7GdrubIM8JwQI6OAw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) by TYSPR06MB6693.apcprd06.prod.outlook.com (2603:1096:400:478::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Fri, 15 Sep 2023 08:57:05 +0000 Received: from SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::deb4:b884:ed42:e52e]) by SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::deb4:b884:ed42:e52e%4]) with mapi id 15.20.6792.020; Fri, 15 Sep 2023 08:57:05 +0000 To: Jaegeuk Kim , Chao Yu Date: Fri, 15 Sep 2023 03:04:45 -0600 Message-Id: <3d8d905f27aafb2a8f376eda423b406720cea310.1694768423.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG2P153CA0037.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::6) To SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SL2PR06MB3017:EE_|TYSPR06MB6693:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b1321f8-1b5b-4f8e-d113-08dbb5c9bbdc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5Kc6B+aFtH1mvHp+Jmoft1V3T7Kk4vFFpkVmKEQseKiNJ+at3qr8UncZfWNOpo+ljjYhV1ESO7Tj8RYykcw9DMNHCh8j5f+UnVfKLj0co7jYXAAlQGA+FCFJQiIKR9peofisynNnevdyiKj0gOiRLPU36ITR3TNLN5/6yIDGgefxt6C9aTVmJjk5N1u3HmzT51p2p2watu92WOfcgUEGWPe5ZFYis8ZyNT6LnwhYMNp8AKN8gQ22fUyF77OTGnJ8t0dlwrNhUMmkrWyN6q0GX0QdGpM+quouZwhxKC4yUbhlRWYrmwS8JCub2IkLMGagy57A4U3gbS0DXtC1ZOnRAyWHDIuXvNmfAO5kpGpLYzKXL7NncPM9Xgv/7h4yCnq+RnheiESdfR6jXKe5ENvZ5tl0WIDHpyxsyV/HTSo5GXCGIhzzXfn2uJq+q7hi9s3hs2qe5d70IrJiksoZ3v/vgDFRvQXh3ylj9xvDgq9RPh6LCj0UGURBO8XaMoXHGiXk1nlkRS/LEpLznnPG53I5Vk/klLvvuAzBfnzTNWmySpBeGVhSB/+Qc8Q9SH8LsR1yIWcW4m5/5fI3Ri7Tppu6l0q+8cXCZi530sEPU3fkplqzG6m1SjIkkAgROSmDi0vA X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SL2PR06MB3017.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199024)(1800799009)(186009)(86362001)(83380400001)(6512007)(2906002)(2616005)(26005)(107886003)(6666004)(6506007)(6486002)(52116002)(478600001)(38350700002)(54906003)(66556008)(66476007)(66946007)(316002)(36756003)(38100700002)(5660300002)(41300700001)(110136005)(8936002)(4326008)(8676002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WKJch64WlVynJWy1EKOwMnYxu+OYdDrI/npGBSosqEC5wH88Kg8j9xId4Q+GRlJC8Rl+16x6aXQR0Eakiwe4XZmDjbasuCRVMitsclHQwjTIXtJ9jGxbjI2rzzqICTHQ1mIR5qBciYz/RPfyqT82ma8jYjrlIKO4TIrOodiVypsv7zK0Pd75ByWza16zRKu3K6CqAy8aZ1jz65JuSvwN6MvPZ2sF8wvr6OAkPdw8E/8vl2/tqy2xj5BxxkE9TX5ue48+GI/4WS6Dy6qJ8X9iVlHCjlytKXEJifIGQIka5tbyLJAqd7RHwLyWAVe1OONvKia05oS1tXn7uM8M1SMQrc3/2VTbRKlR+qzK4sT0NwOCXniyHPPsgpYWX76yp+MmWRAYx9XKeSHB5DSeZ+scO6N8ZaPKbY+2/t1OBTfOCh90/O8Nm9/toSjCdbFaSSC7JcohNYVCTfv0EDA112WtDqhaAIBPIrmIErU+dhxRnclv9GLOLWmWQG2hFilSYo8Y9pJhXIPhBcTm734CBvYXFCmmcPgUof/xOP9tRZrklFwPtTDQ0OgW5+/MKw2ww3fSjjICCe8+TifDX7c6SAyao87CM8ktt0v1QGdoQm0Byo/VmsA5vg6NK4p/8WcbQpGkPTi1DRxQP0Xlz5g9LI6obIZibJh0pi4XIoSWh+kYLA0iFRArl3vWcviZG1HWAczWhAxUm6hAMdBakoKMabJxunv55XnzfdRfi6gL/q92b3p2wF9j0Quophhd7WTF8fU55yqI4bNPiZcNIZQ7fMGF+HoLV9B8bBb3jaYTYLtLYwcYWYaBtudYKHYf0GO9cMlEPHTQIuabbqyTb8o4hmIkA2CwiZ9fVrs7Pl0okceanlM+lNJPc76yy1JI0uBpWnDJ/Xt3NMPGXdy6xjkdGgXBRqxxxvtqnBmkOvlfq/ycs2SIXC45i8VAn9KOBdLG4y91Mrm/MXgjyrxlmNaEasUYDoAFMyin2WRFwm+t2yhXH+Iuc/I+6tyC5tQj8SR9MDGbhmMow03hi0DQESibggI7xnTlChu+V+8EH+egsD7OYSqzyub17bdTc/+xXAQ6ixH5VMV3+GCpXRzHiUEaSH2GIBAuh7CKO/dATVFdRDTlEgmbh1QnBz/a825cX4F1kKqAWLrIiKqC2Ud9mec4JOYKUZb+b89rpB7lsNvEWKHXkuFfMBVw49k/GY8FjGksE1fpt+cOs16b1VR5JedvlL1IeTs7eaKgAwTnLEJlVyALjGzUbm+wVcy1Zp2GtjJrQ6U0rnkt1XeIScRxg77Uon5j5GRnTOr7dbGSwmncxE8Dhj9fnyfiIJtCA48A0Cme1zeyiH5w8JukDFkdTBWolMEW+L+VWWSLSddN9Zc5PjbaWBv2XOLA6UJAHL8zqHIKzzYQYmhM0ySMFHJKICHrFUojhQ3tXKIRuM1kxG/sAzso5eR71lqR/JUmC/dtG32Zx5q4iUUodBtwW2uomPBcIfshFMhDIn/F0X72Z91NyiCdj4u94v4fryZ786xnxsGrdKVc03qIiSIGniKWQ49jUUs3L2GOlIe6oV3likZ+c3WH320JDCvtGkHP1vVhlYv/3Fql X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b1321f8-1b5b-4f8e-d113-08dbb5c9bbdc X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3017.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 08:57:05.0032 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Q13QSXcG8dsQffS1qOUGgVc1skds0lLihUAcowqTaVdVMYZjwoKtBJar/PrHZDeld9PBSeCbqYzEiCq8MAkVEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYSPR06MB6693 X-Headers-End: 1qh4dS-0076BY-OJ Subject: [f2fs-dev] [PATCH 3/3] f2fs-tools: cache free segments count to improve perfmance X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 'get_free_segments()' is implemented by traversing all segments to calculate the total free segments. It cosume much time. Every time when call 'find_next_free_block()' this calculation will do it again. So if we cache the free segments count, it will greatly improve performance of dfrag & resize & sload. --- fsck/f2fs.h | 1 + fsck/mount.c | 9 +++++++-- fsck/segment.c | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fsck/f2fs.h b/fsck/f2fs.h index e65644e..a7cdc4c 100644 --- a/fsck/f2fs.h +++ b/fsck/f2fs.h @@ -197,6 +197,7 @@ struct f2fs_sm_info { unsigned int main_segments; unsigned int reserved_segments; unsigned int ovp_segments; + unsigned int free_segments; }; struct f2fs_dentry_ptr { diff --git a/fsck/mount.c b/fsck/mount.c index dccaae2..b965c5d 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -123,7 +123,7 @@ void update_free_segments(struct f2fs_sb_info *sbi) if (c.dbg_lv) return; - MSG(0, "\r [ %c ] Free segments: 0x%x", progress[i % 5], get_free_segments(sbi)); + MSG(0, "\r [ %c ] Free segments: 0x%x", progress[i % 5], SM_I(sbi)->free_segments); fflush(stdout); i++; } @@ -2430,6 +2430,10 @@ static int build_sit_entries(struct f2fs_sb_info *sbi) check_block_count(sbi, segno, &sit); seg_info_from_raw_sit(sbi, se, &sit); + if (se->valid_blocks == 0x0 && + is_usable_seg(sbi, segno) && + !IS_CUR_SEGNO(sbi, segno)) + SM_I(sbi)->free_segments++; } start_blk += readed; } while (start_blk < sit_blk_cnt); @@ -2485,6 +2489,7 @@ static int early_build_segment_manager(struct f2fs_sb_info *sbi) sm_info->ovp_segments = get_cp(overprov_segment_count); sm_info->main_segments = get_sb(segment_count_main); sm_info->ssa_blkaddr = get_sb(ssa_blkaddr); + sm_info->free_segments = 0; if (build_sit_info(sbi) || build_curseg(sbi)) { free(sm_info); @@ -2805,7 +2810,7 @@ int find_next_free_block(struct f2fs_sb_info *sbi, u64 *to, int left, if (*to > 0) *to -= left; - if (get_free_segments(sbi) <= SM_I(sbi)->reserved_segments + 1) + if (SM_I(sbi)->free_segments <= SM_I(sbi)->reserved_segments + 1) not_enough = 1; while (*to >= SM_I(sbi)->main_blkaddr && *to < end_blkaddr) { diff --git a/fsck/segment.c b/fsck/segment.c index 0307bdd..1cb7d02 100644 --- a/fsck/segment.c +++ b/fsck/segment.c @@ -77,6 +77,8 @@ int reserve_new_block(struct f2fs_sb_info *sbi, block_t *to, se = get_seg_entry(sbi, GET_SEGNO(sbi, blkaddr)); offset = OFFSET_IN_SEG(sbi, blkaddr); se->type = type; + if (se->valid_blocks == 0) + SM_I(sbi)->free_segments--; se->valid_blocks++; f2fs_set_bit(offset, (char *)se->cur_valid_map); if (need_fsync_data_record(sbi)) {