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+fiKexbZzLqxtMU7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hfXFFcoskkKlxmXtVAGTfgwIhHuFrgL4pjyRguZmZpPVHnjC2i5Ff6858mpHls3lpWbKHfeYRf9NyTnougjsoSJb53knUirlwZfVKNP85puhNZKKYuXYF9190pds8edugTVpfL4NBhbMaT8jberIGxBjlhBdjHTqjsJe9My6s/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;