From patchwork Fri Dec 29 03:25:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13506309 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 9E60EC46CD4 for ; Fri, 29 Dec 2023 03:15:20 +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 1rJ3LB-0007A9-1U; Fri, 29 Dec 2023 03:15:17 +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 1rJ3LA-0007A2-7v for linux-f2fs-devel@lists.sourceforge.net; Fri, 29 Dec 2023 03:15:16 +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 :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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4EpF9hvmVdzcrFSR5BcoJs2yQywPah5jHT+51PTUHvg=; b=Qo316bg/E37WZZMnkygcU56l10 kAgxLY+RUF17EhwT0SVSYJZ0FbqeXnl5EFI7aJZlhrgQdvFRnb4TpWE84GUrYOII3WOt2PM+Z2eLr re7sLReYCVfatVrloCFSqeinI7BE6MjxP3yW+J7VHG2HAh6xXSPUyTpTxo4gIQrHczqg=; 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: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=4EpF9hvmVdzcrFSR5BcoJs2yQywPah5jHT+51PTUHvg=; b=c aaJzdNyeqXdQUZ+r0gcJ8Og5nyuYmQay7iTplO/m5xYUSYSFqC36kChle3dgqo6otQpmrrtrNj8Cw ur7mCbHrimVC+5MI4mTGVEm3lekYYv2l8a2R8bEqzA0Nmj0n/+saawyA/aj74cS5pdcS/f+gP9X+r 8GawRaH6KR2fGKPk=; Received: from mail-tyzapc01on2127.outbound.protection.outlook.com ([40.107.117.127] 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 1rJ3L4-00051G-Gg for linux-f2fs-devel@lists.sourceforge.net; Fri, 29 Dec 2023 03:15:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nGIx4SQDO9wMwddwA+Rtfs+2msxxjp1bSDLikmeK31C5Ho/ojnJwPaqUywG5xeZhWvNlYbiUxrMZFchPCtLE9hRFVqWJDJXBDE/Igp6CaLP+YtHb/QcaiPdOcbcYwQqKq7s93xpKp2J/XV/ogM1NvvcqD2y3zgwwba4/+J7M/b+Ysi0RHEgem76AK3qIbciX2kFmEOFXBIXOYMtov4O7fHSSnIe0uwCe1MKihHjyOdKGwI4F+kVgh/vcS5eIpYwCPK3ucNBzaHkaxvZbB7COhh5Gja38VmzXlEM1JIyB8YSmzxJfDHXcaVnYqC8aN07uP+TYs0rycdppBSaSh+AM/A== 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=4EpF9hvmVdzcrFSR5BcoJs2yQywPah5jHT+51PTUHvg=; b=ZmsPhVv0QNIupbzWy8BaJ6vvdBkiJdxmfGAOXcdhcboQBtsjqSkJqrvQH/MDM6DiQ6/r3J7teHPny+iZmRHeyZ6x0IVHJ9iC2WMHVR1BbDcx/K+ZhWpXP4NWM2fArKoSFWHDK6JuW2H1zJ21mc0HMhk8JPS4RZdXIyZ6GFAF8E1TZHMTAxwFT+ivisU4Il9qq1B8XB3MRAq9g8dJe0bbrF74pgdBcCLC8r0rJGkoK82wB4x0qP2qzH6as5j36mO+bqdtw24FkiVsq6qfq5cj6PRm1tA+1DxB0zVh8QPf9DuHL1MxpvZjrabSl6TstJIPPNy8XSM2JKQsPNGC5hgMNQ== 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=4EpF9hvmVdzcrFSR5BcoJs2yQywPah5jHT+51PTUHvg=; b=UzKkMzPwX97NzXbK8uBcTCbDFFVFIrQ0suUgxJzqIMZ/yWZ6NVYcJhN88JZ3r4aNP/BwJdP7VdDjs/A9PjYoVv3YrPcrIQM9SFu5pixI2ykKhMsfg24jpfGh1//95DsevZjjjOIBEeu070hAqXybjbg65byR4G3vzaZ8QIvgd8ZpBNElsayWkRu2uO7RjrEfH50NGlqLFms4p6Kgnjy2i1TJ5D3e60bn0HBnnB73f4JqEceLf5lKCiRW+vM1SqcgyfEKiVotkJitHANcWSVYd//vP3VSzfgDmU13krIQdqso21jexxli/qXjfjc+BGYGSsUkKKiG/05/nqiqQbSHFQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PS2PR06MB3509.apcprd06.prod.outlook.com (2603:1096:300:67::17) by TY0PR06MB5593.apcprd06.prod.outlook.com (2603:1096:400:31e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Fri, 29 Dec 2023 03:14:56 +0000 Received: from PS2PR06MB3509.apcprd06.prod.outlook.com ([fe80::5cc4:b440:9894:d19]) by PS2PR06MB3509.apcprd06.prod.outlook.com ([fe80::5cc4:b440:9894:d19%3]) with mapi id 15.20.7135.019; Fri, 29 Dec 2023 03:14:55 +0000 To: Jaegeuk Kim , Chao Yu Date: Thu, 28 Dec 2023 20:25:07 -0700 Message-Id: <20231229032507.2016012-1-bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SI2P153CA0018.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::9) To PS2PR06MB3509.apcprd06.prod.outlook.com (2603:1096:300:67::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PS2PR06MB3509:EE_|TY0PR06MB5593:EE_ X-MS-Office365-Filtering-Correlation-Id: b40853f6-5bd8-4044-610b-08dc081c542c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Tm1L2fYWSafsSeKmPSToQvnStWWrYxh4k7X28yT/wIPc5NZH+6ny5rryYlb6YPVQ44Xk8/g04g9AentdXv4rDceWAU51mezIgLrJ63Hj9ZiNRRjthJ1H41ueguni8NBCxqNlQosPxFaiiDwQpKTAOWpRoDNNPdoJOp9Ar+AgVAuhFQQRHXbka7SjZNBN5nakwfnSuN/XnS98T8phSFPvxLAi46K9hNedQIN39iKMpgZDhj5zXbYgSHDSG/x62vXnmfhrFABHsDhrNktSa6iwFeGBfH2mRnLhRBLvK9BNGmJ98pv6gBh0P9/pj+o8KTTLEuukQrM5AF/NffTM4X4hh2dbniJl2FZaYC+pnZL80TvnNfHXaH0ZcD8IKt0BGytFCur98+tnQPAeP7VIDHQjSQN4V2HVrtOC2cTASB1x9vCYvkIaZgPovRNwqqdds1OPI9QCkHgGC6cebhdpL7dX3GHHFGJ6yhRQ4isC28ENXPgediPG84l/gnPpp2HCdfYVZykKqEGGOjW6zo95/SPFJ2vrlqzV7GjRHivDcm1bTo3y0sMCqvOyoWNI8Gn7hNS3Ef70BDo4dSKeLO9BU6pOAlH9J97J0nBVQaacn8GI+ak= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PS2PR06MB3509.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(396003)(346002)(376002)(39860400002)(366004)(230922051799003)(64100799003)(1800799012)(451199024)(186009)(316002)(6486002)(54906003)(8676002)(8936002)(1076003)(2616005)(36756003)(26005)(6512007)(478600001)(107886003)(6506007)(86362001)(38100700002)(38350700005)(83380400001)(41300700001)(110136005)(6666004)(52116002)(4744005)(5660300002)(66946007)(2906002)(66476007)(66556008)(4326008); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FBxW4OIIADQh2xNcfyooOLq+ZtwjwPi3w01qagzapVr42xsmOMWe0725GExMoDFT/hP/0P65OuM7wYEo67A1cLQVIao3NLeBKsyzjt5DCDUMe+JxOm0wQX1sg2FHqk0FT9whOnVOnUV1Xa1p0c0qyEKzIOWTZeZ2Pz3VPbTPLd8DSJ0xSta+Yx6zl3Bvou7nyDhjoRnaxGXQmkQNxIvYu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Hs2fg1clwAku6pbdNA+Z1GwbqtcgDKKxTIVTZ+/GfD6y+hY4KSuqaNGYV5AQMhiqHeZ9Jw73QEt4I6MrkOSCjAaHWMdQQzADl0SD0ul0ZFX1G1/D5ql1dZvSijz6M+D6uDCwtanJ0q10iO2cTOBW/IEbskJlOjM+Ipkc267V1l16faKlI9i2IHPjXPobpBdEglsXCP7W7X9weqGX5UVnWxC2panu1sxyD9eGVbhSlrVgiAWcsIq5hPUw2cXVWIK6yvLxtA/frbiTrQl4aFhpEIkBHAgPLQGGIpA/wHnvGfh8+BKtKxdpp X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b40853f6-5bd8-4044-610b-08dc081c542c X-MS-Exchange-CrossTenant-AuthSource: PS2PR06MB3509.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Dec 2023 03:14:55.3853 (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: zHTe1rx6DuA5n0G6qaqSVcyDjEuzCECbv2nHrLmI7ASiRAwZ5VQU2DH4QBO7hFZsapzoG0k4I8k6ejYAlW91eQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5593 X-Headers-End: 1rJ3L4-00051G-Gg Subject: [f2fs-dev] [PATCH] f2fs: check free sections before disable checkpoint 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 , linux-kernel@vger.kernel.org, Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 'f2fs_is_checkpoint_ready()' checks free sections. If there is not enough free sections, most f2fs operations will return -ENOSPC when checkpoint is disabled. It would be better to check free sections before disable checkpoint. Signed-off-by: Wu Bo Reviewed-by: Chao Yu --- fs/f2fs/segment.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 727d016318f9..8f8c0bb75be1 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -906,6 +906,8 @@ int f2fs_disable_cp_again(struct f2fs_sb_info *sbi, block_t unusable) if (is_sbi_flag_set(sbi, SBI_CP_DISABLED_QUICK) && dirty_segments(sbi) > ovp_hole_segs) return -EAGAIN; + if (has_not_enough_free_secs(sbi, 0, 0)) + return -EAGAIN; return 0; }