Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp780538lqj; Sun, 2 Jun 2024 23:37:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXvg3HldAH3xLiJv7Xk/PBLbcwWhyKlg7ZuF6Z9pt6yGglP1QfN21DwQA7QNCK3k6rjTkByFnFti+iCiuyqi6V6oTgxW3HczUzEwSS8Jg== X-Google-Smtp-Source: AGHT+IHRw7S4Gpom4dqzFe8FbcmWA852VsaQYso91y3Lo7kni2xiB7O/psYiPgldvKrWEmk730Q8 X-Received: by 2002:a50:8e42:0:b0:57a:2769:467f with SMTP id 4fb4d7f45d1cf-57a36492032mr6847131a12.17.1717396651797; Sun, 02 Jun 2024 23:37:31 -0700 (PDT) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31caddf3si3887316a12.596.2024.06.02.23.37.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jun 2024 23:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@oppo.com header.s=selector1 header.b=vGnozO+d; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-198647-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oppo.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5ABE61F2123A for ; Mon, 3 Jun 2024 06:37:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EC872C859; Mon, 3 Jun 2024 06:37:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=oppo.com header.i=@oppo.com header.b="vGnozO+d" Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2062.outbound.protection.outlook.com [40.107.215.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEE58374E9; Mon, 3 Jun 2024 06:37:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.62 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717396643; cv=fail; b=dBuLxuc01K0tGLUOw3YLr+bnV7GQzJHpETFhxu8YVStwaluvVRy54U2UgubyR48JUPvaXCpR5Vj+IEHhVpbdL4Enmfjb/szn1c6+5G/Pru2tJJ4qYdz/mnOV6R3lXB0X0hGpaYUB2TFy6sK03OiLkX3BNxFYCYhHZCQJr5Ulats= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717396643; c=relaxed/simple; bh=PC3010WtKsIMfTS67a7df43/ykTtxmWNBFYPyZIG+0Q=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=loqaiRLSWIndqm1uwdfHEc8B7ZVcQHlIIytXjKQU78KRxUCrr+sW0qUyKy/HRzh0Z83gs8RsDN6cEughPkoEQ0GwbRho6BUZxsIn321FPNalqNNCpMgG4Nu1EnGIOPDHA5+KSJlerRxs5igpHFLdLEsPNlIYIX+giMkbRXG/S8A= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oppo.com; spf=pass smtp.mailfrom=oppo.com; dkim=pass (1024-bit key) header.d=oppo.com header.i=@oppo.com header.b=vGnozO+d; arc=fail smtp.client-ip=40.107.215.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oppo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oppo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jCGqSWTDieEfZGxb/RVNFGTEA0wzyCSzq80uzc1BsluDPA/2jjSsgBDMVrkfjI2Gn5gR4yPeTveZK9w8vQKsl+ikrwWQfysjTozkf2b8HgwAED5BnH/JK0jQHVVcdXXWw/M3xStPeLBI7SKs8x9G0FkWFyyVMu7id4TpozpzZSrpWbgFM7N17ixVgdTTFWHy5ahmNQhFux6BoB61F/m5y6NKQJq5nogcgaHi+7R9p9Pd5N5sgIwoyY1Wvgrb1EHAa92Zb8EqHhAw2dCGJuMFU/IfRJQdBzmLcDIpLsWCSgCj0O001dSh8rqlKyfkkVWC6TTRmd0Q9Li5RgYY3saU+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=s7+Gb5ehAup3aJEnj2pXRB69guzUToFkrHPFSRPXZfg=; b=I3UoZpjfFAl3vydvxoqn92jxPqz5NRi8YcsNXOsWj1QqFjrZkFwBfrCRiDAnX1Uor/FRhZjSxcsym9qoAYHUAd6Xj0jHHPWEAE6W/8iWTwoYBLAg1kCkRQ+pmcAIDW4cJh904WcsaYD9UIMPlz5htKozOqvXUtqxGYcbcsrVozqtERpni1BZFvQlyWFPzDteMq9/1eVrulD8m8Y9vwwcHQN+kuZ5QwpfrM1ADO5KRqOnphSCt0mbXgOTtEuJBTEFtcatr1iKJtp/Lg5bQLxJxpdIxoqeFD8VlhHSDVeYhVKdDC0AhpjtovHFSdLY3NxUTgE5R7H90l18fDlatCoqmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oppo.com; dmarc=pass action=none header.from=oppo.com; dkim=pass header.d=oppo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s7+Gb5ehAup3aJEnj2pXRB69guzUToFkrHPFSRPXZfg=; b=vGnozO+dg5QUOMEW9wGz2MWZqdl1mGk6BEKq60Ld0IXXHtlS+LegJmkkstM87/u2gHJi518TKY6wzLwz2KzVBohYz6XlFjwx9UhK28J1jqsjT1VUVPFQRvBmFvvpsAIGuE0/Q19319yntWU6hbqi32xnzfYCg0hiG/Cn70reAuM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oppo.com; Received: from PSAPR02MB4727.apcprd02.prod.outlook.com (2603:1096:301:90::7) by SEZPR02MB6650.apcprd02.prod.outlook.com (2603:1096:101:198::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Mon, 3 Jun 2024 06:37:17 +0000 Received: from PSAPR02MB4727.apcprd02.prod.outlook.com ([fe80::a138:e48f:965e:36f9]) by PSAPR02MB4727.apcprd02.prod.outlook.com ([fe80::a138:e48f:965e:36f9%6]) with mapi id 15.20.7633.021; Mon, 3 Jun 2024 06:37:16 +0000 Message-ID: <0db07a4a-91da-402e-9601-46b196b8cf1b@oppo.com> Date: Mon, 3 Jun 2024 14:37:12 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [f2fs-dev] [RFC PATCH] f2fs: add support single node section mode To: daejun7.park@samsung.com, "jaegeuk@kernel.org" , "chao@kernel.org" , "corbet@lwn.net" , "linux-f2fs-devel@lists.sourceforge.net" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Cc: Nayeon Kim , Siwoo Jung , Seokhwan Kim , Dongjin Kim References: <20240531074640epcms2p46c3cf8b7cc4e707948ae200115e28e39@epcms2p4> Content-Language: en-US From: Yongpeng Yang In-Reply-To: <20240531074640epcms2p46c3cf8b7cc4e707948ae200115e28e39@epcms2p4> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: TYCP286CA0059.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b5::16) To PSAPR02MB4727.apcprd02.prod.outlook.com (2603:1096:301:90::7) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR02MB4727:EE_|SEZPR02MB6650:EE_ X-MS-Office365-Filtering-Correlation-Id: 27f1a954-e300-4d81-094a-08dc83979c63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|1800799015|7416005|376005; X-Microsoft-Antispam-Message-Info: =?utf-8?B?NXpROWdIYzdHZVBPTlM2aG1KU3JaYyt5ZEE5REFGMVFsMURkRGQybFBybVg5?= =?utf-8?B?VFZZTHlRalQyd3JiNzBVemtRcTMyVVRZdW5iTVVWdUEyTHo1SlkyWDl4ZStt?= =?utf-8?B?SGE1ZFh4dzd6YktDdDAzOW1qbzVuVHArQUw4eXJSQ0FwdUlRblEzQmg0ZVlj?= =?utf-8?B?NzVuL0o0UmJ2amNZUUVCSXVtd0V4TXA5R0czQXVzUzNqRWhndXZRQkxnYlpU?= =?utf-8?B?M29jUFRZMStRRWNBSVlPQXdMWlppQXFDcU0rUFV1M3kyOUZFVkozbDNTeHMx?= =?utf-8?B?a05NRi9GMHJDUFVZNkMrMCszcnJBalV2a1VCVU5EK29wTzlmS3FtUzZ2bW4y?= =?utf-8?B?WlJBZmRsenBiUExTcEZEQzBuTFc4SmhLOFN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2OUNlaE1LdFkzMHI1VnlHcHZ3VGQ4?= =?utf-8?B?VkVyV2F3Q2IxbkJtUncvK0lBZlJzU2RNakFyU0NmQmkrQ05KMk81ODJJYTRk?= =?utf-8?B?TTc4a0ZVd01nQU9tdklONkxOWlhZbnZPQzQ5N0VNdWNnQ2lFYUkvMm5Qd25Y?= =?utf-8?B?RE5lQVNOOVVlalF3ZytmWDh4VXVGYzhndThQM1Q2Z205SGNWR3F0VTZzZnNM?= =?utf-8?B?aEpMeGZPVDNFaHhHVnhMNzY2K3RJeWpLL1k1MHdpc3NQOS94L3p3UnRFOG1W?= =?utf-8?B?MGhaQmFmSlU4Qk81TzQvNWxsVGgvNndFT3p4VnBhTWlLTHo2MWhzUWtEQmlh?= =?utf-8?B?TVNoQzBUNUVTcFJRN0VZcC9CcnhTdUZaOXhNaytVN0hEMGJHVm1OeFNadnNK?= =?utf-8?B?NkthUHVrQ01oYXA1akhjV01YdkR0N1BpNHQyeWkwNG1XeDVhcEVtZlBRPT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR02MB4727.apcprd02.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(1800799015)(7416005)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dHJGSnVqcTN3NDVjck5nL0VCdTd5SFdLNzZjc0pMSklXaFd2YnZWblBjUGVi?= =?utf-8?B?RzFHME1LSG1oVXhFMGcwM2dRenV4TVYxVDhQckNqN3VheWd4czIwQlpmeTRP?= =?utf-8?B?aVNGY3U4bldkUGRqbzlsb2tKSVJteXFBVlBpNlZnVVhRZ1dvbmVORXJScy9G?= =?utf-8?B?Vy9NY0h1YjY3bUVYZ0plMzBMQWxhRW1ibGV5ZENVeHZ0dHVLek40eGdDYVRJ?= =?utf-8?B?NEhYRnZQWGkwTDB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rUXJKM1k5WFBaa1l6?= =?utf-8?B?Y2ljN1VzZ3AyZDJSd28ySWtVQzV4d1Q2am05by9DUm9qL1kzcmZscGJHakor?= =?utf-8?B?QVFJOHVjY3hQVmtndEZFMmthaUxOdkNITXJmbkg0SVJ6YStYRUdFT1Bzelpl?= =?utf-8?B?R0E9PQ==?= X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27f1a954-e300-4d81-094a-08dc83979c63 X-MS-Exchange-CrossTenant-AuthSource: PSAPR02MB4727.apcprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 06:37:16.7895 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mKHivPR7rsA/uwc9k3qYlh/hIB3GyKtFbFlfJLp3tNtYgD6EUfhz0KKWYzGDdmSa5+IDC5O7EW/VRZyqH/gtqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR02MB6650 On 5/31/2024 3:46 PM, Daejun Park wrote: > The amount of node writes is small compared to the amount of user data > writes in most workloads. Therefore, even if there is enough free space > in the node section, it cannot be used by another type because the type > for its section is fixed. When using zoned storage, the free space in > node section issue can be a problem due to the large section. > > This patch can avoid the problem by using a single node section without > considering the hotness of the node section. For particularly high file > system usage, two sections can be used as free sections, which makes it > more efficient. > > To use single node section, add the 'single_node_sec' in mount option. > > Signed-off-by: Daejun Park > --- > Documentation/filesystems/f2fs.rst | 2 + > fs/f2fs/f2fs.h | 3 ++ > fs/f2fs/recovery.c | 3 ++ > fs/f2fs/segment.c | 77 ++++++++++++++++++++++++++++++ > fs/f2fs/segment.h | 2 + > fs/f2fs/super.c | 12 +++++ > 6 files changed, 99 insertions(+) > > diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst > index 68a0885fb5e6..ba26b2ce4fa4 100644 > --- a/Documentation/filesystems/f2fs.rst > +++ b/Documentation/filesystems/f2fs.rst > @@ -134,6 +134,8 @@ noacl Disable POSIX Access Control List. Note: acl is enabled > active_logs=%u Support configuring the number of active logs. In the > current design, f2fs supports only 2, 4, and 6 logs. > Default number is 6. > +single_node_sec Support single node section mode, it enables single active > + log for hot/warm/cold nodes. This is disabled by default. > disable_ext_identify Disable the extension list configured by mkfs, so f2fs > is not aware of cold files such as media files. > inline_xattr Enable the inline xattrs feature. > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index 1974b6aff397..90f13a6b64ce 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -116,6 +116,7 @@ extern const char *f2fs_fault_name[FAULT_MAX]; > #define F2FS_MOUNT_GC_MERGE 0x02000000 > #define F2FS_MOUNT_COMPRESS_CACHE 0x04000000 > #define F2FS_MOUNT_AGE_EXTENT_CACHE 0x08000000 > +#define F2FS_MOUNT_SINGLE_NODE_SEC 0x10000000 > > #define F2FS_OPTION(sbi) ((sbi)->mount_opt) > #define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option) > @@ -1655,6 +1656,8 @@ struct f2fs_sb_info { > > struct f2fs_mount_info mount_opt; /* mount options */ > > + bool single_node_sec; /* single node section */ > + > /* for cleaning operations */ > struct f2fs_rwsem gc_lock; /* > * semaphore for GC, avoid > diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c > index 496aee53c38a..b5cdb0845ac7 100644 > --- a/fs/f2fs/recovery.c > +++ b/fs/f2fs/recovery.c > @@ -414,6 +414,9 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head, > > /* get node pages in the current segment */ > curseg = CURSEG_I(sbi, CURSEG_WARM_NODE); > + /* check hot node if single node section mode is enabled */ > + if (sbi->single_node_sec && curseg->segno == NULL_SEGNO) > + curseg = CURSEG_I(sbi, CURSEG_HOT_NODE); > blkaddr = NEXT_FREE_BLKADDR(sbi, curseg); > blkaddr_fast = blkaddr; > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index a0ce3d080f80..c1fe5c92bdfb 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -394,6 +394,9 @@ int f2fs_commit_atomic_write(struct inode *inode) > return err; > } > > +static int new_curseg(struct f2fs_sb_info *sbi, int type, bool new_sec); > +static void locate_dirty_segment(struct f2fs_sb_info *sbi, unsigned int segno); > + > /* > * This function balances dirty node and dentry pages. > * In addition, it controls garbage collection. > @@ -420,6 +423,58 @@ void f2fs_balance_fs(struct f2fs_sb_info *sbi, bool need) > if (has_enough_free_secs(sbi, 0, 0)) > return; > > + if (test_opt(sbi, SINGLE_NODE_SEC) && !sbi->single_node_sec) { > + int type, segno, left_blocks = 0; > + > + for (type = CURSEG_HOT_NODE; type <= CURSEG_COLD_NODE; type++) { > + segno = CURSEG_I(sbi, type)->segno; > + left_blocks += CAP_BLKS_PER_SEC(sbi) - > + get_ckpt_valid_blocks(sbi, segno, true); > + } > + > + /* enable single node section mode if we get 2 free sections */ > + if (left_blocks < CAP_BLKS_PER_SEC(sbi) * 2) > + goto do_gc; > + > + f2fs_down_read(&SM_I(sbi)->curseg_lock); > + down_write(&SIT_I(sbi)->sentry_lock); > + > + /* it can be enabled by others */ > + if (sbi->single_node_sec) > + goto unlock; > + > + /* leave current zone by allocating new section */ > + for (type = CURSEG_WARM_NODE; type <= CURSEG_COLD_NODE; type++) { > + struct curseg_info *curseg = CURSEG_I(sbi, type); > + > + mutex_lock(&curseg->curseg_mutex); > + segno = curseg->segno; > + if (new_curseg(sbi, type, true)) { > + mutex_unlock(&curseg->curseg_mutex); > + goto unlock; > + } > + locate_dirty_segment(sbi, segno); > + mutex_unlock(&curseg->curseg_mutex); > + } Hi Daejun, 1. It is not compatible with "F2FS_OPTION(sbi).active_logs == 2". 2. Once has_enough_free_secs is false, F2FS cannot restore to multi-node sections even after has_enough_free_secs becomes true and the filesystem is unmounted and remounted. This seems unreasonable. > + > + /* clear warm node, cold node information */ > + for (type = CURSEG_WARM_NODE; type <= CURSEG_COLD_NODE; type++) { > + struct curseg_info *curseg = CURSEG_I(sbi, type); > + > + mutex_lock(&curseg->curseg_mutex); > + segno = curseg->segno; > + curseg->segno = NULL_SEGNO; > + curseg->inited = false; > + __set_test_and_free(sbi, segno, false); > + mutex_unlock(&curseg->curseg_mutex); > + } > + f2fs_notice(sbi, "single node section mode enabled"); > + sbi->single_node_sec = true; > +unlock: > + up_write(&SIT_I(sbi)->sentry_lock); > + f2fs_up_read(&SM_I(sbi)->curseg_lock); > + } > +do_gc: > if (test_opt(sbi, GC_MERGE) && sbi->gc_thread && > sbi->gc_thread->f2fs_gc_task) { > DEFINE_WAIT(wait); > @@ -3502,6 +3557,9 @@ static int __get_segment_type_6(struct f2fs_io_info *fio) > return f2fs_rw_hint_to_seg_type(F2FS_I_SB(inode), > inode->i_write_hint); > } else { > + if (fio->sbi->single_node_sec) > + return CURSEG_HOT_NODE; > + > if (IS_DNODE(fio->page)) > return is_cold_node(fio->page) ? CURSEG_WARM_NODE : > CURSEG_HOT_NODE; > @@ -4116,6 +4174,15 @@ static int read_normal_summaries(struct f2fs_sb_info *sbi, int type) > CURSEG_HOT_NODE]); > blk_off = le16_to_cpu(ckpt->cur_node_blkoff[type - > CURSEG_HOT_NODE]); > + if (segno == NULL_SEGNO && type != CURSEG_HOT_NODE) { > + if (!test_opt(sbi, SINGLE_NODE_SEC)) { > + f2fs_err(sbi, "single_node_sec option required"); > + return -EFAULT; > + } > + sbi->single_node_sec = true; > + return 0; > + } > + > if (__exist_node_summaries(sbi)) > blk_addr = sum_blk_addr(sbi, NR_CURSEG_NODE_TYPE, > type - CURSEG_HOT_NODE); > @@ -4884,6 +4951,8 @@ static void init_free_segmap(struct f2fs_sb_info *sbi) > struct curseg_info *curseg_t = CURSEG_I(sbi, type); > > __set_test_and_inuse(sbi, curseg_t->segno); > + if (sbi->single_node_sec && type == CURSEG_HOT_NODE) > + break; > } > } > > @@ -5027,6 +5096,10 @@ static int sanity_check_curseg(struct f2fs_sb_info *sbi) > f2fs_handle_error(sbi, ERROR_INVALID_CURSEG); > return -EFSCORRUPTED; > } > + > + /* in single node section mode, WARM/COLD NODE are invalid */ > + if (sbi->single_node_sec && i == CURSEG_HOT_NODE) > + break; > } > return 0; > } > @@ -5153,6 +5226,10 @@ static int fix_curseg_write_pointer(struct f2fs_sb_info *sbi, int type) > if (!zbd) > return 0; > > + /* in single node section mode, WARM/COLD node are not valid */ > + if (sbi->single_node_sec && type > CURSEG_HOT_NODE) > + return 0; > + > /* report zone for the sector the curseg points to */ > zone_sector = (sector_t)(cs_zone_block - zbd->start_blk) > << log_sectors_per_block; > diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h > index e1c0f418aa11..152a07e61b5f 100644 > --- a/fs/f2fs/segment.h > +++ b/fs/f2fs/segment.h > @@ -570,6 +570,8 @@ static inline bool has_curseg_enough_space(struct f2fs_sb_info *sbi, > get_ckpt_valid_blocks(sbi, segno, true); > if (node_blocks > left_blocks) > return false; > + if (sbi->single_node_sec) /* check only hot node */ > + break; > } > > /* check current data section for dentry blocks. */ > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 1f1b3647a998..c21eeca86b0a 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -129,6 +129,7 @@ enum { > Opt_acl, > Opt_noacl, > Opt_active_logs, > + Opt_single_node_sec, > Opt_disable_ext_identify, > Opt_inline_xattr, > Opt_noinline_xattr, > @@ -207,6 +208,7 @@ static match_table_t f2fs_tokens = { > {Opt_acl, "acl"}, > {Opt_noacl, "noacl"}, > {Opt_active_logs, "active_logs=%u"}, > + {Opt_single_node_sec, "single_node_sec"}, > {Opt_disable_ext_identify, "disable_ext_identify"}, > {Opt_inline_xattr, "inline_xattr"}, > {Opt_noinline_xattr, "noinline_xattr"}, > @@ -803,6 +805,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) > return -EINVAL; > F2FS_OPTION(sbi).active_logs = arg; > break; > + case Opt_single_node_sec: > + set_opt(sbi, SINGLE_NODE_SEC); > + break; > case Opt_disable_ext_identify: > set_opt(sbi, DISABLE_EXT_IDENTIFY); > break; > @@ -2039,6 +2044,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root) > F2FS_OPTION(sbi).s_resuid), > from_kgid_munged(&init_user_ns, > F2FS_OPTION(sbi).s_resgid)); > + if (test_opt(sbi, SINGLE_NODE_SEC)) > + seq_puts(seq, ",single_node_sec"); > #ifdef CONFIG_F2FS_FAULT_INJECTION > if (test_opt(sbi, FAULT_INJECTION)) { > seq_printf(seq, ",fault_injection=%u", > @@ -3675,6 +3682,9 @@ int f2fs_sanity_check_ckpt(struct f2fs_sb_info *sbi) > blocks_per_seg = BLKS_PER_SEG(sbi); > > for (i = 0; i < NR_CURSEG_NODE_TYPE; i++) { > + /* bypass single node section mode */ > + if (le32_to_cpu(ckpt->cur_node_segno[i] == NULL_SEGNO)) > + goto check_data; > if (le32_to_cpu(ckpt->cur_node_segno[i]) >= main_segs || > le16_to_cpu(ckpt->cur_node_blkoff[i]) >= blocks_per_seg) > return 1; > @@ -3823,6 +3833,8 @@ static void init_sb_info(struct f2fs_sb_info *sbi) > init_f2fs_rwsem(&sbi->io_order_lock); > spin_lock_init(&sbi->cp_lock); > > + sbi->single_node_sec = false; > + > sbi->dirty_device = 0; > spin_lock_init(&sbi->dev_lock); >