From patchwork Thu Sep 28 09:20:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13402353 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 B316ECE7B0C for ; Thu, 28 Sep 2023 09:13:22 +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 1qln5H-0004Mx-6A; Thu, 28 Sep 2023 09:13:22 +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 1qln5F-0004Mq-UG for linux-f2fs-devel@lists.sourceforge.net; Thu, 28 Sep 2023 09:13:20 +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=VkCKC+ejYqKujK2oiuM5L2KSfEEyNbPXjYQaj3eBtws=; b=HE/dyR0vI/Xqy30AHP1wjf+hUv O2SCzY2bgwDTo5zgmYodQ1diV0hU3deQPK8sROyWxAg/hAlGn2ahJUk3wVa+gpBimntxdHEunWJju 03CYhbUX+Hs3WepZCkY/jCplGmFUqtPIAAAf9pW1tkfNGLX3j7dOlbw+6Ivsrq1ePaz8=; 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=VkCKC+ejYqKujK2oiuM5L2KSfEEyNbPXjYQaj3eBtws=; b=jbO47tCsVPJTFCfhGcRlzIKprf rVPA6pEjLpHqmVWn7T2KaYgnh1UPU/wjM34uitIAoKiGeLKQayXrHL1GWZYc+/o01rPR1Q0tyU6eU uRbEr+mVIZfEA0XxuNn2FpecRAsOA/M14bxaxrdAEycWX/lgUQFNU9Mj1ryaIS8/ik2g=; Received: from mail-tyzapc01on2110.outbound.protection.outlook.com ([40.107.117.110] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qln5C-0004yN-C6 for linux-f2fs-devel@lists.sourceforge.net; Thu, 28 Sep 2023 09:13:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dnqFbD32Akw8LIHxjeO2yeloxGbCVL9syJOxy42HWVqF9P/CHI0VhsSEG4X3/0MAiyq8Is4H5FMwp541kVzozF+9s53CfFHrAHq0mT7SQKbp8Xli3d4z+Pu2HVYSEQsBRsRsH0R22H5n3XHEAM/27MHVt+xL+jAITpMq92XOv8azJFBOnl12lV+ZIb64lkuO9m8U77/c+9Gg6S2GX1eDM7JFWrTFWLw+2ihDjfDkIgYlh6G5w1JssCNzVa+Hai6l1JLxPrVbe9emmEkrEl+Dv1CngQM53ImenNlNqcI+VF2u4AXE1wKhStfGVojByet7Hpoz2uMwBS9W9ZkeN974HQ== 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=VkCKC+ejYqKujK2oiuM5L2KSfEEyNbPXjYQaj3eBtws=; b=mkaHWRO/9Ml7LAx8u9o1mhpPgJ2hKgiHk/vT1h9Og/dxfeXuRmyMkLKSm5r3dV524EDdnHP0Skoy3QCGFm0Pq/UfPvcNIRD+DC306/IXXDTc0mJfSZxEIWktRfsQg3kB3Lpg+v5HCmCzrG4y6QUVdllKAJXJhXGhrzfTdS2qpjDbnl/r4PZKylWhUG1Y84uqAUflyxiEq/DBw8Jy9vBbpfcKFRoNvSic3Dhl5oQeKwTljVL+nF7B20Klbme6R7GiEG62CkahHmv1YsHhH7YTZjZWFWILQsJyMRYPpKpMhnY/BZrZXkZ4RqG8aiHP6Tct0T4QuKZ9PpPhUTqR6moshQ== 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=VkCKC+ejYqKujK2oiuM5L2KSfEEyNbPXjYQaj3eBtws=; b=pu/Bja+Byi4IbRoq88Z4c0HrMagHNtfEIKTIaTreF8TUiV89qrXVCjMlIC4jFG9JSlt7nglZrPyUgIncas3cgsLjesLa7WawiD7wRxjmajyZOFmhKZUxQa5IO+zTtV6H+PIoNSIkM0RFx9v2G29oOt2WtEMWpr5NGr7B9aWKzJt0UhDnTTG799e6SS5XgzEiBWDXaskKHMT75WeNDLkOy/6aCQhqgWcfaHyyFY1jSIungwlT4wCizi5Fv2DXzgElXT+sipsFKSae/y+CjWiCHjThi8/HS+PKmVNwfMTjWJco9F30CiDUsU5M33U+toM3++kjujqGFZrqgDzML0Dp1w== 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 PSAPR06MB4470.apcprd06.prod.outlook.com (2603:1096:301:86::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Thu, 28 Sep 2023 09:13:14 +0000 Received: from SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::e1e6:c2aa:6b5b:bc1c]) by SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::e1e6:c2aa:6b5b:bc1c%6]) with mapi id 15.20.6813.027; Thu, 28 Sep 2023 09:13:14 +0000 To: Jaegeuk Kim , Chao Yu Date: Thu, 28 Sep 2023 03:20:49 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG3P274CA0020.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::32) To SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SL2PR06MB3017:EE_|PSAPR06MB4470:EE_ X-MS-Office365-Filtering-Correlation-Id: 878027eb-88df-493f-21ad-08dbc003252b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: In5XNHOT4hs9aB2IEXcRa8G3d5Bd2yhOOGdVN3h6vI3nrAKq2KWl7XjpVEGJy1UpsREdXsbll8f+iOiHihB7ARSbmqqtOPll3yv52CB7xovqCDzeiFDdc9eM73KakcUzXUoN8UYdaOS7E391U8AjCX1XY9/vNZcGSJYGuZmS2rjQLRuxGmlDCFAHtaMXr+F1HT9gP3r0BvWDtXzkDBwgP59pOhGBD0JQf5Axro6UUVTY/AkoSuX8INmIFU1UxTHePtWEjUnGQVT6LEb42P0jodfmVs+x10/R3jkJmL038haLcKUUgYHMiHITYluFX9klEAD572kNA7GuK/4/6fZxxAva832romRe6oa4hEGMh46hdppw90b4+N9/i2AXhEKlE/D0GRkTljZJKnqyfdKKkmJq9p2zPCTvM6hfmjpSGDYBZG1knipQWwT44fuhQZ84paJ5bo1dpr7V3J3UIoVBLxkW0u3CTUbx1me6oThjXsVJe2NtB5CxkvMDGQZJQJkCRvi6dBNlr2u44Y2g8A0iYM65EFxivqr+dfeplZR9JkIc+KFWrXBajHfyjNjWSoKapB4uSNYPG4PRw2JRnAJstGliAAHC7eaBcXP4OfL54R0= 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)(39850400004)(346002)(396003)(376002)(136003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(41300700001)(316002)(4744005)(83380400001)(8676002)(36756003)(8936002)(66946007)(2616005)(4326008)(5660300002)(52116002)(6486002)(110136005)(6512007)(86362001)(6506007)(66556008)(54906003)(6666004)(66476007)(107886003)(26005)(38100700002)(38350700002)(2906002)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Lbhm9NXGmf3COj7UjL9wfbULG93JJIFqLyYmg9jyDRHUSIqEJv2zSvYO93EWXe5pr9uVr5pHBN0kw3B9NEN0GHA0ujIcrHNxUS16N7nqJZ/hn3M8PAnjXhXpD6oBUbPpJ+mJuCk3IK91oc/+026HOXmaywGmTn671kLmz3qW2J6LhxrQgQY2DM+u0HvQOPHhfUKXwStwLtst7mQyF90sz3Aihhq8LgceQ01tXxBqa1x7STf79rZr91EWpp+9E16VlZ5kCFh05nxDafDvX4/Bcayt8QSR5ojiqKWeG7m1MC6r6UF+y/4eP5g2nKDf0kMsLi5AgRjWpl9RXX/NfZuc2J+WE85Id2DC47hDseeXNJuuwgbJMiHUzijZwfYWvgeg5T+vnJ+nEpyB55PXkUbfW2TVth6Fd9NscOxSHPpl4F3uxkM3UQ9FTOXtzxUA5NCrtYY5hQkazyls1m7yyl/UMC6XLuGE1L0qZRYOXL2KlqIFdTR09uU+o4RPiegClAwpRdZtGcyTVYexfT3bWtNU3iBzZhyweMB2I7GkgeUNBYDRQQwnd1lK7tJRBm5eMX+MgHhtJAGtx9Zsa42c6Ik9xdNy5T+J9f+z0oEgDAJD9ZfSadnf+CVG9AkneuUMFpdymwLbN7tMSLAitmh6/D9ZKJb4b87JRP7wlx+hio8eKI75R7QzXLv4MIDXhEmynrcRBeD4JIBWC4nJIZ4trQE2gNdBVzJhlVsZmQjjeBaKVWOHQbRJ9R6QcC0WUBVMwT2CJexjEKRe3/FOJd7UbxhJyOjGTDbVigYgSC27zmh/Ci9Kvgr/Om6aQMZPi5816cqy97IlGemVca+nkEjeUIRjcN3e8aLvBPib3E0wiOCtkHGeelYFM9iNZlVRQ5fhmI1RSOE2XxhA3YalZHqAI1HYv52zcSNi2IBXYfRaY1WAVpveJzKT47r+dPHEga44hpYc6K4zrIXjG1mDNueiR8KecUE5kH4RAMlQ6Y/lH70Pc8FNWo2ilEnzz2N0saszCSxYQ2W0neC8YMQxCsa08G8aG7b+UJsqOda25XkyX3k9l+SSifPIpPkWYAj00/JSNx+OZB3lMmGw0Kf8mQ0wICQCeSIEizoYdPnQk1i72caLReNN4Pmo+sWwE98Ve55dkMMSktbObuyMsHCzCuWjAw1nXdeMlhNB/Abvsnm1bnpUMkpJ89bl3c9DgvzBYN/F/e3PlMtkgTKrXsCXABLqsDYnscWG8b/iqLsrlJcx7PvIinroT0S4c9stCyH/219Qz33COzJQnZ5hEqiK63xYD3HqXJBO41CpE3pJB+amcWM0eEuqpxF0G0JedN4OIT9MrVx+FYQVeef0PYXUWAeb5tby3ImHDHZo47jGhLF0UEBCSkzrW5HWhxrS74hojh3h64EMPju862TBOC+KHTiyOMpRqRh3drO5vE1izY8OSicNWRRF5ZnxhBOxBy+gpYs3q13pNhxlkZaYWVUVVKhpQLsc3JumwA9BnaKY4DJrGm6KrmFOPWbbg49u1hN3h96D1VUnBadNlp1PXKt8NJVC+UNAtevvLWAFZMNYiJ4F5HHbBZRYpv8xWOxf4nbu4UYMTfQ+ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 878027eb-88df-493f-21ad-08dbc003252b X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3017.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2023 09:13:14.6636 (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: lfjFy1i+xCef9pxvJx/U22F7DnMQ3xNau3xtTQnaSN0uHG/q10JoYczJziOFbqXorNm1ISjHt7nrD8hgOWk8hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR06MB4470 X-Headers-End: 1qln5C-0004yN-C6 Subject: [f2fs-dev] [PATCH v2 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 | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/fsck/mount.c b/fsck/mount.c index df0314d..e4372cf 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -2532,16 +2532,8 @@ void build_sit_area_bitmap(struct f2fs_sb_info *sbi) 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 { + if (!IS_CUR_SEGNO(sbi, segno)) free_segs++; - } } else { sum_vblocks += se->valid_blocks; } From patchwork Thu Sep 28 09:20:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13402354 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 23B26CE7B0E for ; Thu, 28 Sep 2023 09:13:29 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qln5K-0006JY-CR; Thu, 28 Sep 2023 09:13:26 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qln5G-0006JJ-FC for linux-f2fs-devel@lists.sourceforge.net; Thu, 28 Sep 2023 09:13:22 +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=qWoJu4PSEp567e/EuMA/5swa5Pr0+sbKXkJpGDnC5eA=; b=MjO9hJLf1EyKf+XZ4ifJQCj++N bQYLzoxX/D/4Rz+QcLCKwk2qv8Jy9D/KYYOEIjn42m8tVS6sLaIBdMJQzHi7AxhhFsUR9zq/Ty71r tp5tI52iP8mbKwcQ6XLKWObcDrc/TJfyy+jCicBYaVbL8Qhi1NFguZ7LUMHchS/sbcnk=; 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=qWoJu4PSEp567e/EuMA/5swa5Pr0+sbKXkJpGDnC5eA=; b=UC6X5kKExTHjs4vZwkQCGpLHM3 W/G68Kx2YNvnaXdEAtBxSCCAHPH43vAYjCTw0LA8cm0Zl2cMfE9ND5bsfDPi8niu+y41uo/kVvzZI UB1lIIdJkl5moWs5opMGeUzB77kUD7YI0XvXIdyo8FvNnO9C+Tb0zvKYzoYvSoypx3n0=; Received: from mail-tyzapc01on2110.outbound.protection.outlook.com ([40.107.117.110] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qln5E-0004yN-RT for linux-f2fs-devel@lists.sourceforge.net; Thu, 28 Sep 2023 09:13:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NwirVr+Pf7XWxxuWBG7oqjrnFQbF281jg+V3yNw/vZ6lcRbJVj8sOFy4FIDMwhpVjTGpBOxhaWr1llLhvaZuljxdiyNVNSDhEkKg3FSRfSjMLsB8jhPQV6qscDx1ZaoLPeIiqnA2QKBdfqB2nig7PN8Xc86MF5kqPkQmoSl0BcxrC63apQBJbafuoQAqxniEudpLU0SJhcmlublGw0vqGQVT9mA45eQouxKkGmebNUo71Gn270veRKAdkl0AjsjXfe7jZMTPxbdTKiOGntBmqBtN6hUKvzjL9oX7HliqX6Vj4yQMtya0ferWZK1jV+8iC7bT1g/uDDZIyO1V2FxqTQ== 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=qWoJu4PSEp567e/EuMA/5swa5Pr0+sbKXkJpGDnC5eA=; b=On+HvQLeHn2c1ShaNHOlLIDv/xCz6CR95aGHj+FJeAdGvi0RUOzpqNwdpPrwnrkpNquNJvo3eknx7H2QHBpq8QaKMaL0GiZfjq/2JR8LuDdeZ9Kh6xeWATiGW6bHxc8M2WXP/mqJXQHvhENzi8e+vFGh++c591CJV3r64n1sa/RssTCdVUSAFMo7sGE5wU95L1tfcvrbKEc33rLeEAA5LkfKzKgZDTg102rLsfJIFV5CcG9KNHaBkrsGCEjvwTuoEEB63NXt/036UWpfoY9PkJn7HsFT7Hu/5beKFi+R5r1gyEHkV++dBHttLZZCbTkfRfnVAfrIuEB7Khje4LK9JA== 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=qWoJu4PSEp567e/EuMA/5swa5Pr0+sbKXkJpGDnC5eA=; b=PyOnjX7XkBDRAeh+L21YRGAG92mTIDZo6YeaqHh7xh9XipW6MR45oSQJxv6JJaegq37w4SdLBExttjjJx6Bn1zdK09H1sPfKsN+JnhHTr3tEudNl/m8xE8S+YjXbXQtEvp1dShg4EtoL+fKMrBUljdUpOzILrCm0cnSFkDOljc6eShI3BhLf+ZwTYPpSUbYDtc2eqOBQi3bWKtNtr4vnfe+jiol3EdzHNuLswwA+ySLXtmmlViN4bPju4N2MXDsqfCqRP6YJtEl5JG6aJyAoRo7Wc1OupEPO9J5pcd+RyVMelAxnsr6l9EdGDMdve6hXC4wT7BEC++0d/Xd26cxysw== 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 PSAPR06MB4470.apcprd06.prod.outlook.com (2603:1096:301:86::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Thu, 28 Sep 2023 09:13:17 +0000 Received: from SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::e1e6:c2aa:6b5b:bc1c]) by SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::e1e6:c2aa:6b5b:bc1c%6]) with mapi id 15.20.6813.027; Thu, 28 Sep 2023 09:13:17 +0000 To: Jaegeuk Kim , Chao Yu Date: Thu, 28 Sep 2023 03:20:50 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG3P274CA0020.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::32) To SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SL2PR06MB3017:EE_|PSAPR06MB4470:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e94b392-2a00-4a12-564b-08dbc00326cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mUrwDAisnuspFwO1TQYUusi2/3SQ3a/7BOwWDUWvRWAQl/DP9NPR/gHCLRlUjab9fOXmcDTII/SSh0wzg7DNXWRkkmnz1ruVBSp8yqi4hTqt2idVQgKdeA1B2iO4iZaiQBcPDM/dmXbvI3vegCJuS8Z1JnNYQn2TwQkxXK9wdp2I+uJPNW2wFQEduBYlJrFkCKYy3jdWh3C7fLnRcZVVyogdnqWvOOBimE1qCbdDE/SN6RvqmYCtWp/00NLabK7D8QmyBKUBOBx+LS7FNB2wNdKR6KqfF6MnEWF2sqwqBUr254J/gEGqe9yR88FSZmjUyYf2MENMHY5+6Mn07pS7Ap8do1E1GUhq52qXdA9z4rQnXqZJKtgal98/dT6987ExsAwK3fRGSainvGn/Zw5rDHcZxQhsBUg9xE4HOWZBiEfelrQz0DKd4iJs46yp7IrPy2tAxQaQHY99GDYQO1s2INQIw02g2ufWMHNp5RlWtXWY36LUFHZXLf7HvxObCb8zWEo5+MvWmV/8fpgAth1CvReMIaP1LcQOD0Fh8FT+zgmD1KWZ0hwRxyKJ8VAQ/CK+qXhYuBBDdIWuUkrMuYRbHJcvHekzBP2j3GA3if2qMZ3iEsdZeYbC0mzSGxWqrlEA 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)(39850400004)(346002)(396003)(376002)(136003)(230922051799003)(64100799003)(451199024)(186009)(1800799009)(41300700001)(316002)(4744005)(83380400001)(8676002)(36756003)(8936002)(66946007)(2616005)(4326008)(5660300002)(52116002)(6486002)(110136005)(6512007)(86362001)(6506007)(66556008)(54906003)(6666004)(66476007)(107886003)(26005)(38100700002)(38350700002)(2906002)(478600001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rRnbNGXXBVXd+fhq68b9MPKXMusBBYbpYUqZ8VJIwVRDsdx8uKRfo13dCUr9R6Pqg9h7WmnZvkNt0IEOzJm76ZQiBXTYdML1W19yEBvhxzqgTnRAyt4xEA1RgDbD4CffUoAyipyqYOOxPC7oLVgd6bNhiSs7s9fmvtyb1SCpMdHfOsE2rqvOIbB8JRLc82bJ8Li90fAAV3NvrsTythmcpaLHv65BA6fpExR2eplsSUB1BrL4RUiTGw0RDzWo0tPJRyhdsg1tcJpiOZiYZZgMCGqNDiOdUyeX3qoqdC2j7HPbEQLhhtdN1QbJ8voCMLKMsz4NJp9Oij3JB7ZguWuEmdzhkt3/uyVuTN6+NcBtprpcQ6ceJP1i9da16GtRXHsDyFrR0EQbAmVLcnoCm6fXrOGYBIkvKovE60YM1hOCAV866MNwYuNtGHaUIEPkZznaDAmPV3fW7XzQGjsklXRvLGclHljrJKz5Kw9ApDHaoXXWb4Xj5M0oIdLmbgjRLiqeyHAQ9kdFj1MncEaZFOcB6GUtAf+cgiErEegqvAZm1Fg+MPLRb0+zwbBXshN9FANObC1rpiveHuOOQwECFL3RxEa0ybuHIKhoi6KO0tfQEtR91jSGS0fMZL9tAAPDdYJx8w3DKO/ilzC85J5neLVH90VDbA8YQeYCNFiFXwJ/igfqTkKVIA4E4V6Z0RPeLsjUD9vsQgEF3mutVwa31nR81vOBPrCBP3q1XXqIKfXpVc3+dZHh7kTNCk0KrkZICXCou54EP1JKhEfGoNo4rc3QfVzSxYAJO0CHnqmvbVIYC2iqTsPiQsz0w0wvB6ln26L85nsRINrjS+qSqbBVdP5I/05cWgyt0pj4J7A4tPmETMaib5oisA6I6N9kZ17bg6lEgtlblqJ5uUOPHxZNsW5b+Ap2aUriQ4rXNv9/7WdlKh9CHudrBI3QJT8D7UI92TnFzJoa42KPAtX8+jxoD3+RE0uadeGJ5bamc4BEvvTf0jetpk7hUY8pFm+l5hg5YghM3MXJZNxeyArGaL7IggcK8+zX/MsSuKBwstzupFnreyw+mVKmbL7LYtB8YS4DJZq0MldiKo8zjSlc4CAoamF6HEB3T/rWAeqkIQqaxREqx3ArVO6BBO1W4N3ktiZTDURSUIojl2vEE5EvXr8FM5qzvAqG5HpEt4N10HrDF0n90f9C4o1CoMY985HVfO8ciwdmEjptRCFwZRerzX/SNSMMpEWLuetQHnHxpCctOeY6JVV+Pg63AOk5kF6fBJG4PlGD5scQcRLl/54JpB/rNXXTdKYtS2IYS7HdU6VKQ01CMe+A6KY1j2pdu+myu6QJcARiXfkUvH6HKjGm+xwDDWqloefxexxo4aLPYIbAeANAjpdkh+PC987mhydw/0mg50qq+OzLYNIvO13nV7d1Ldsz3Z3z09N3KkNwHsf6XSKP3oBJ9yGHsNAoka+XYLLevtFqtQsXCQhKPjvnxH7fNf5tza6joLyUm0cChZbVr0mug5DpKiQnaQNlNabxjIN4+VD+BTePVrJdumPSZbkl4FAqeC+oLZOfX5yFmMClHqLZglHmmxHmqyYT8fCLB2QxPBW6 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7e94b392-2a00-4a12-564b-08dbc00326cc X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3017.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2023 09:13:17.3706 (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: 4aFFXu6B0DnKRXLBuhYqQyuB8XCjfHnrINYeUNDGpi4YWCSHtG2rKErQFwXTCchpB5zRp5hUDuaV8oWkhqhHbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR06MB4470 X-Headers-End: 1qln5E-0004yN-RT Subject: [f2fs-dev] [PATCH v2 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fsck/mount.c b/fsck/mount.c index e4372cf..098e73d 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -2852,8 +2852,10 @@ next_segment: } } - if (type == want_type && !new_sec && - !f2fs_test_bit(offset, (const char *)bitmap)) + if (type != want_type) + goto next_segment; + else if (!new_sec && + !f2fs_test_bit(offset, (const char *)bitmap)) return 0; *to = left ? *to - 1: *to + 1; From patchwork Thu Sep 28 09:20:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13402355 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 9CE8ACE7B0F for ; Thu, 28 Sep 2023 09:13:31 +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 1qln5Q-0006Cs-LF; Thu, 28 Sep 2023 09:13:31 +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 1qln5P-0006Cl-EW for linux-f2fs-devel@lists.sourceforge.net; Thu, 28 Sep 2023 09:13:30 +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=p3qYDJ0CPf3IYOOvsJ+LMmfAce2ZiCcVF2trmbUYWYo=; b=G/KLhXsqytFhAYrb46eOC/aLsV 9rPWkZazGlDXrcmFMvuWIv8QusOqXy1JOL/kNE50PDiGZS0NM7RZ+lOdCkL1UJoZ9AWFEa7IO3nCn IozKRFKOsjCt0It5XC0ldCSSSegHhAqFLUNtsIBfwArn+ShtZHZS+z0Mo8vKseKqXkWg=; 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=p3qYDJ0CPf3IYOOvsJ+LMmfAce2ZiCcVF2trmbUYWYo=; b=OTY+xnz6EoXPeiWI1sNAOcZEHQ n6nAxk0vlDMMFex6uTZtMY/499hJhKr4BfFLpJCpEVsMgmjeXC4HdB4pg6nYOFD5apYJ9yc9Mp1US ItbRQtCHvSHvO8j1dxi7qA+Lak7GFQsQvocF+6vhNor7cl3xyYteNReGUoXI/BdodCHg=; Received: from mail-psaapc01on2099.outbound.protection.outlook.com ([40.107.255.99] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qln5M-00050A-K9 for linux-f2fs-devel@lists.sourceforge.net; Thu, 28 Sep 2023 09:13:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DQtH6iCzXYRKO0nEuahrjw76Czw8U1cfO3/eNMQ3zwUflGjcY2ufuDl0qZC9zY8KvsjlPWc+pqIoYaoS2L+dDRtkEiRrGt1Ars9mbxbbWpFMoC5qYmH5wne6fTMsnHu7KVbKbHSfKtpj1ttxVmTaOyKE5OM3tCAsvuT+LvtprSBBJ/7/iYDU7B1jqw4fi5cTbjyY9qVZkv8UFS0OL19Es1YyD/8GoyZz6IFazoYxbyl+ldJlyQpND4bpQ94Ddlsh//VcLgWrS1MCTNVDbW14Haz/Sx1cTKZ3/Vy8+1e2AoMNBNWdrRC204RTRFODJsvzus0MwFRut7+kxpM/r7DqPA== 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=p3qYDJ0CPf3IYOOvsJ+LMmfAce2ZiCcVF2trmbUYWYo=; b=l5GbEVGXGL5M9jbTUld0T0MHvSYJprUYX9bmS8n0jbP+B0a6mXmcUgVs5nSRThPrYxebgL4CSgg9xR+S/c1C9k960bwV1Uu83V3jC8shMQDY0zesvgEGes8ifCMia1DE1qa8j0GAJCgxDMsXG9Ncu+RPmV1gZQ57zMSafqwNZbc31duUngzhX06IrsMXhcT4KM5DCHsOmmbxwhNOk5aEbSAKTsv82lYr+7PxBq2dnZPHJnhWoAJkBCZhTyExBzUFU/CNdYod9QOlJ7T/4ZdSg3d9Ji3JrSUrUKMjYitcszkK9WLYSD7cAuHXVnFmYHV1AMAQVRBxsRjFypMMto1W5w== 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=p3qYDJ0CPf3IYOOvsJ+LMmfAce2ZiCcVF2trmbUYWYo=; b=nY0TCQqKwfdJj5nQOvtVMgOoA3CNvPxVjwmhcBTyvK5dT8uvrn6h7tC91SytYnq7gMT7hixi7t+ohB4YGJfZYCF4kUmyXgt7YZkcxgK8zOStIvOx5ZZV9psuERoNkwFBSFTcun8t0wBwxZdT+fkVT9/uu/uV+0vaneLyJq5zPVQyy9Q08k65r4iO1ZuYV1Gtgpp82dqs7t/+/ukENBqT4fXVg1/fLgqJ+hY6SYhxP75Xj4B6QAd22jffWOiTv3INCM5SIwiBeXuZEbEZynfMjNNqRtXxmoJANu69tnsMKpARDqv3kthssOrP0fGu7+i42jSZoiLC7ZAGnC3+I5nJ3w== 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 SEYPR06MB5867.apcprd06.prod.outlook.com (2603:1096:101:d0::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Thu, 28 Sep 2023 09:13:19 +0000 Received: from SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::e1e6:c2aa:6b5b:bc1c]) by SL2PR06MB3017.apcprd06.prod.outlook.com ([fe80::e1e6:c2aa:6b5b:bc1c%6]) with mapi id 15.20.6813.027; Thu, 28 Sep 2023 09:13:19 +0000 To: Jaegeuk Kim , Chao Yu Date: Thu, 28 Sep 2023 03:20:51 -0600 Message-Id: <188b05d1764d1ba48f9c704ff28df853f3094f67.1695890686.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SG3P274CA0020.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::32) To SL2PR06MB3017.apcprd06.prod.outlook.com (2603:1096:100:3a::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SL2PR06MB3017:EE_|SEYPR06MB5867:EE_ X-MS-Office365-Filtering-Correlation-Id: ef1e40fa-4ed1-4d8c-516d-08dbc0032853 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IjpqzL790SUgxGnobOdklGbcM5FvItWPbPCbYzqoKzgX09/Ng0F8ws4356NrtSSUBJDIR6ugM0Cd+agFukcXHHGkZF5Zhk7q08UBjL3/y1aeECROd4Q1dtd6OhTFsgyot9YCCXkTpjoC5fjBWFfGwyT9orEI+4xeDAiiZP0wrQgho/Gv9fxUxBo5IIj/zbIkIIphhN3B2458TuqV81Dtkotbtddspu0gIQLF4mYPvVpX6cwGlS9v4/y5EblaC+NZSxPJax9cRe4MmmBRghPj4JSQsK+9rIGXYWZzULm2we8KkXrAU5i1Y1Qw5CbZHpm9lse0oM7RU10YcgF64e78Levwt/G1J1A0fRy0y0ALGZ8M1Dm+vixKxfNt9OQofvLRpFQfQMfxEsl3dJBlOQKTzk+Yua4SS2usPdDBnoidHzJVUR4Vdh0Q44eeyHbHn1jCwtqta5SVmeTi9WSGFOdbPYZs7svokmejbPZdlbYZbNVYk75iSKEsu7GqaHzgX/wcWuYaQeVwlRODzYDGV3vw8gQKOjkxGrxPigPGlgixu6SKpc5/8lCCYaDDtI0H1nPKOYAvBKHhadKGXgVrTnasOKZkcMAKeKopxaRAHIyzvRyCVW9EP1mefzd9P7MS9zqn 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)(396003)(136003)(39860400002)(346002)(366004)(376002)(230922051799003)(64100799003)(1800799009)(186009)(451199024)(2616005)(2906002)(6506007)(52116002)(38350700002)(38100700002)(86362001)(6486002)(110136005)(6512007)(54906003)(83380400001)(26005)(478600001)(316002)(4326008)(107886003)(5660300002)(66556008)(66476007)(36756003)(8676002)(8936002)(41300700001)(6666004)(66946007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hWCnAU7NzJfIng46OdW4vVju+1batKJ0lvlWQulsZVNCiuc23w/hKuKa+R1AI6UgjOwk438KprF0V1sevrIMTKrcgjygRxtuShcXByYkmnN2k7XSy9tuwT4mE5xm6xV9zih+4z6SYzR6Xi9Swsf041i0QYYj32n65qg7ZgOIv4gixBxLLzEAO48ifFcROmGCadWH7O8gAlxx/B9sBeYuRid9qqhyLStFc0XqJFMoP5POvWl7Z2lfndnhte+oTJKzImorUjxMfHWZ/DpJyNZBpBp1BA/qewwCya9sj3MXkXu9OJQ7fdR/JA9rDK7GW8ozWjp5oRk4n2gprgdiWCrq/UWjK9mRFEhGkaMLnBqNcC9h21Ih/en7U4NpSnujhfZJ+LC5pXYuomcCgViFBRaJtZdjbGu1lm71lEBWhe7W1RfpEN7+w4QVcCB8R8HtEqgXYqyLPgfza8bGB9iB2b2zsEEaebJOdA5qLQ+lcOUl7PO1wpiLqpLHVru+8VIDbjqmwErLqeWQcv8ARFWXYrRm9CXasnIRChN2gTDLDb/V0F2SUXBUQQC/nEl5lFINcPN64scSZpa9BfWWV68cuhTDp5nyqYwN42hwjm3bXbpi18Bm+49Or7O+AVt3C2AqQZcd81uChmc9eJtM8v77ZOMx4Ew4OSkaqs3DJXdWpnJmgK6gqVLCAbtVdJAD64lXUmoxh5hm2xtG6KUgnefxS8uklkJJ0qctuKl/XbnQNaT1ZLDZe7QhfmNLBeGuHKjBU1k1pHPaBsnpZK4x2EibfbLdIB31nr7fFfBLTitgRXX1QsxrOsCU82Ucw6OUYQ5YqyDzB+XXqODHCtQReSMdVS9+CJA0dW4giw+csDHTLZyoAlZS56iNhLnQXbwbeHxJJS+KG8I9OlXIMUcuw1+KcUnR74gQCjOzhH3I6B9fJbUFJJZ0tqhEFTX/lyMlDSo+QzeUVvQE8nrDD0bYnLIh+vg7/AEAbRC9lbwEk6C/wJAbieweXym1Fs+0eR7w46Htizt5gAdIrViq7eEarhWXkjZs75ZM3u+SkYP90DplmroEO5xXjD5/4B782VFurAakuvx28hWImKy5V1uLC9Xz9F4DgHpgbHKFXz+DGjZy0EM64AscdQ50nJ4uUkffopTaxMMdw+72H9V9rYb+L3GJcb+aaC5GzVjtxYP1lBU+CDyltF4z6cKrZqafBgm+N7DWjewvYAL7kij/XeU2WyCzv9p+tdQajEIVoqZkMEnYAzytcr/f7VQXhdMh1JhXaTOw+IoFhs9GEd90wlkYNg75Sc/fccY656QpaxTx7DmJVo61/unC5oYASIOiMPEC4VIAAvtNamWQAWZLqMe0wl6pbuC5PE4CoQJ9a4t+fatOvk6m1RZ1LhzsMkI0/0GQHXyfAtD3DsQvTT+PNA+Uv/JIclp0ivZwoL31MtPODzojG0Doo5Kxjebeu05A115b1yJ885lYU1advDnHxqSzWSyAY3gr2PXP72mjWgwl4qU73315RgQjcgXH25AXWlhIlNvVGTqIUT0fCdgw2eTxXHFzaJrYbqc9A9nxidQHFLASJLQ6c8lTiwcEcCsbf/iaaMTZveZv X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef1e40fa-4ed1-4d8c-516d-08dbc0032853 X-MS-Exchange-CrossTenant-AuthSource: SL2PR06MB3017.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2023 09:13:19.8543 (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: y6ZhYeVakilDcM58w4JyeEp8GLFss7k2XI1fIwqYQ9kEwkhy+alS4WFnTRWpMMcOcmzTGluY4ut21ECO6CUfEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5867 X-Headers-End: 1qln5M-00050A-K9 Subject: [f2fs-dev] [PATCH v2 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 098e73d..0a37bc4 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); @@ -2806,7 +2811,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)) {