From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 E5B0941C72 for ; Wed, 11 Sep 2024 03:43:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026220; cv=fail; b=hMiQNz2JQWsyNZqfHUxbCHyq5YM1X5wuYIvqxqs+QsY4d7sJjeELFhHFZCEjbCpx3/pvS3hy8qsWcc83/7WgWLEAuqruPCEG+UeqI/JesZWUNHqtQ1MwpZjdIgj4stRMTO0GmaEvCF7UrNiMobxODdtZIylVKYdStP/MLj440yc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026220; c=relaxed/simple; bh=DeVPlMyqJ11Ncbh5qQOPdsxprmaTkpPrGyy5RDAnmxU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=E5/M6MY5tSqk+kFVpjCe44dCSG6BLLHKaM7jaI4lMKd+zmSuD8omtWlsT2K5Jskzuf380k41hteucLuI8vzDqBXucehfL5u9zaGHY/inQNLWGfHTg2sos5SrucWvnbFRHI1RmlfYSlROv9ji2QulLErNlqsQIz/GrLpfvXfgvLs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=EkEv6qs9; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="EkEv6qs9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PqCkmRPRC/4t3pPqgH4h69dzS/aGuLgjBwOMUQ4IzFeIgWYon+rZ3Xqf1VCdBcJTXnrMBh7Y5WYSGQHwCvNswFSHIKjTzevHgiiwmpjvfqzNOqKUBt3LhBv7z4Bv+i2KvIR7eaSqxsdjGAH/fZO3c/hvHT2wrRxvgLVi+TQjgBc2yR91pGlv1Tw5X6oCqk8Bw8D7QaEFyR4HJcyz38yCBDe6G7GVsW7221KBhfiZupxSV2xthBxVT1SRN3lJrjFGJCrx89nYA/PEQfm8cJg2JOyBK487L/bW5QNIgs8wBbdzjcPuO36EWJiDOz6E5JNeZaojv2cD3jQV2w9nE1SpjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=789fi2cjANDVURtNHSKg2uT0fvFJ1Bmx9d+l7fPmobM=; b=HBtTx4OzOPno7uORxOwt1TGTHjkYKTTg12vjyxn5G96QJGDZs7gk1BIIQoBVkfru932zu5GFZ6h5dHmpEPEnULJSqzTSJRj55jc11+FNDPDO23HHJ7R1fL3FytpV4wjalMayRyLEEPK+KBLpLqkZnn5durciD85TglnMzHIvNQQOTjojIn5snDDT7UK6/BGgyOFNIw3QdjBoe0WILFVv29G52KR6foYzf6zLrNMdSsLRzZ0avim8Ax0oJNsOrHp6c7o6psdeVrowhiK4hit46lpYc6d8RLMGQPaWGQmWpHdjbYhbVZiB/IGpnF29gaPLLhe3cz8PW8lsCMg0fvV2NQ== 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=789fi2cjANDVURtNHSKg2uT0fvFJ1Bmx9d+l7fPmobM=; b=EkEv6qs99HlrVZelK9ypaCt/s5th7QGz9NuZfgCXi8QMJGsNkAxuI1JG6I4wx7UtJsObIbwPVQa599lXRis3nssolEGSxObEr9u+f/dM0sBgBxkZpHdIsrA6gVabSe7j2GRpHu1uI1vRfoiSplrWhh+ThKBQQv3IBf3PrDjbOkhBiror0je16lxyrnuQg3yEXP4k5Q0tBdLSCDYxnR90cSmOnJPBwLRyWGkdgfuq2sBqrgbq1AcN6OsbjFG537OmGJ6n9J5AkCFlvbzxKBMKNyufxHKqF6e1nKvFIXmEtxFykyOZ9iYXAP+z6qSJo/cwwNby6MWLm5uNCV2XuWTY5w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:31 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:31 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 01/13] f2fs: add inline tail mount option Date: Tue, 10 Sep 2024 21:57:14 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: c6710871-fc03-413f-02ac-08dcd213e75e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?DkEWqez+q8xUJs+KbGF7e3ctqPjEnVkmadRsVAUBzQx0fDKTpUPF/dPbjcgA?= =?us-ascii?Q?oZCVKTiMWkVDOiVP4gfigR+99iL1n10/XoWhcvFoQ+iPCsUmxWA7SirG1j5v?= =?us-ascii?Q?zsYAauxMuos1zNkxm056jy2y//GOjT2LV84v9SrkZb906J5KzRwWPtJ5SoaW?= =?us-ascii?Q?p+IE57bm6ZVqwwlM1HK6roAZ0WRH/bhQPdD3fNFgOHleHvH3dMIVKouFYjnS?= =?us-ascii?Q?ZSiFHc3sIshg6rujBjhtiFPTuFNFWC1xGVHhkYCmloCMck7fIDLed8Sa/FKU?= =?us-ascii?Q?PxzKmikvaXB4izxaH4FLXVY/iB0oYuXdMmt+yIPGnUIUwzcVvx/Xio857ZgA?= =?us-ascii?Q?0qQ756GizM3kmPprX63rc72Zm/7ipyZZ0FmQP7V1V5lFdkjMe68xe6ps8TgQ?= =?us-ascii?Q?63RkHY9HX85zUZ5/Eu5DzfNy5YYzkFlsKrwr5jGMjN4h/JsWYvYfH5kJNMFI?= =?us-ascii?Q?VQGKw3iAzlKP5ETN8U6sSo1IHGUmb0VtXOWOQ6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UEyx2lG74/vHwnVE8392p1aQfWPEGc2AA7TVp/dPOsyjfw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GOlSSmpk9ZGl6RnpTwF5ohzmg3uTwU0CluAOyZ0L1OWde74qvGjCn5ghetXW?= =?us-ascii?Q?SsqoJREhYoxAgox06QWKBouho0xsRKetAPKou/bJvU62O20V39Icrlt5wJs2?= =?us-ascii?Q?iE/FdRH4TmbDspUKrwC8iHovoUHfUxnVVwLvWiY/WxsrvYnfCGM5ZP3EgTIW?= =?us-ascii?Q?siKds2pCfK21Ot9/N3vDMq7N5ZDk8vnER+lRpTRaKVJjPPKf1FVJ/4/NAyoQ?= =?us-ascii?Q?4hGJjEzjohlczM6MG+rz8aJtAHBtZC4umEmZDOzFVVJorYICV0Mca7eML15L?= =?us-ascii?Q?FxN/WvdslVFBwmNqHedIXvb4g/Uh1QDWfTwUOKNv7Uj+9kvdP+ac9I6KbUT4?= =?us-ascii?Q?hCJhpj6hPOOyrCOwmsthcFAz5PpujsnOhj4mSs/Xz0L9v4x1+QAQ1exVbIbJ?= =?us-ascii?Q?wAPtWOCgLKdPCwW+avIEGAZWOc/kMeFLxhb0MVw3d3Zgxsq23Upsi7GNady5?= =?us-ascii?Q?jVUgCrVPAAXb2+s2915DJ49cqsOSvzIP/8VWl/wD8oyQR32sb23+su9rOvXj?= =?us-ascii?Q?rVC0t4tTZ4Q4p4ta/HgXB9spbvHadvu/SNvaYq0+w/2yqB1vwMyfmQMPw8Dy?= =?us-ascii?Q?T4KZISkhWJnJOHoDhmlIJEXw6Gk18QV6bKAjJLLGuGHvBdG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uTDzZsF9yImcOEKSFSY36NVQBKeHTOSjHhD8p5adhOymDwNZ?= =?us-ascii?Q?FNu1np7az2v6QceZDmc6NK7O2pcSfEpDT8gvr+A/?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6710871-fc03-413f-02ac-08dcd213e75e X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:30.9318 (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: uTJ1h6h1tSEy3fJF7DUtqKrhvv4ik7GuX2xwTka982vS3HCxGIsnavxmhHErs74zObAkmR9CiGiQfvjGhKkDRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" Same as inline data, use mount option to control inline tail enable or disable. And enable inline tail as default. Signed-off-by: Wu Bo --- fs/f2fs/f2fs.h | 1 + fs/f2fs/super.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index ac19c61f0c3e..3956740ca7e2 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_INLINE_TAIL 0x10000000 =20 #define F2FS_OPTION(sbi) ((sbi)->mount_opt) #define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &=3D ~F2FS_MOUNT_##op= tion) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 3959fd137cc9..d4ec32ba6cad 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -136,6 +136,7 @@ enum { Opt_inline_data, Opt_inline_dentry, Opt_noinline_dentry, + Opt_inline_tail, Opt_flush_merge, Opt_noflush_merge, Opt_barrier, @@ -144,6 +145,7 @@ enum { Opt_extent_cache, Opt_noextent_cache, Opt_noinline_data, + Opt_noinline_tail, Opt_data_flush, Opt_reserve_root, Opt_resgid, @@ -212,6 +214,7 @@ static match_table_t f2fs_tokens =3D { {Opt_inline_data, "inline_data"}, {Opt_inline_dentry, "inline_dentry"}, {Opt_noinline_dentry, "noinline_dentry"}, + {Opt_inline_tail, "inline_tail"}, {Opt_flush_merge, "flush_merge"}, {Opt_noflush_merge, "noflush_merge"}, {Opt_barrier, "barrier"}, @@ -220,6 +223,7 @@ static match_table_t f2fs_tokens =3D { {Opt_extent_cache, "extent_cache"}, {Opt_noextent_cache, "noextent_cache"}, {Opt_noinline_data, "noinline_data"}, + {Opt_noinline_tail, "noinline_tail"}, {Opt_data_flush, "data_flush"}, {Opt_reserve_root, "reserve_root=3D%u"}, {Opt_resgid, "resgid=3D%u"}, @@ -811,6 +815,9 @@ static int parse_options(struct super_block *sb, char *= options, bool is_remount) case Opt_noinline_dentry: clear_opt(sbi, INLINE_DENTRY); break; + case Opt_inline_tail: + set_opt(sbi, INLINE_TAIL); + break; case Opt_flush_merge: set_opt(sbi, FLUSH_MERGE); break; @@ -835,6 +842,9 @@ static int parse_options(struct super_block *sb, char *= options, bool is_remount) case Opt_noinline_data: clear_opt(sbi, INLINE_DATA); break; + case Opt_noinline_tail: + clear_opt(sbi, INLINE_DATA); + break; case Opt_data_flush: set_opt(sbi, DATA_FLUSH); break; @@ -1989,6 +1999,10 @@ static int f2fs_show_options(struct seq_file *seq, s= truct dentry *root) seq_puts(seq, ",inline_data"); else seq_puts(seq, ",noinline_data"); + if (test_opt(sbi, INLINE_TAIL)) + seq_puts(seq, ",inline_tail"); + else + seq_puts(seq, ",noinline_tail"); if (test_opt(sbi, INLINE_DENTRY)) seq_puts(seq, ",inline_dentry"); else @@ -2138,6 +2152,7 @@ static void default_options(struct f2fs_sb_info *sbi,= bool remount) set_opt(sbi, INLINE_XATTR); set_opt(sbi, INLINE_DATA); set_opt(sbi, INLINE_DENTRY); + set_opt(sbi, INLINE_TAIL); set_opt(sbi, MERGE_CHECKPOINT); F2FS_OPTION(sbi).unusable_cap =3D 0; sbi->sb->s_flags |=3D SB_LAZYTIME; --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 B3865EEC8 for ; Wed, 11 Sep 2024 03:43:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026218; cv=fail; b=lL8uYmrIvRBfhV6GlP50OGb5RcRE6l2LCU4PPZw61qdhflvNSAJun/q9BjL9YxNzr2/BNwu0crPJRl5kKMiUKPHhbzNGoMWJ13tAaKi3kbuKRh3m4aAS/I8Jb0HcAEYv/muzxTMkLG24/wT0gTTvajeqj4MWQXUWbnQXnC4WLT0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026218; c=relaxed/simple; bh=Fmgk2q4p/IwR2wdACxNVa0GZ4upX8qqi13m3lejd2u0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=RI5FqHXUHLl2lzoYX2X7W41D8KUJU5jsAStBWVgJqgOJ4vPRIbwbxUlmAl//W6xfW6nL+eiIRq9vW4EDXQpbfpx36rrrgbhnBdflxo6NDWOMfaP/crS5B7FT4MfvsVJbsUejbRGFCuT59bv/vERMS6kxziyrGlpNoWSt04sb7JU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=RQKkuXCI; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="RQKkuXCI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XvAh/BdlqmcZodyk7Z1QBbZCIJ7kyP6wdAJnMa0w0FV0eGZdx1idlPdCRlmQ8V1TCVoywWxiX68iOAlf68tyRpXIWjZhj8ErIHkzRTOAcP4bHRr0jqAcnXMBAIIC1QrwU/DZ1VTUIfmCtox4PXHvYRNYi3PvvFM1Jwrvof3OCPtEqgNcs1YsDRzAILqqd2VUloN2TyK3A7KlGOmDQrHvS7UXOYCZVDNtJuirVPx+slnHivH/imt60erIOdh95Iae/nftxw7gNu/8jWQNP8za0O0AljYOehIEsUqPCte3Dd0EQpobgifsTpCtUhVMFX9NXpycmHnhAEMfVnWHw0KqfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ui23Wl4gzNHQSlumlPbHvIZ7K3txKFrFBs2u97Fs0kA=; b=eqsZDirFi1F7bDzlOKbGU9A/lGmyU38hlsR4t5328iJtm/JfN8/rZsAdGdbtGZNU0lfTLQcG7u7G+JkRaGQga9XaYSeCJPGkpArnElExRVjF0WRghz+8W6Oe4Ud1vdTxjpl0Z2vjNagr9NgST++FRebSYYpkoGm/FT4jBuuhyAnN4ZInxrAdxDlMfimeOYen+HPhO9TJW74uxuPHc1QMAjbNZXY7WD3lPUPVHsmHntEgZBroUFO9aSb9WHxIn0H8WH1RNRCLgP9DQ4/DpiNQWDPmc6ZwORSGGsXa8ZX0DzLlWEn+YlhrywsdbMQhSTDSSRVqfeMrJpSgwkoPrXDSbA== 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=ui23Wl4gzNHQSlumlPbHvIZ7K3txKFrFBs2u97Fs0kA=; b=RQKkuXCI5NHGS5tVV9/QC6ySG5EVtjudQFGjlbjhQ3F1e/Aeax66TBqMmSrR68KPwxd8ORnvmboYjhQuu6oYSRpKYi/aYX7lwcuioDtLMypH6fMT6yQp0fSyfq4kLZMuEx5rhXcVkVZiz1Dn9mV2pNeAx93ZgMWil1I9EHZGYNs/ngq8Wh/YXjYFPrMG7FPevm6NnenFGDIVdp2PKWcGECEXCY+CxI44vu0jwe/CFVYq+A/WjPl7Q1KtqwudJPgrMiTwBl/qQh8OOYHmU5ZaLRRcF9O4x3tHVzop22fTxJSHBsVNJtnQtAp1ZWsWeouzfQb+ongKTszwAAVOUFT3Dg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:32 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:32 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 02/13] f2fs: add inline tail disk layout definition Date: Tue, 10 Sep 2024 21:57:15 -0600 Message-Id: <8532545a0f982fe320105ee61cb7ac32319781d9.1726024116.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: 42d9507d-f412-4b34-e3d9-08dcd213e83f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?SdM9nOqdPJ1yGyT9w4EX4fSf+qitFm8s+/3bVAF/UfvjnBVxBGwSgerLdGnH?= =?us-ascii?Q?tim2sdVmltj72TeLZYBY3/lJaepyioCel+S0wN0L3zuWf8QRpn0jWLYHQ4yk?= =?us-ascii?Q?fCH4nw0oJGPz1i5xQ6Iz1upsgZ44XoYvVNGsKVCiKycea5QXUzWiAcsEf91a?= =?us-ascii?Q?+NJ73lvaG5hVR86XbTe6usUr+rhPpQ7Fm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EgPOo9/0CWY3KPOiK3LMreg6LsEpsWp95+T4IpXXJCSE?= =?us-ascii?Q?2HREGNu7p8FPgUqyD3g+gptVMWHAaiBt+7atwdJIgBLNm+Bw+J2rs13bp16P?= =?us-ascii?Q?jI+7KbULL3npX1+M4QdVfXUZiExqTGDeHr+j/xJbe/8iAouSXeFSFlniUdy9?= =?us-ascii?Q?OV1NiNJL8mMiQ5OBiqmHZms9qjD3mMHM+UhoXrbX3sl3kQSTZpJ7ntbs88B0?= =?us-ascii?Q?UsHJvuXwJBELCxUHXx6nOoZf33J39k9EuZzUDsy+rGdCDiR+vP2AheP+HCQH?= =?us-ascii?Q?hvzSxENYH+wa2kUb1an/krMAChK0iyP+hUD23iSRKoIJNVIifg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?NT5Md5M7L/yo9Pv0+BO2a0VK5M3UdlBRczlFRCobPeeHo3IVEh7GiDhK/SEJ?= =?us-ascii?Q?2r7ZF/I0yzKW5RalIEh7ZdE+VIIrZG+yZpQYRM6X/Xj6N3gK6nCyMRI3UjwL?= =?us-ascii?Q?m6eYAe2MG5cVAQVXu5Ef9N7fAxvnnOV8pHOmAIpmCl2+19hIqYOEcGi3pSVT?= =?us-ascii?Q?T9cjhvbEGJz+T/f1qn9ue//zt5xO74JrLIsTjr1EY2qULqtL6pZeClubsAI/?= =?us-ascii?Q?2zzgOJvsxWfReig9L/YamH7yTChvfydIFsz9Bj61uwZ6QO2bycSMLmDT3gHS?= =?us-ascii?Q?ZPPn+BHO4mwVSipYoSt6C3iPQY7nhdHOiYdCNQCDPOnFM9wXagAzVIsWK3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vM8sP3w66K07jPYUwCbjwkIXpMLxR2xLLc2wo8dND?= =?us-ascii?Q?HBDTFKcksrKwf4t1eqmTXaW2GcCcohrZNkxlMW7SXgTTXOzxzws1zq8OgTgk?= =?us-ascii?Q?+FhHi7xYaPGHGHuIWPdpen7gudCFjs07du990NiFZimEdv1nUyvve3Cy24+X?= =?us-ascii?Q?BzQqP847VKR45wyu3H1ooYCHscQgazB+PLuED7jQcMn2Mj0dF99xf3DD6Ld8?= =?us-ascii?Q?6IwTsWfcoImmp+LIr2QPwSZenc9oe0ou6v2UaQbr3N0ytrZ+oDO6LvUhB8tV?= =?us-ascii?Q?dX7TpqWE0J1xUkvTApRr8vSSJQWo5zNucVn1n28gKGV5wq+T2dpE5gxKaAnZ?= =?us-ascii?Q?0kZF5+xReB8bPyisJfbOe/me5NSIkwujRzPGigvD?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42d9507d-f412-4b34-e3d9-08dcd213e83f X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:32.4808 (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: yFzmp02DP6ZYqAtAm7f8xeg+IAtVQ59JdlKDgUXToqd4gr4v22qBW1YwushQql2VIAl/BK7KqGDDyIPceCA6Tw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" When inline tail is enabled, use a compact block address array. And the rest space is used to save file tail data. The layout of an inode block as following: | inode block | 4096 | inline tail enable | | --------------- | ---- | --------------------------| | inode info | 360 | | | --------------- | ---- | --------------------------| | | | extra info | 0~36 | | | | **compact_addr[16] | 64 | | addr table[923] | 3692 | reserved | 4 | | | | **tail data | | | | | inline_xattr | 200 | | --------------- | ---- | --------------------------| | nid table[5] | 20 | | node footer | 24 | So if we define compact address array size is 16, then we can have 3392~3428 bytes to store tail data. Signed-off-by: Wu Bo --- fs/f2fs/f2fs.h | 27 ++++++++++++++++++++++++++- fs/f2fs/inode.c | 6 ++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 3956740ca7e2..e02a6619b90a 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -476,12 +476,17 @@ static inline bool __has_cursum_space(struct f2fs_jou= rnal *journal, =20 /* for inline stuff */ #define DEF_INLINE_RESERVED_SIZE 1 +#define COMPACT_ADDRS_PER_INODE 16 static inline int get_extra_isize(struct inode *inode); static inline int get_inline_xattr_addrs(struct inode *inode); +static inline int get_reserved_addrs(struct inode *inode); #define MAX_INLINE_DATA(inode) (sizeof(__le32) * \ (CUR_ADDRS_PER_INODE(inode) - \ get_inline_xattr_addrs(inode) - \ - DEF_INLINE_RESERVED_SIZE)) + get_reserved_addrs(inode))) + +#define MAX_INLINE_TAIL(inode) (MAX_INLINE_DATA(inode) + \ + (PAGE_SIZE * COMPACT_ADDRS_PER_INODE)) =20 /* for inline dir */ #define NR_INLINE_DENTRY(inode) (MAX_INLINE_DATA(inode) * BITS_PER_BYTE / \ @@ -805,6 +810,7 @@ enum { FI_ATOMIC_COMMITTED, /* indicate atomic commit completed except disk sync= */ FI_ATOMIC_REPLACE, /* indicate atomic replace */ FI_OPENED_FILE, /* indicate file has been opened */ + FI_INLINE_TAIL, /* used for inline tail */ FI_MAX, /* max flag, never be used */ }; =20 @@ -3002,6 +3008,7 @@ static inline void f2fs_change_bit(unsigned int nr, c= har *addr) #define F2FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories onl= y) */ #define F2FS_PROJINHERIT_FL 0x20000000 /* Create with parents projid */ #define F2FS_CASEFOLD_FL 0x40000000 /* Casefolded file */ +#define F2FS_INLINE_TAIL 0x80000000 /* Has inline tail */ =20 #define F2FS_QUOTA_DEFAULT_FL (F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL) =20 @@ -3263,6 +3270,11 @@ static inline int f2fs_has_inline_data(struct inode = *inode) return is_inode_flag_set(inode, FI_INLINE_DATA); } =20 +static inline int f2fs_has_inline_tail(struct inode *inode) +{ + return is_inode_flag_set(inode, FI_INLINE_TAIL); +} + static inline int f2fs_exist_data(struct inode *inode) { return is_inode_flag_set(inode, FI_DATA_EXIST); @@ -3299,6 +3311,9 @@ static inline void *inline_data_addr(struct inode *in= ode, struct page *page) { __le32 *addr =3D get_dnode_addr(inode, page); =20 + if (f2fs_has_inline_tail(inode)) + addr +=3D COMPACT_ADDRS_PER_INODE; + return (void *)(addr + DEF_INLINE_RESERVED_SIZE); } =20 @@ -3428,6 +3443,16 @@ static inline int get_extra_isize(struct inode *inod= e) return F2FS_I(inode)->i_extra_isize / sizeof(__le32); } =20 +static inline int get_reserved_addrs(struct inode *inode) +{ + int size =3D DEF_INLINE_RESERVED_SIZE; + + if (f2fs_has_inline_tail(inode)) + size +=3D COMPACT_ADDRS_PER_INODE; + + return size; +} + static inline int get_inline_xattr_addrs(struct inode *inode) { return F2FS_I(inode)->i_inline_xattr_size; diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index aef57172014f..88dfcf16da0e 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -425,6 +425,8 @@ static int do_read_inode(struct inode *inode) fi->i_dir_level =3D ri->i_dir_level; =20 get_inline_info(inode, ri); + if (fi->i_flags & F2FS_INLINE_TAIL) + set_bit(FI_INLINE_TAIL, fi->flags); =20 fi->i_extra_isize =3D f2fs_has_extra_attr(inode) ? le16_to_cpu(ri->i_extra_isize) : 0; @@ -666,6 +668,10 @@ void f2fs_update_inode(struct inode *inode, struct pag= e *node_page) memset(&ri->i_ext, 0, sizeof(ri->i_ext)); } set_raw_inline(inode, ri); + if (is_inode_flag_set(inode, FI_INLINE_TAIL)) + F2FS_I(inode)->i_flags |=3D F2FS_INLINE_TAIL; + else + F2FS_I(inode)->i_flags &=3D ~F2FS_INLINE_TAIL; =20 ri->i_atime =3D cpu_to_le64(inode_get_atime_sec(inode)); ri->i_ctime =3D cpu_to_le64(inode_get_ctime_sec(inode)); --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 07424433D0 for ; Wed, 11 Sep 2024 03:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026222; cv=fail; b=Xo4TZs0HutInAT8jYcg/R8ZDBWXe3bg/CIcn/j/07feMu2D/s7QMK36B+Or9cEbKi5IGnzD9aRfZW510COm4kewYohdZEMS6fpGM9Ec039iP3jtJKrEYnMfNCwHYnPHsMl72AGO/AFqDQTGCasxNJSAwU2hzh1ASZdLHP1zLZtY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026222; c=relaxed/simple; bh=8QLtL+iaFrYueURrfaRR5m/MGhWTsWdiQgT5o49llvc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=r/qsoBLehw+e3XLZaA9Clv1Zuhnl5rra6p6H+nbMlYy4DUZX4ct10MSWqEw6JIX8h8RpsMhPcEeg+ihsZyrq1zTtFPtRy6n6evi39T5OkoNAWcc5TVMs8OBkYLiPeTRnSwzGepTEhBStna8j139NFj9r1ELSsv/QPtFuR6UAdvQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=H1LYgwkb; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="H1LYgwkb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Gw4WmhMPeiFj1T+l8wxPhvs8lyz7707ACyvGmKB9rROVXLNNYVcPgSJ4ecgZdUMR1XqZvPvX6EI1PYbWBogkI4MeMMzzUOmSziOYMpB0AnZ9+tcxSKZhbkP7Yyd9CLO54FJZ9ng0hJN1v0rIvBZQdqgO0CjhX/9ABckV4GH/UVXK1NKuyq6lkYBAuNJ0PI5AJTEnreqjPkSiUgme5TkIs64d3ulaiRnant6s4DDGo9dY788miQimSUwWPLD621LGufVvEaCwchgEeIjgXAimOdvrrjk9BpvnyWLRgQ4K7ERBEvcNL0EOBuQ5ucl8Yx/wROkGcz6hScaaWkXXIpGrDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=jKRdl5s09iCG/1hRn+pGFaA9OVaf3V4M//GwCRvnKxk=; b=dYRomqEEXOb+yL9CUFVXbuPmgFD5DpYHE1n18w8NB611oJs4+j09vHj8rtEvPvgIo96W+G9AKlPngC7I4jYSmJE9tfWyo//4uREj4M7PPwMJECeUDdtdnL54KKj8Z2iaaZybA7+fNSeSEQJfxot70lWYZaQeKugYgdr+NCUcCT60xIUQjoHTBZsTpPn5cZZb5qiqwuBpGPGxvoeG6Yrij8XfCpRpydK4jBT4XJJ3Ot1V0pfpqxx5Hu+IAxrwkWzWQj5oDmnqv4RkNwd2ecarg/PCiCI6a9AzgI4uXAaUXtjKkHbPgAM4106ZPSZIgzUwJmW5/043zyISkXRpF8EFsw== 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=jKRdl5s09iCG/1hRn+pGFaA9OVaf3V4M//GwCRvnKxk=; b=H1LYgwkbmdMC/rrqAaE7uhiS41/JMiWS7S7McC703NH9QJTYwralwA/+OpjAqdlQKVc90W7uT1Z13rzv0bPTdyc8OGLxgqCcSep/kHVJhihlg+sutJ1LVXkJRJY6+Dv4ui4W3o7zvBIbqNmM77JITCUv2q7pC9ZvjXZAue5I5AWKr6QRhX2SEUQJnnqauxQMG2ViRGc1ZCYnZiqwozdU619051QdlvFJx70hYtmb30oEdMW1d85n23reVkZgiQPY2TgWtwR0jYMRNaua4tVNngsWZsKgORv27dpRFMy03ahjPUjQ7uw/vsCSQMOKwv01HFdxzOLlLQugbEpTC0nGCg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:34 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:34 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 03/13] f2fs: implement inline tail write & truncate Date: Tue, 10 Sep 2024 21:57:16 -0600 Message-Id: <395c6a887a35a5e3d396cf002914d236a288b235.1726024116.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: 1be6f4c3-2ca0-4b0f-5cac-08dcd213e930 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?QYOmjjh7mQltikBekiLtrUylK/igfWuRkJMAU8w5+IHo9QXZIj84uPed4ll3?= =?us-ascii?Q?AT41UpAvl6HgfD/LrP9B+Y0VNQZizNSvgl6fN3G+30xpa8uNtMxMcWS6i8ch?= =?us-ascii?Q?z+zCQ79Y6TGoKDLCCIG+/T+JpvxxVMiYoa7Dfp9ymrv358Va5NoTTzdO3INU?= =?us-ascii?Q?p0QskQKkkeDStHTP+468bzd4tufkJAnextKtuTJZve0ZHpps9VJpv5IXXVdG?= =?us-ascii?Q?ycGd+zQIYFgg6SlC+H6W6lUQvGUqczBUL828uxuDTW9M+aAaieCdv2z8Wh0d?= =?us-ascii?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eGH+1xvLXU4KQAF4aj?= =?us-ascii?Q?ajdAt8yo63P5mDDr0ksfDRqu3ikc6FDWz3+1FSHANsxgaA6G70d7g1aCcvyc?= =?us-ascii?Q?TraMPR/uCwRjRKrkD3idPcEIwuatrKU54mNVXwdM9jwdzprcCoUw2/25XULD?= =?us-ascii?Q?09Q2WrWkwFTBS236nanEwyUj/2yJ9mNu2FC2qoaoDTv1zpjwzYqQxuTHEzUQ?= =?us-ascii?Q?nx8WLdpopnIAF0YJpsZK7X37ODpQc+EV9POe30KEgXbVsGISmQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?y37IUIzDGR9ofzg6GOtfvgbVDpJYEL8L3ALVR0z+/iuJ57v+2Yle61Spuflv?= =?us-ascii?Q?rZWbxkg4lDs55Q4e7tG+nUeUbQCr5yquprGclP0NMRJU3qarhbmmOallIMtc?= =?us-ascii?Q?XJkaxzUo/Fn9RQAXQ++3LnATq0aNHfG2HPCBnCuydvpGRxfFjbC1nJk62ueq?= =?us-ascii?Q?YjhKqpn7NF+rN+wHGVxRH7y/sG79DI0rYjX01AqFrWQFNj38rYieHKQu8ar0?= =?us-ascii?Q?6LiIkI0K8ZV4uAtxytzFIpcsxh0Utz3XZL8ZjcT2gzwX/X8dQRbEA0QuQzuZ?= =?us-ascii?Q?u2lmpTOlRn+4ajxXrUYyNsJk419DXCegotIQovDYFf0Nhpow0gh7ay+FjqSN?= =?us-ascii?Q?aCyPca8wiksC0TCo/IU/C8cRQSwx55oD+3JpXRDS4ceaG6iY/rsNJ6r4YoMO?= =?us-ascii?Q?+csyIkdn+ZJIsFPlu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=?us-ascii?Q?/LoebZ8NIsQSU4qvH7/NB0nlXY0qO+hqe8FIkwPelCfve6aHY0+/tHFNKnx3?= =?us-ascii?Q?6u5QdwQh1no/7/ojv+DPXRmVDuqVSRx1cvHG7GQ1ByymNynTl4J1lherZ7WU?= =?us-ascii?Q?gqwmv6ErGl14E9FMz0Qy6NwnyPaR6ykayAnH9UTaDKFChp40IGRScWco/HIi?= =?us-ascii?Q?u4+tpQrVU7lsJc1N932gfMYuQ3ABcR1j5CZc3A4QJqzREl6RoTUd/VJGWL/e?= =?us-ascii?Q?/FWmITe9mDICdWNeYkoPGRMD4JM56uvX/IOOSaFU?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1be6f4c3-2ca0-4b0f-5cac-08dcd213e930 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:33.9643 (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: yQ4e91PTOd4d47pVyRYUp6OyXXL9rBaCADzNgdDrEMvPlYjTFixw+c/JhGdFWCCl+5Am3MK8dRH+eRp53YjvTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" As f2fs inline data is a special case of inline tail, we can expand inline tail based on inline data. If file tail can inline to inode block, not bother to pre-allocate block at write begin. When tail page writing back, inline it or normally write it if the tail is oversize. And when inode page writing back, update inline data from tail page. Signed-off-by: Wu Bo --- fs/f2fs/data.c | 30 ++++++++++++++++++++++++++++++ fs/f2fs/f2fs.h | 16 ++++++++++++++++ fs/f2fs/file.c | 10 ++++++++++ fs/f2fs/inline.c | 38 +++++++++++++++++++++++++++++++------- fs/f2fs/node.c | 6 +++++- 5 files changed, 92 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 6457e5bca9c9..cd13b5703228 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2776,6 +2776,7 @@ int f2fs_write_single_data_page(struct page *page, in= t *submitted, loff_t psize =3D (loff_t)(page->index + 1) << PAGE_SHIFT; unsigned offset =3D 0; bool need_balance_fs =3D false; + bool need_clear_tail =3D false; bool quota_inode =3D IS_NOQUOTA(inode); int err =3D 0; struct f2fs_io_info fio =3D { @@ -2867,6 +2868,16 @@ int f2fs_write_single_data_page(struct page *page, i= nt *submitted, goto out; } =20 + if (f2fs_has_inline_tail(inode) && page->index =3D=3D end_index) { + if (support_tail_inline(inode, i_size)) { + err =3D f2fs_write_inline_data(inode, page); + if (!err) + goto out; + } else { + need_clear_tail =3D true; + } + } + if (err =3D=3D -EAGAIN) { err =3D f2fs_do_write_data_page(&fio); if (err =3D=3D -EAGAIN) { @@ -2889,6 +2900,11 @@ int f2fs_write_single_data_page(struct page *page, i= nt *submitted, if (err && err !=3D -ENOENT) goto redirty_out; =20 + if (need_clear_tail) { + err =3D f2fs_clear_inline_tail(inode, false); + if (err) + goto redirty_out; + } out: inode_dec_dirty_pages(inode); if (err) { @@ -3393,6 +3409,11 @@ static int prepare_write_begin(struct f2fs_sb_info *= sbi, flag =3D F2FS_GET_BLOCK_DEFAULT; f2fs_map_lock(sbi, flag); locked =3D true; + } else if (f2fs_has_inline_tail(inode)) { + if (!support_tail_inline(inode, pos + len)) { + f2fs_map_lock(sbi, flag); + locked =3D true; + } } else if ((pos & PAGE_MASK) >=3D i_size_read(inode)) { f2fs_map_lock(sbi, flag); locked =3D true; @@ -3421,6 +3442,15 @@ static int prepare_write_begin(struct f2fs_sb_info *= sbi, goto out; } =20 + if (f2fs_has_inline_tail(inode)) { + if (support_tail_inline(inode, pos + len)) { + f2fs_do_read_inline_data(page_folio(page), ipage); + if (inode->i_nlink) + set_page_private_inline(ipage); + goto out; + } + } + if (!f2fs_lookup_read_extent_cache_block(inode, index, &dn.data_blkaddr)) { if (locked) { diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e02a6619b90a..2e0530b55e74 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3322,6 +3322,21 @@ static inline int f2fs_has_inline_dentry(struct inod= e *inode) return is_inode_flag_set(inode, FI_INLINE_DENTRY); } =20 +static inline bool support_tail_inline(struct inode *inode, loff_t i_size) +{ + const pgoff_t tail_index =3D ((unsigned long long)i_size) >> PAGE_SHIFT; + unsigned long tail_len =3D i_size & (PAGE_SIZE - 1); + + if (tail_index > COMPACT_ADDRS_PER_INODE) + return false; + if (!tail_len) + return false; + if (tail_len > MAX_INLINE_DATA(inode)) + return false; + + return true; +} + static inline int is_file(struct inode *inode, int type) { return F2FS_I(inode)->i_advise & type; @@ -4197,6 +4212,7 @@ void f2fs_truncate_inline_inode(struct inode *inode, int f2fs_read_inline_data(struct inode *inode, struct folio *folio); int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page); int f2fs_convert_inline_inode(struct inode *inode); +int f2fs_clear_inline_tail(struct inode *inode, bool force); int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry); int f2fs_write_inline_data(struct inode *inode, struct page *page); int f2fs_recover_inline_data(struct inode *inode, struct page *npage); diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 168f08507004..957d1ff55350 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -748,6 +748,9 @@ int f2fs_do_truncate_blocks(struct inode *inode, u64 fr= om, bool lock) goto out; } =20 + if (f2fs_has_inline_tail(inode) && f2fs_exist_data(inode)) + f2fs_truncate_inline_inode(inode, ipage, 0); + set_new_dnode(&dn, inode, ipage, NULL, 0); err =3D f2fs_get_dnode_of_data(&dn, free_from, LOOKUP_NODE_RA); if (err) { @@ -4703,6 +4706,13 @@ static int f2fs_preallocate_blocks(struct kiocb *ioc= b, struct iov_iter *iter, return ret; } =20 + if (f2fs_has_inline_tail(inode) && + (pos + count > MAX_INLINE_TAIL(inode))) { + ret =3D f2fs_clear_inline_tail(inode, true); + if (ret) + return ret; + } + /* Do not preallocate blocks that will be written partially in 4KB. */ map.m_lblk =3D F2FS_BLK_ALIGN(pos); map.m_len =3D F2FS_BYTES_TO_BLK(pos + count); diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index cca7d448e55c..2e63e9389fd7 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -102,6 +102,7 @@ void f2fs_truncate_inline_inode(struct inode *inode, { void *addr; =20 + from =3D from & (PAGE_SIZE - 1); if (from >=3D MAX_INLINE_DATA(inode)) return; =20 @@ -156,11 +157,12 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn= , struct page *page) }; struct node_info ni; int dirty, err; + pgoff_t index =3D page->index; =20 if (!f2fs_exist_data(dn->inode)) goto clear_out; =20 - err =3D f2fs_reserve_block(dn, 0); + err =3D f2fs_reserve_block(dn, index); if (err) return err; =20 @@ -176,8 +178,8 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, = struct page *page) if (unlikely(dn->data_blkaddr !=3D NEW_ADDR)) { f2fs_put_dnode(dn); set_sbi_flag(fio.sbi, SBI_NEED_FSCK); - f2fs_warn(fio.sbi, "%s: corrupted inline inode ino=3D%lx, i_addr[0]:0x%x= , run fsck to fix.", - __func__, dn->inode->i_ino, dn->data_blkaddr); + f2fs_warn(fio.sbi, "%s: corrupted inline inode ino=3D%lx, i_addr[%lu]:0x= %x, run fsck to fix.", + __func__, dn->inode->i_ino, index, dn->data_blkaddr); f2fs_handle_error(fio.sbi, ERROR_INVALID_BLKADDR); return -EFSCORRUPTED; } @@ -210,10 +212,33 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn= , struct page *page) clear_out: stat_dec_inline_inode(dn->inode); clear_inode_flag(dn->inode, FI_INLINE_DATA); + if (index >=3D COMPACT_ADDRS_PER_INODE) + clear_inode_flag(dn->inode, FI_INLINE_TAIL); f2fs_put_dnode(dn); return 0; } =20 +int f2fs_clear_inline_tail(struct inode *inode, bool force) +{ + struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); + struct page *ipage; + loff_t i_size =3D i_size_read(inode); + pgoff_t end_index =3D i_size >> PAGE_SHIFT; + + ipage =3D f2fs_get_node_page(sbi, inode->i_ino); + if (IS_ERR(ipage)) + return PTR_ERR(ipage); + + f2fs_truncate_inline_inode(inode, ipage, 0); + clear_page_private_inline(ipage); + + if (force || end_index >=3D COMPACT_ADDRS_PER_INODE) + clear_inode_flag(inode, FI_INLINE_TAIL); + + f2fs_put_page(ipage, 1); + return 0; +} + int f2fs_convert_inline_inode(struct inode *inode) { struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); @@ -263,20 +288,19 @@ int f2fs_convert_inline_inode(struct inode *inode) int f2fs_write_inline_data(struct inode *inode, struct page *page) { struct dnode_of_data dn; + pgoff_t index =3D page->index; int err; =20 set_new_dnode(&dn, inode, NULL, NULL, 0); - err =3D f2fs_get_dnode_of_data(&dn, 0, LOOKUP_NODE); + err =3D f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); if (err) return err; =20 - if (!f2fs_has_inline_data(inode)) { + if (!f2fs_has_inline_data(inode) && !f2fs_has_inline_tail(inode)) { f2fs_put_dnode(&dn); return -EAGAIN; } =20 - f2fs_bug_on(F2FS_I_SB(inode), page->index); - f2fs_wait_on_page_writeback(dn.inode_page, NODE, true, true); memcpy_from_page(inline_data_addr(inode, dn.inode_page), page, 0, MAX_INLINE_DATA(inode)); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index b72ef96f7e33..5c45de7f60a1 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1514,6 +1514,8 @@ static void flush_inline_data(struct f2fs_sb_info *sb= i, nid_t ino) { struct inode *inode; struct page *page; + loff_t i_size; + pgoff_t end_index; int ret; =20 /* should flush inline_data before evict_inode */ @@ -1521,7 +1523,9 @@ static void flush_inline_data(struct f2fs_sb_info *sb= i, nid_t ino) if (!inode) return; =20 - page =3D f2fs_pagecache_get_page(inode->i_mapping, 0, + i_size =3D i_size_read(inode); + end_index =3D i_size >> PAGE_SHIFT; + page =3D f2fs_pagecache_get_page(inode->i_mapping, end_index, FGP_LOCK|FGP_NOWAIT, 0); if (!page) goto iput_out; --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 28805487BF for ; Wed, 11 Sep 2024 03:43:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026224; cv=fail; b=KDCB+wjRCKXc7EOCN1K02fCGr8Ur1xWru2Sal5eweCAFz/b6cjA/oIpuZ0pHYrA5gwB4uOnJU4R9MZb8sWm013PMA3PXB1nAb90PkgEUgJbP0nDpVsP0EiwQYEC2Src5sieVFPoaASkJq+cDPHNotwjFU3Gf9IKZu97bbDCkxhs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026224; c=relaxed/simple; bh=SvhU1fKm3jh8SZr2LRzTEhzy8e+YC7jTm8MVRHLBAvo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=S6K8q9R/TqKnbrgiA+Pc/VuUDJFATH8867wKZhNPKzZtHjRzlU4DWpTsq7fj45jg+CvAIUNrSEElSpZqjcWPUwQyXpuY+bCuESZs1E8IjWWFlvJqwOd/mleTqNeCaA2FTsPsP8gi4miW5dAIcwtPAPJ/HVZUM6RRT7YqJYnbDQc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=L+uDI7Cn; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="L+uDI7Cn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n+b5xOUs/5XQocYYzM5uAz//ua+J5MOYZc6TlCuBM6s5fIJajy0X4phmPNqZtCYdudZXbGELbyaI3SSc7w4xFlhck4/j/jjHY2LqaZm5smFslDQ40YRmf+whabxu9lDQ5yFu/GnNsX81W+6M4wpv3vfIu3MVZGK2EzgOTLVpkTaacxeoJQHafBAjx7CZW1I3Rg7k6vUJeGjK1OJye8iZFxYiSVXdAiVcBbdDyqd6RLS4DB9QSNHt85cqr4Puj3QulggcGh9vmGKDI4UNPJS09up0qd+tZOhDKlCFT/dPrmZcFDcEZwzyjx0Y0+Ve9FDupiqJxwAvY7/cCQLi8977WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=zV/wxBoWCpRDMX0E9pav3c5V0+kf6YRvt/E5k66a+Hw=; b=sL+JWr7A5cpD+rOGEidH28O39XMfEr4EMzyibE9eZXNEMGdkZBFbMOJRa77z5vXD3ztJl5Gq9Lv8OKRSkfs8R/kXo1Kc7AIrFJZiU1JulhWBj0CkblDVodVzu+718MHJl4C6jjYKUggNG3zCx0Pcj0ttBvLY2qbPU+zm+E9EprmNf+hHAUwci4/OKlQWToLkCStl4P0lBr8+OSKWiYGh7Por0iVNfQzCqXIJw40kGTEPHN3+ecCCQ0Cj9qN4VobHt+O4cA2SH1hdB9VCt4QIMmmw/cq67wRd8EHEBc8EJ/lMfmr2f6oEDRwXvMl9vZs/B5rsDySehX6qTjnmklIHGg== 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=zV/wxBoWCpRDMX0E9pav3c5V0+kf6YRvt/E5k66a+Hw=; b=L+uDI7CnyUL8jdgiwfGLg+hKnlfKEAEPUYIHLn8PF77vKqOUgMGctrL9wL1HYf0nd1TpTuIdIiIIEnMNwT6M8mxVoXenIodjz4zlGGlBTr1/p/MKXS0bbXJOEz7Hb2Z+xlxOAO11wZ1CzbsPouKEUp9ciAyvLkjMQk/5wMe4vC+2x03f7/3YnxwEaF+kPMjmB68tBHrB/Ein1O4pjK1d5pXqUj8moon7n7JpL3WzOueWMbApJSqo9IwzfW9wJJjDzljVkVKKPq1uK1x998HRmhcNPRxJ6X2VR1dVkY9YC2c6N9zMirvpg06V1o7EvX/vNCQpLQdd3VXzv3a8FHq0wQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:35 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:35 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 04/13] f2fs: implement inline tail read & fiemap Date: Tue, 10 Sep 2024 21:57:17 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: c8505183-3bfb-42cf-2784-08dcd213ea11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?yLtzmSq2G1IeBkYrVwcs9Pegz+dmRCu/LJknhNkEktrPhu0N+pTD5g9lQ6PJ?= =?us-ascii?Q?m5jOHW7FFezIBAeE5pJNyiyJusraJAMgKPzVdLZPKffCsCOF6nMpGZu34UVf?= =?us-ascii?Q?n+b9jS3lhNKyPBhRDTg0WqN1QbZpNdHIgclgvheEh7fImppAztJqoCpMiu0L?= =?us-ascii?Q?1/45vRs5rYcQwysYGwSmCbdfTcCyxGQpWkbPF1TqddmJ4HHbodlOgNfEtJGo?= =?us-ascii?Q?5fIHu79VqdkF38qe3So5hd7EsTUGbq5gsLLXo0PR3K25ITYrwLvsKZ2mL7Xr?= =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+xgkvlD2IBzyyk7Qxr7VDEF6KaL31?= =?us-ascii?Q?T6vVDlLjyzGOLVQeRl6eUTfPOcJczsOFImXzaJizwa5NhevsP58SxR1p6P/V?= =?us-ascii?Q?DqIESPTyMWTr+4LIFPY4zKk3viX072wzJ+hlaGSrX/YhlgyCrThkjGMOrLuS?= =?us-ascii?Q?mb/gbAQZp75p0znjsN9+JIebcEtH7gnfOBJJVcabhEF2MT+wWVxDnZvKATuO?= =?us-ascii?Q?ZjJJI5PGqDPjeF8LWOtDOwOTlSY6xHD8dUCwZAc3OSLPl6wxCw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?d5VS0CcjORqSCPjnC82nRv6k0pf+dCtKBXsQat9Z5ilIAr+AkCOA3aeVwo4N?= =?us-ascii?Q?CTASaN+yDQt4s+OGR+YwTTDAI3Ws6q5QMjR2MBeSYl2g58A1FduB8YbbO3N6?= =?us-ascii?Q?/f/Xf5+zSz3qJUrgxNrOZ7FrS8shpl/Gq+5QY0tWuZqcQtQWmSKRMvs2qbEK?= =?us-ascii?Q?6Yr280xJCqDshVGjza6BAHaQxj5R9mroArNuAwd6F9gJtK51apEokkzaCZkx?= =?us-ascii?Q?3RLW58La/t0Quo/7Ngtds/+sgCqfBLcp6G5gOkfCKxtHh6BsRnIYe5sKVGKR?= =?us-ascii?Q?SStEzphh54ti5eMgVE4ORx0Uz1rTANYhvmdRDMMOJpxeE3QzpUG0lgnCpe8Y?= =?us-ascii?Q?mAgC0zh1T+PsZa+DNsixVs7LBiat/zmLog716NdwUFu9kqodONJGEG4W1+Qj?= =?us-ascii?Q?KFOR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ECzmp/LxAiy+CcVXz?= =?us-ascii?Q?qAdRz25WyCl4DFhv8NUFBKVI36YiU2MC2KBmnKhfw96TFw0BYBO2wuRTa4T3?= =?us-ascii?Q?zo4JC6bMUyjVAwwR8oEYXrAheHC9E+597f1y6fpaW4MSM7fb5SkYFwZgVDbj?= =?us-ascii?Q?pG5HxijqOvYBn/zKF3rxe1Z4cpaDmj1YbFT45Pr6nxI1a8ApPUoR2EYHfolK?= =?us-ascii?Q?mOSGV0/opfmn1R6CK//tpGOjkhFaHE/ih0HV7nUo75Ot67TzJuQEzdA/s3HJ?= =?us-ascii?Q?vWgLoxEAxUBwwJ88iKofb2aFKNATG5YAs6bT1FEm?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8505183-3bfb-42cf-2784-08dcd213ea11 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:35.4207 (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: vKB/AfMEfvK0ms7zGAkZg0jKJkw1hU3vxiLKINQFZJ7YyBxpH0AwOTh73UNqSfrYpJH6r3eQSrvxtKp/BeGv7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" Expand the inline data read & fiemap to support inline tail. Signed-off-by: Wu Bo --- fs/f2fs/data.c | 31 ++++++++++++++++++++++++++++++- fs/f2fs/inline.c | 26 ++++++++++++-------------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index cd13b5703228..476325a26d4e 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1922,9 +1922,11 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_e= xtent_info *fieinfo, u64 logical =3D 0, phys =3D 0, size =3D 0; u32 flags =3D 0; int ret =3D 0; - bool compr_cluster =3D false, compr_appended; + bool compr_cluster =3D false, compr_appended, inline_tail =3D false; unsigned int cluster_size =3D F2FS_I(inode)->i_cluster_size; unsigned int count_in_cluster =3D 0; + loff_t i_size =3D i_size_read(inode); + pgoff_t end_index =3D i_size >> PAGE_SHIFT; loff_t maxbytes; =20 if (fieinfo->fi_flags & FIEMAP_FLAG_CACHE) { @@ -1983,6 +1985,16 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_e= xtent_info *fieinfo, =20 /* HOLE */ if (!compr_cluster && !(map.m_flags & F2FS_MAP_FLAGS)) { + /* + * There is a reserved space between address array and inline + * data. So it must meet this hole state before inline data. + */ + if (f2fs_has_inline_tail(inode) && start_blk =3D=3D end_index + && f2fs_exist_data(inode)) { + inline_tail =3D true; + goto fill_extent; + } + start_blk =3D next_pgofs; =20 if (blks_to_bytes(inode, start_blk) < blks_to_bytes(inode, @@ -2000,6 +2012,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_ex= tent_info *fieinfo, goto skip_fill; } =20 +fill_extent: if (size) { flags |=3D FIEMAP_EXTENT_MERGED; if (IS_ENCRYPTED(inode)) @@ -2013,6 +2026,13 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_e= xtent_info *fieinfo, size =3D 0; } =20 + if (inline_tail) { + start =3D blks_to_bytes(inode, start_blk); + ret =3D f2fs_inline_data_fiemap(inode, fieinfo, start, len); + if (ret !=3D -EAGAIN) + goto out; + } + if (start_blk > last_blk) goto out; =20 @@ -2377,6 +2397,8 @@ static int f2fs_mpage_readpages(struct inode *inode, #endif unsigned nr_pages =3D rac ? readahead_count(rac) : 1; unsigned max_nr_pages =3D nr_pages; + loff_t i_size =3D i_size_read(inode); + pgoff_t end_index =3D i_size >> PAGE_SHIFT; pgoff_t index; int ret =3D 0; =20 @@ -2397,6 +2419,12 @@ static int f2fs_mpage_readpages(struct inode *inode, =20 index =3D folio_index(folio); =20 + if (f2fs_has_inline_tail(inode) && index =3D=3D end_index && + f2fs_exist_data(inode)) { + ret =3D f2fs_read_inline_data(inode, folio); + goto out; + } + #ifdef CONFIG_F2FS_FS_COMPRESSION if (!f2fs_compressed_file(inode)) goto read_single_page; @@ -2462,6 +2490,7 @@ static int f2fs_mpage_readpages(struct inode *inode, } #endif } +out: if (bio) f2fs_submit_read_bio(F2FS_I_SB(inode), bio, DATA); return ret; diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 2e63e9389fd7..30b18053e784 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -86,8 +86,6 @@ void f2fs_do_read_inline_data(struct folio *folio, struct= page *ipage) if (folio_test_uptodate(folio)) return; =20 - f2fs_bug_on(F2FS_I_SB(inode), folio_index(folio)); - folio_zero_segment(folio, MAX_INLINE_DATA(inode), folio_size(folio)); =20 /* Copy the whole inline data block */ @@ -126,15 +124,12 @@ int f2fs_read_inline_data(struct inode *inode, struct= folio *folio) return PTR_ERR(ipage); } =20 - if (!f2fs_has_inline_data(inode)) { + if (!f2fs_has_inline_data(inode) && !f2fs_has_inline_tail(inode)) { f2fs_put_page(ipage, 1); return -EAGAIN; } =20 - if (folio_index(folio)) - folio_zero_segment(folio, 0, folio_size(folio)); - else - f2fs_do_read_inline_data(folio, ipage); + f2fs_do_read_inline_data(folio, ipage); =20 if (!folio_test_uptodate(folio)) folio_mark_uptodate(folio); @@ -814,7 +809,7 @@ int f2fs_read_inline_dir(struct file *file, struct dir_= context *ctx, int f2fs_inline_data_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, __u64 start, __u64 len) { - __u64 byteaddr, ilen; + __u64 byteaddr, ilen, offset; __u32 flags =3D FIEMAP_EXTENT_DATA_INLINE | FIEMAP_EXTENT_NOT_ALIGNED | FIEMAP_EXTENT_LAST; struct node_info ni; @@ -826,7 +821,8 @@ int f2fs_inline_data_fiemap(struct inode *inode, return PTR_ERR(ipage); =20 if ((S_ISREG(inode->i_mode) || S_ISLNK(inode->i_mode)) && - !f2fs_has_inline_data(inode)) { + !f2fs_has_inline_data(inode) && + !f2fs_has_inline_tail(inode)) { err =3D -EAGAIN; goto out; } @@ -836,12 +832,14 @@ int f2fs_inline_data_fiemap(struct inode *inode, goto out; } =20 - ilen =3D min_t(size_t, MAX_INLINE_DATA(inode), i_size_read(inode)); - if (start >=3D ilen) + ilen =3D min_t(size_t, MAX_INLINE_DATA(inode), + i_size_read(inode) & (PAGE_SIZE - 1)); + offset =3D start & (PAGE_SIZE - 1); + if (offset >=3D ilen) goto out; - if (start + len < ilen) - ilen =3D start + len; - ilen -=3D start; + if (offset + len < ilen) + ilen =3D offset + len; + ilen -=3D offset; =20 err =3D f2fs_get_node_info(F2FS_I_SB(inode), inode->i_ino, &ni, false); if (err) --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 3933C537FF for ; Wed, 11 Sep 2024 03:43:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026226; cv=fail; b=DLi7j/FijAzZyB8emuqTrk/YiG4vYHLuN77tQVRK1Ewx5FzFljVpbyAUGuO8Z25ddumuYiRMzPoes97UqBeeYUpWHOpCvWcX5GZh1TFfMZclyl7vXytPFRcRvbxCOqLvCjgMKXyF/UQeKgjPESvJiCuy4w0yTtJ5dN/6XbeTCWQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026226; c=relaxed/simple; bh=agO1Rb74i4OvDmvXU+pDaUtVqpsLdZL1l/pTKIAEOUE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=leTcXuZ4mVfpUZLl2kHZJVecXguo43Rkf4QPJ6REmSI2xSqOd5GVsXdf50zx8Mo/sL/OcWoLF9NpABxhfmNV16RqeIon1zDBuONWRLIi9h+nt4EHil5fqaVj9Z/51E/lj7pfEDoDwsPYGiJZm73s+7vKxk3tbQ+YqlVFmx0NNIs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=ElXpdf2q; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="ElXpdf2q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KkXUr5JZ40fqmYE8eKLujKKIkO3IKSaXLUV7Fdl4EZgCQD8677bp87B+/Zfy0GjFtL4UzpePuZYJ/PXSpYoU2GK5ZKoJm+VHUvBSXWniEeIntQbpe6eGm7bpFBTy7hZyQBUNH9FVEAjBrT7EhXWhH/IvB9XsL8YjnBYuAXfmV6xHZ0GQnSeq5DxxlmBXpgAFiymjBvt+A996hNqTzx/Wi867t7MpJ9KJdrOj8qe24lS0suvkop+S6ev1E+CousDPZVYCZwy2cMZlX4Zy5jm1xTS1cvFJZm1DsmNIgpOrRhdxbqDw5WpDpKxA/55aAT0t35E8CH+NSjBj6mqPk7GjOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=jLg/Ort+dktxydWc7L68s9DMFyaM5EKCxEMzSwa7J1A=; b=ATGncO+MZLvTtYeMpdUM95eKZdiWAS4dM7Qif44GQ4wPPPsJjdLmQNHFiKsBASMWs0XkY4OT5yVnVKsT6Cn7wqPKWTfnWUZFIUxI8NHND8f2ONN/KODttJGnKXXSfn4XGpriwQf6klaDimVzJL+/rfYAehAWzkYMUP1UFmIePmdscthAdCTYBmmzg99wyshJ3NzQGsxzWWLMaRfUCr4YBsgCyEOulQBVbC2VyvYK5JcQbtWjX4ll1ZXsLG2gqp7GM68xzqBI/ma9CLPrA0brNmtwRZSjsFM4pGUjJuJW/YzbB1gdNAO+hGi3TMdXfW3FwuYqFSe3ERB5DezRMGWCSg== 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=jLg/Ort+dktxydWc7L68s9DMFyaM5EKCxEMzSwa7J1A=; b=ElXpdf2qfniOjLsVIzBi8/OjPI0CtdN6oj+1u2zHCvyrmpad6zuwC3JG23+148/hVT3klqLRa8aBG3bitFJB6DVtBDUOvT6YUb6kr3H7iAYIKf/SjAW4TJiZGbhBwy4FhOS1KRHOxBQsj5YcBjzKTpjHqIcDyQq4BAnlGbHEDLbRWljqDTYLq+Qd81w3DU+DIGnf4JUgB90zGlI7PvZZTcU+kEGhTbejChBB3TGce68Y0tA/IBLcNsL9guQreHPBdRlE8gab66Jed86t6hLkvWIFLgrWILalU3QEa+RmcTEGmmWORQn5zE1siJDqTXyEb7CXq4XTYRHon9WrejSAhw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:37 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:36 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 05/13] f2fs: set inline tail flag when create inode Date: Tue, 10 Sep 2024 21:57:18 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: 499f8947-8bf8-4f2f-9f90-08dcd213eae9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?4GBQhh3IUQW3QPpzeQg1K4cCUGz60lqF7iaZv3IONWo23O55KZCi8tEAHFsK?= =?us-ascii?Q?W+7Enw6AWa83DEljvA1tzRfXLNJt32Lo09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xGRK/IelxcLq0ePTOjbtrcwA9cYDjECPUtYBFxcRBEqBFGbisJ6qfS5SHM1?= =?us-ascii?Q?df1N04hHywG9FVtJ1FeO/cfiaQ2HIH/mecvXqjkAdKyj01SMAFMiaiZH0tXi?= =?us-ascii?Q?wSxbPE/a4Yg9k3s5A72P9ygJQdiMq4tWlfiXeqRRFOCQJ1RBDffc94s5BNf0?= =?us-ascii?Q?MlBYGqpgh+3cekW5TgAWiF+uD7v0UprdjoZ1nQZsFP+5Fp6IhkUIIRxaGcDw?= =?us-ascii?Q?TDcd+lozFV20TlSCnasSGWG3uUQ0Og7PtbCsDLIvAyG//jG00SCJYbv0v0Tg?= =?us-ascii?Q?hU8pTtXSxunRr+XEiEW0uLSRy1JHaaC6L0p6Bj9Apq2x0FcQ4XQsQFFcKP34?= =?us-ascii?Q?Gt8AxykIlt1xsiKAQRPoN4xLYhquE8mVgXa6MzJOMWkxR1mB+mX5MUXHS5Jo?= =?us-ascii?Q?kAFoEuym5WQ+E+IEy1BkDJTaX+FUoc29FQaVj99Yb24I4W46UA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?eFZyXr2+hzrdK1a8LOMrW4h4QGiNBSJ/pL4ZN2E2rvkI3c+auKWaNoM5HhOh?= =?us-ascii?Q?vibTGFhorXMZLZqqPZQVs3ev4suIikZnxKWEqLDw/WQGA9eH5MWOzqwku6dv?= =?us-ascii?Q?gHkdIBWjHZbhUFtHUDrjkc19zCStIutEIuxHi3sFN71D2D2u7Z6hUZxnAVvk?= =?us-ascii?Q?sizwfVxoYevtH6S8YtWVkJyl/pIW9IqgD09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ii?Q?CDSs4gzW9xwZMonFZNz0rsiYBKIlzvqBRaw46uapQRGA5nIWm7TeIb1XhT42?= =?us-ascii?Q?kez2PWIzKoqnwsEUs3vj8rbDTHsi4kp+mRL4C0vT5gJkQ7KVGJ4WpXWyiMni?= =?us-ascii?Q?crcPCi11pXF7izOYlwj6STJIPPsIeZwMNCszomiNhetzbEZvEqB8GhG2xUa0?= =?us-ascii?Q?akMfwTYKfpbpp/5vYEuj1PkuFAdkB5PwrXGrobksm0ZXRm9bpBy9Yu/V53QW?= =?us-ascii?Q?MSLjvkExAgdKs6d5jB37q7ulPuO9oe6tvObAVgomdrIHdbJ16rf8kxuzFiwb?= =?us-ascii?Q?XFfGziCYZ8wutbQ2Sb9vwrQuEZeKt5vVpZyJx6fjVqqinlCoAGShNB8C7OGV?= =?us-ascii?Q?P2ScJ9EHSwtQpQ7bPOcJmNpvsX0H+nHBpZ2rU9x8b+oF4Cc6YGFmyDEQcm3j?= =?us-ascii?Q?38XS4DqCkd2YeecF+IuaUgN328lUv/X2mw+L/a5ap41OwbPi5ArIiBVEJGX9?= =?us-ascii?Q?OY9T+M5HiGn6e3ieVa0m3L7MT0JHH2jaJgAD26PD?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 499f8947-8bf8-4f2f-9f90-08dcd213eae9 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:36.9109 (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: dcRw1Fp9fef4gPTMMV8ksmir0rDm09PIrO8Sx5hbHsF5NXxiGeey9nB7/6kjtS08+LJ8kknYrNX+fyDq6DMbgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" Set inline tail flag to enable this feature when new inode is created. Inherit the conditions from inline data. Signed-off-by: Wu Bo --- fs/f2fs/namei.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 38b4750475db..13c295ea19de 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -315,6 +315,9 @@ static struct inode *f2fs_new_inode(struct mnt_idmap *i= dmap, /* Should enable inline_data after compression set */ if (test_opt(sbi, INLINE_DATA) && f2fs_may_inline_data(inode)) set_inode_flag(inode, FI_INLINE_DATA); + /* Inherit the conditions from inline data */ + if (test_opt(sbi, INLINE_TAIL) && f2fs_has_inline_data(inode)) + set_inode_flag(inode, FI_INLINE_TAIL); =20 if (name && !test_opt(sbi, DISABLE_EXT_IDENTIFY)) set_file_temperature(sbi, inode, name); --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from HK2PR02CU002.outbound.protection.outlook.com (mail-eastasiaazon11010025.outbound.protection.outlook.com [52.101.128.25]) (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 8D5265103F for ; Wed, 11 Sep 2024 03:43:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.128.25 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026226; cv=fail; b=iEGfgIlHFbfkU9697mZp0BNdKxudvWojGCePmwNU2mcWSvaxAZ7IUG+B1jNDVU/6mvveKlmYnGQ6ICNZ35f49U+/14PSIWV204BxqddWsfPEQ4s9VuTqZP/fPvkCWLo88x+oLfjH1vYYrIIZNc/FZoiDNMT8U/4nk3qLVWzoegY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026226; c=relaxed/simple; bh=oTvnXGPqFYJXJb5D0FNjKJpM8OsIgxPtdmVwomCHj4g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tnOu4mbpabyM0c+pCyINpvJDFn2pBqoZPXAuIsekZ+P/JIWQGDMtAJi9eqCqWbAqR7gffzVw42CV1ZsarQ96JFfmQsnj/Eq5kvG5SNjyn5fur6VmCIk0Ul85gu+BCZ9lyCjY4qB5ddwVCi1WEToXjKAjwQgBvDus2WpHP+K3Xfc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=l5EZKd3S; arc=fail smtp.client-ip=52.101.128.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="l5EZKd3S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UKFd2xQb0uFC4XCebKag1HWrtH/MS1M0YKtCcu5ZTLxkY4bOqhG+4m6N8sYn+L2Oc9qNgBIy06vooeBewIB+T+IDeO7lAoo/BvG0Yckd6X/t5oQ3kX/d0wvkLNH+XHq2i9pFsj1i8MD4eR8VwGTAb6d98734bLDeeW/kdY6TlfxpX8d0OMy8ZA0hsgprYaqiqs2f2nZLDxLnvAxEuUAuRzux3ZIhHhEvPAS+vkcPXn3a97IJuA9G71hO+t7pAmA94RDCuspGtcSe9Ee6nKzBte+TgZXJARRsg807ME+HbkAEY02aGzAscd/GT9cpYe0ELvy+PXYgICaTFLM349iDng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=cbAYiYW42KdJTqSuWfOstLknlNwHmM+iHowcLx3rDog=; b=bW/13Oves28hopFYbIt0mlCOX5snALHYzkxLGUY25BjSRjQ5AzHbHiLHfWHsJLFnLt7+cdn1YBAMdnbHSexS1AJ7LgTM/aQKb3gN6na5OWZcsJvLXB3tSj486rhTbgP5CuJltI1E64r7gYjl3cRkBp1Ca1AY0fmb9+33aOwBSY4dUjYwJWLpSusnnXYpFtcAp3IA+6Kx/HldrNbXzYU/fLg/VmBPEMkNpdjbV9mBc9Lwu7s7PKAsu6J5FF7O8JgBtHE7gyjoFb9ai3z+5L4oGG3/8veGfWCc5HB8sqYSq0gQ4z1ce/jYKNocYi2S/dQlKgW8umrnD6eXKsQYD95rug== 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=cbAYiYW42KdJTqSuWfOstLknlNwHmM+iHowcLx3rDog=; b=l5EZKd3Sy2mFzy9nomCTuO+qjzHqSJzpEDFZcfj3IreFYnYnNFICaDEOU/D+d31Bmsp/efLo0Iu6s4NsaKB4MjZMjCYMCd8iX8qdDz9GeEmspmT/VWjjDy/K17p4yLZVUDgzlTy2NtfSEDKrbb40rx4H3LB61W78dENtQBoHkNOmVJoZqbTYxhSmlnSz2Hoz/07i9SuxA2qNVWzx0MdRfQZ48z9JnF3Kn8/Autm2QJtG9u7dh1cIEZVPgXraOrbircqmgdaITSIMnmURXRDBT0yIGRFtk11N8auxR5cY/qTV7Luzv+tH21Si68re152GuQMDdCrFdcviAvTgO0twGg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by SEYPR06MB6279.apcprd06.prod.outlook.com (2603:1096:101:139::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:38 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:38 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 06/13] f2fs: fix address info has been truncated Date: Tue, 10 Sep 2024 21:57:19 -0600 Message-Id: <99802996a3f4a0c2d89c79ec17be94e9c62ff8b6.1726024116.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|SEYPR06MB6279:EE_ X-MS-Office365-Filtering-Correlation-Id: 8877363b-55bb-46f6-4eda-08dcd213ebd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?hcWEKG+sf+SSOdmiaWDM4zadxCoQj//++JBjoB2BLwf56hbb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BebIkqBYAQzINiYPC75ZH7JmdnCIRkd9R89AJkZFV5vgdPxHFxiFve4bDr8d?= =?us-ascii?Q?M/guklq88gwlRkyDPV27MLA4o+FqDeAbIO0/aGlIzy8Rt8aI24NPwjTtR6PR?= =?us-ascii?Q?Usdf3yuzi2qVNfhPJMb/yo8oBlGF3lvDiRZswdxCWenKcQusJ+lF0veJ+QDE?= =?us-ascii?Q?Yl+izka19Ub55pSRUMW5yU6eSveNMIKJBdxoRS6SmMlCTFnTwt1kjVl5JrEX?= =?us-ascii?Q?Pt1EzlbZjTPaybnq6XB/HWAKfyITxeWhc3ht+TBnEl8XlWivCjo4c8L5+2YI?= =?us-ascii?Q?yiukyEyVRjJfV7IgxcCPeBbYorejxxyOYSEIIFoqhvfQfRtOc22zl6Bxkpsf?= =?us-ascii?Q?64AyMs5Ev9UIkA0TbR+Cd+mgTHIR9FGW3W9c3oLnLx/a9yduevhCS+Zq7kD9?= =?us-ascii?Q?xUO6RIl6tgP9MUJIC3gr7cz61H0DQNne78PBjW8AfR0JLXD3+mnGcHgYF9+N?= =?us-ascii?Q?fBF67LcB/aXlWWfxjOPfyAORpr0TQbSOWkU4zT2GbSlXRQhiUQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?szMCZhptJGqDzQWHTnXmAOXTWGhTWWfP0SfJD7ZIi+jPYc/qHsGu+gPtrCyK?= =?us-ascii?Q?LDJwViIIK/e4pXA0VljTxLCMrD757LKQQlGoZr0me8iL/Ov67CD+XT6U2Bfa?= =?us-ascii?Q?BUDZUGktJTqWK6X5Av2DeZCLejtCS7H9A7Ra5I2ro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K5Kb+W4WWM9Um4jA4VC1hXePKuQ5EtQfcE0D0A0V4+Lp?= =?us-ascii?Q?cM6i3jHtV7MbW2cQdMCUSV8p3soeIOH83w4Dr9GBH3S23gH8nUbvW1fqPw+Q?= =?us-ascii?Q?jGgEALT1JPOFBhJx4UcOSXKuF3OwI4qEpOQeW+OkGo5/suw9Tui00k9kpWTF?= =?us-ascii?Q?nQpV3ZEbqzWTUG4C4nt9pqQ87utlK3EJ4mrbldKMbgyf0sQCa3ckHD8glQs3?= =?us-ascii?Q?Y7N+SQkavm3gowyMMbFeM1GbLvzG3U5SI1VwXgLroZhLl9Jg7aMZizFyE6iV?= =?us-ascii?Q?XR9/5d8DFwJuiIQN2jrB5rx7O2dITet5gAqJx6laPYzd4E46YzYtpWeYptBb?= =?us-ascii?Q?aHo/+7H6d07BSFHa7/jejmG9K004f+zoekS83L35RSwS8QRzS6xxau8Q3+zp?= =?us-ascii?Q?UYoc+Is1F7HxC3K63x6GS0EswxotWSkYDnk6uDmll6cVGxpjN6xyv7ORs6Vw?= =?us-ascii?Q?JHHMhbrYtKHMEWGrHJK0ggUTo5n4tN19EWBFpcoTxe7ItrpFDEoSDJveUXh7?= =?us-ascii?Q?OQpHbCgf6TIUS+hafrr3A6EDolRXF8g6hbArLL8B?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8877363b-55bb-46f6-4eda-08dcd213ebd5 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:38.4854 (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: AKc+COEImFD3s8NOJ3YRALLS5NvAKl49DZYargA3O1j2XslPXSdr8FhdVN3bhXImpgsqi+JHD/yVKA8mRYCBYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6279 Content-Type: text/plain; charset="utf-8" If there is no data inline, the address table should not be truncate, in case there may be reserved address info. Signed-off-by: Wu Bo --- fs/f2fs/inline.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 30b18053e784..a542956d618a 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -224,7 +224,8 @@ int f2fs_clear_inline_tail(struct inode *inode, bool fo= rce) if (IS_ERR(ipage)) return PTR_ERR(ipage); =20 - f2fs_truncate_inline_inode(inode, ipage, 0); + if (f2fs_exist_data(inode)) + f2fs_truncate_inline_inode(inode, ipage, 0); clear_page_private_inline(ipage); =20 if (force || end_index >=3D COMPACT_ADDRS_PER_INODE) --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 31B1057CB6 for ; Wed, 11 Sep 2024 03:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026228; cv=fail; b=TFUnXlyScGyLTA6x8Lp3e0LYC/7rsROKU1PpSFycLO/VH0UJGslVa6AM1C9GrJuRcfPlvWl4ESskUQVTzyny3h6Lq0X+jQVFG8E37d7PrHyjZEbQPDbh0SGSNJ0m9N1DVvQBKLy+y0DaL51JkGUlXxqzFpGjcgr8TfMT8H1eRq8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026228; c=relaxed/simple; bh=YO5xm9kM+JUxiVSOy2b2HtbKh1mAEMmvzlAM3XbWudE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Ecvr2UuueGbgIcbe9ZzEX7/yq4hc87NXjwgNQBNr3/lkNZ8KbmGCWHAIHb/v2Ip6qr7GSMS7bOkP4BBuudU0SEatZ6QgmgzbOdkvqGw9bxODZ3DraB2iP6PSApYUHEEyMgG7OOYSvM/ykliGVc7YvygaxyIEDOXM6M2KZB10mjs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=iEJ2EqAI; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="iEJ2EqAI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aIxkpg+YhJm6uvIQ+QnU8vjzAsnBgTYDMX6d4BXI8NN2RrKU4CY5qZ3JGH4A7u4FDfggS3xdTtJU9BEadgjkpFX0tjfH7/qQQjDFlPctXYMcf5HdeNElcYX/+R1Uvuz4eUhEifbtK1cMHtswZN4FWMIQYNMvyVQJkhWUYhuNkcNAo298YvGBOK+8IUDi9xkvmKE35F9eSEfiem6fHpi/JHlBiTIx/wJQ3PS0eqi9QB4PZY+mYUJ42exCMCB+T+HWu5URlzNS+oXJ//qMs9owzNnjHjA6YRGKrjnhUThwbFYZw3QjWSRIa26SMUBhxFtadr2J+3ew4JHdK2Mc0WwZzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=zpt7hATAjsNzxEZ1b9rWksG+1m8LwfMM2LU47Jz15y0=; b=JiyVneVtbne/KCJpYar4AixLMzGeLxLl96PAarDo2JjVNj/qHvXNgd++Zlkf+0JQSxZ4tjXJFy75qlF9nxEYnvvc2voRWlFwySpQ7ulZ5874Oy51MjiGcSzbVkIa93Sk01stVhk/kaFVM+bQ6S+vhQkfrkisegTqPj/MIH2RFUThWSiAeAz+1LdMPC6k7MpY/IBDhppJMhMHcD971r7FsRyouKtoKTPdhTHpJ24RtBqpQDTo21yuUdPCIhAqPijRnORuYKQ+remxdNiscvi5bOya6xcF0O0Ym1WOLvzQswYBapvFo9vJ9d01WDPnBCohoZIWMaenO80Pg+2S0HL6nA== 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=zpt7hATAjsNzxEZ1b9rWksG+1m8LwfMM2LU47Jz15y0=; b=iEJ2EqAIe8ROgadflNx2K4Ge2OxaCb1Vuhk9X8BFd1JGW6UetDyPY8pvKpkjwExFAJGPxcEA2zwu+YKwg5fw+8pkBt9sbbOPooI8qkmuX2XYX9+Oy4DZTdv7Gawimb/AyTE5yjEgv6z4wPDUTzDMQljBtzrcBAFmWsbHkbc8w/DC+Isiy9ezqkxrYWm15vB+0WswgGUpU/hjR7KlXn5L0kRk55iDbuK0qvPhqgz1lQyjQGXCfU4bQ3w7lcAsn4Q/+ecgnOhfbnsVx9jyTB6cg53JUQWjl3c4RmU4iRdzOTlsChL5cFTsrNX2NDmDXlxQQy7PqRI+A1q8iCVUeGtC6g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:40 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:40 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 07/13] f2fs: support seek for inline tail Date: Tue, 10 Sep 2024 21:57:20 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: e3acec04-7dd7-48a3-0c64-08dcd213ecc5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?YquSbgijNL6ZGSUMgB1ft10kpSyyhbzQo82voq35V1jENQPX0JYpTpo23Tmz?= =?us-ascii?Q?1J/3B7lUZhPRsPersbBhYMip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PIRaE?= =?us-ascii?Q?8oaO2k29n1d1Supg96LVM5ML1grnAsukIwb8u90dVUSBC8gRRwk6QrXKl1GB?= =?us-ascii?Q?ccxFWA8MG+jl8T6ElJQR3r795d83Yv1E21JwC9MtUr+pdjF+DPms/04jCWnb?= =?us-ascii?Q?Zc3sl6VuJhqKmcGi3Th8J4vsxHIQOcNjwnozmUE6gTsa0nrRUotzJPxQGTvr?= =?us-ascii?Q?iOqo5kl91MGc9Y83VKm3z9hfM9j2WdeMegDUPp0UaBDHM+MO86RIrKYdxGgY?= =?us-ascii?Q?ShpvzGgxLnaqRlq2cvULVIysKrnL9Rf2YeJJ2Z4RjPfg5JoOGsMZeeshZkla?= =?us-ascii?Q?JGHQYf6DXE2p98RSq5JPumb9dIXjt3W59wIadp0R+Eb4+n68TGpNlI0EsnqL?= =?us-ascii?Q?QX2UoIUSRKze3s0ySrhICvuMjdFHFcVSnTYd7N2WPMgGmuvNnKGx66feyH8f?= =?us-ascii?Q?yPu547ecd/JVCYiQnH7TI2U4XQs8m56TQysVlWew2u02pnaHiw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?PyE0ylNESw7V3dgni1J8WSSyCv9wBTB+jaDiWVav2hT9YKv+zGAdLTVMFpjG?= =?us-ascii?Q?dpItUgTDW1rUnyS0EVc21/jWwqxDwVzsHYisDA4cqA4Z5l42gXrbh0VR2TNa?= =?us-ascii?Q?hYYHWYCM4ARXCWSE1+fRMp9t2po3bXNAHQPjssQgv/o3ovzs100ThLYJSVBW?= =?us-ascii?Q?f6BCwQ13V332qRUVAfWf/0Zirp2ZHEvu2Ai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GAJe4+N6eVnE/gpqpMaXCxt3/ubhek4vfZGGqSTXQJMW5Qr1cX8zTUS0U5?= =?us-ascii?Q?AsKgIKuqQmvMMcCxzC2oIbZVsw5t6erWrd6wkJ8DiF124yO/Izwi2op819yn?= =?us-ascii?Q?tOB++0b5c5ea52W16i5OBWCDJayqSimnDKN7k+DLBDjnpSfwcwP/vXdhiTiV?= =?us-ascii?Q?kvehzbmjuvGTTVpboUyyHDiAIaQsjO4nyBovMHE5a1tAfoVKyAuKvSK0xjeR?= =?us-ascii?Q?oXIdzQdH1Y0xOhlCaArkdzBOsC3ywDeW2g7fPBSL4Q4ced+phDrjKElAcLWC?= =?us-ascii?Q?NZ7G6FwDZhyU0472jbzCVXiFimbSoO/DkpyygYjYPWUR63+hCMVv7nYL7KTq?= =?us-ascii?Q?lUokMILzGX+XzrW7huAZ/CwBHDEW9lYkarWdNMPIOvsq5AteRfw2VZOaQWLs?= =?us-ascii?Q?Z/X/FgQspJlZe2ItHxUMZirj5s9mi0EYSyy8+DOfIw6vwgf/LovmbguqRL7D?= =?us-ascii?Q?9l/cgWSU1gBlfjTGACDHFVLuyWq0OhJn4HztpuOz?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3acec04-7dd7-48a3-0c64-08dcd213ecc5 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:39.9833 (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: pPnfvxbyiQsDKuCHh2ET1gtYeGOGcb7yEZyocXB0suH/DOyWMvKe3x1AAkay+4xsIIWhDYw3NzYbD3mOfgQ9SA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" Fix to support seek for inline tail files Signed-off-by: Wu Bo --- fs/f2fs/file.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 957d1ff55350..dda4cf6d7325 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -400,6 +400,7 @@ static bool __found_offset(struct address_space *mappin= g, block_t blkaddr =3D f2fs_data_blkaddr(dn); struct inode *inode =3D mapping->host; bool compressed_cluster =3D false; + bool inline_tail =3D false; =20 if (f2fs_compressed_file(inode)) { block_t first_blkaddr =3D data_blkaddr(dn->inode, dn->node_page, @@ -408,6 +409,14 @@ static bool __found_offset(struct address_space *mappi= ng, compressed_cluster =3D first_blkaddr =3D=3D COMPRESS_ADDR; } =20 + if (f2fs_has_inline_tail(inode)) { + loff_t isize =3D i_size_read(inode); + if ((isize >> PAGE_SHIFT =3D=3D index) && + (f2fs_exist_data(inode) || + xa_get_mark(&mapping->i_pages, index, PAGECACHE_TAG_DIRTY))) + inline_tail =3D true; + } + switch (whence) { case SEEK_DATA: if (__is_valid_data_blkaddr(blkaddr)) @@ -417,11 +426,13 @@ static bool __found_offset(struct address_space *mapp= ing, return true; if (compressed_cluster) return true; + if (inline_tail) + return true; break; case SEEK_HOLE: if (compressed_cluster) return false; - if (blkaddr =3D=3D NULL_ADDR) + if (blkaddr =3D=3D NULL_ADDR && !inline_tail) return true; break; } @@ -473,6 +484,8 @@ static loff_t f2fs_seek_block(struct file *file, loff_t= offset, int whence) } =20 end_offset =3D ADDRS_PER_PAGE(dn.node_page, inode); + if (f2fs_has_inline_tail(inode)) + end_offset =3D COMPACT_ADDRS_PER_INODE + 1; =20 /* find data/hole in dnode block */ for (; dn.ofs_in_node < end_offset; @@ -496,6 +509,8 @@ static loff_t f2fs_seek_block(struct file *file, loff_t= offset, int whence) } } f2fs_put_dnode(&dn); + if (f2fs_has_inline_tail(inode) && dn.ofs_in_node =3D=3D end_offset) + goto fail; } =20 if (whence =3D=3D SEEK_DATA) --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 C0AB9762D0 for ; Wed, 11 Sep 2024 03:43:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026231; cv=fail; b=ndMbu01o9nFonVXqd9QirKEDt+Ipli58yyQjj5Sfe4W3viBs9HYqgFg6tiA+0Rq9uqowduiAalCev+FUhzHcK0FzPbbZWoljg3PzM/oUY62v/4mNbU7qVG15D5IKYNO/TVyB4X5EVOueZOciZiND2cdaV2LB+S4XjCxzqxYhv+8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026231; c=relaxed/simple; bh=tnf5mh86XJOhc+975RDF/yS5Hklli5aFjBNq8OvyqEg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UMhT62H6NYOIKFPMqvjJH2n4CPocAGsl347WVzHyx9EUM7MH+1t5ZgdJQ817XV+gGJwiZRx81n0as38A3IDSWqb/Z7As8AR1AhO61mfnt3Q+oY21CXY64XellPn1+0vHobKyIkomlOM8T4XBHiUtVu2nkLq8+5sLCUhoeFswPi0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=HJMvMhnV; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="HJMvMhnV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Bb604e/HCP2A0241uBi7vgZbUy+L3KgOqDNgrzmNNFAKSziM7EFvlc7osCDNcb61plO1ushcuOC8mIvRwezdzGsNzEN/uWVogRzh83RnILImP1XsQWasS/3iaILgX3oASZqur4OCeVuXE2yXhEfvkwjv6p/Lz+Avo5SNh2lRfhy6aDayPFsWfrQr68JcyA2ScGyJS4bEk3mzHdWf7NgsjFw6/OjU8X1hMLJ2dm4oi0aU2vf6vd1QpDGpXGIKFGmoucoWm3x2BbxG6WCFMdT5LSNfqYslsQdyJ/n00s+aGxqlQsoMQKZN5r8ypxDg0gUneVYsBgnB5izBqJW/aNgiBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=7CC/3LcYA72yvGa3hWCirw1THavdhx+JFL9Z/mwmypc=; b=yg6D2uEjzaUicNL3ajjSKMypQWH8IOT/X7XeKti0UOauHjzcTWsIe0/cTXJEzDYr/HHGvtVs8p4mPmMaF6P3AuPhwqeVvjgwFF9eJonp5FtK+m66dvgAvx7ydMEd07zkiHlO+G7x04VIpgwKG1jnNlSwV4DY7uNpkfyFjVWPYiZJ1Qy4oaCmV9t1MmBmvD7zvbpdNfTrkxsDrlH9LZOteHMrkDCz5NsQQhG6FlkUN9grxldiPV0ezCGMwZp5gVa04OGC6L43xgJhKTRj59cnJCnEQZMrYlyUin9eoUX+/165zr3Ybruvb0aKqagj61zZYdx0QCmnTF28m3VRVutqiQ== 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=7CC/3LcYA72yvGa3hWCirw1THavdhx+JFL9Z/mwmypc=; b=HJMvMhnVK5DpkjvquZ9FU8LEHEj6Hpk430oIXvtCMi0SrQtL3ofiK/bv5rsPNTlMe8IrTmwkhdxYi8BXjjbaCE8u+7pExnS4UtSjWLknVLuX7hkfLSyEjE0S8my5nwzPnhvsGJM1K/43wOVGNFJ1+aujyFi2G0W3VByWKzyaaem5UlpK65GPK36uuP0vKgQHDsyIjjXW5FOSy2lubO3uhhBplElkAMvK3PaenBd4QZKTbrolEKlBufvN0CE2nNsOiqwVaqVLYgY7BijTMAnwPxGJWCYZ22uBfRdJ0jUyiW4hD7jEe8XlZ6Gq6oyCNWA7np7WEdVCX+QGbBD6cilbzw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:41 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:41 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 08/13] f2fs: convert inline tail when inode expand Date: Tue, 10 Sep 2024 21:57:21 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: 180713e2-3807-4357-26a1-08dcd213eda7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ysDu6CASKiRbXh/vjtXmIva45wHbpTNhUKjtMnYCrrMBOW5FQU7PCySt7DNL?= =?us-ascii?Q?AJ+NEQQOVzMJ/bWPWdxcVt2K9RYkZsLTRMVPGnft1woLtO78FD0Tq/6uD6q1?= =?us-ascii?Q?x/OMp/jsuEQYeR2XMJmz1Cj0c016YS6tHNKm0HyAc/R9FFzd6TrbqyitPF1k?= =?us-ascii?Q?MJTCEQFBFmaWDbPdcoq4TUWX0jggrUvEYpKJn7abQcEdLQOgSGts+7GO3qTC?= =?us-ascii?Q?ToJhoO3Kv65ezCvnCuW9+p7O2QTYFLiCTLhRiw0w2Rr0qQnfgsnLIy+2P5j3?= =?us-ascii?Q?lzFYhedqut/MyzWfQDz0z4mo0UVm/JeKlba2k7HY2ZHiJJs5v/eXTwldDZAQ?= =?us-ascii?Q?yVHqaiT+ERSxJED3NN1Jl6ILbgER9ijRXOiruO5Gp4BVb2SiPSSeis0Cl8t0?= =?us-ascii?Q?cqX8nhC3Mw2UjRck/RNjGR74NGoWeqbj75oq4W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EfLE1+5JFmhcTqXYGYborFt/4KhYAqqDoN3DcbzTeFzZsN?= =?us-ascii?Q?ZsbVJOAXXQpwBqzFEIJKhpjrOJxdBho6FWTRm9DxS9ciSpc1Iw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?jl7YkasFoSVt55z+9bIPnPY02fGVpOa2BRFU4+p0f/bXvYjUqDst67/DnmX3?= =?us-ascii?Q?0d0jxupgsLXOyiJC2OrL4CuThK1afLlTPy6UHYqONJc10+88RUkjnlfWseWW?= =?us-ascii?Q?4Lvzyl2C6EGcfumRmr6XiJVH+/fTV9q176dSNkKSKb6E3fn7W1VJGrxxfa6p?= =?us-ascii?Q?6Io/c+HHH2VUdw7G4F+e7800mJUmDBnHeDwhF7ULsmqPuHAwcv8gZKHR4xjf?= =?us-ascii?Q?76aUsPqfyTmv1sBnJWS4L44PCLTy+HFEb15M224CohPwyfGw/R4RmfyqOGNh?= =?us-ascii?Q?HddL9SM7OGSsBUsyNfoxj65n828lXrHlnYqOSiKUaVAKBDZu6z0EjCiDZyKF?= =?us-ascii?Q?BCsuvZ5ndpVdaWzyL3mLsFAWja4rX+HLjtWxA/IUPIBIK1eLgxlrBV4lZT3A?= =?us-ascii?Q?h/SvP5iJ6uZ0BNtDA5aPAqLtsNTy7s8Ym52sr40U8Ll0uM8Aew08aNzYwzzT?= =?us-ascii?Q?LKDCSJc5HGEROq4jxThof7ZxI4FLpbutmJFyCMR3UiQ4/G23lIvTfx0ci6Ox?= =?us-ascii?Q?vfvTcHEeCkN1+lhsYFCxa+95jeMhystjHJ77drSIH4Y9u/L+9Q10Z0Tw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yORkLnvtfg4eApYMAVkljYxdgnTz1U?= =?us-ascii?Q?rkwv/RfhVeTLONDZ2nSGq5+T4DR3pmkYwYQXRu5L8wJaWyqICbJjtHZyEdlh?= =?us-ascii?Q?M3ppUug4Y670CUuhYypRQafoH3xlj6/HwkOqS2w9?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 180713e2-3807-4357-26a1-08dcd213eda7 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:41.4486 (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: IApWSvIWda4shYiP9n1QQNkbZAGzdS1DenEDuqB1ucax4dnG9cctm61N9Qv9iioBV3XRVIc1SHYABlHfvGu4yA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" Convert an inline tail file to a normal file when the inode expansion exceeds the maximum size allowed for the inline tail. Signed-off-by: Wu Bo --- fs/f2fs/f2fs.h | 1 + fs/f2fs/file.c | 6 ++++++ fs/f2fs/inline.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 2e0530b55e74..f889d97209c7 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4211,6 +4211,7 @@ void f2fs_truncate_inline_inode(struct inode *inode, struct page *ipage, u64 from); int f2fs_read_inline_data(struct inode *inode, struct folio *folio); int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page); +int f2fs_convert_inline_tail(struct inode *inode); int f2fs_convert_inline_inode(struct inode *inode); int f2fs_clear_inline_tail(struct inode *inode, bool force); int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry); diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index dda4cf6d7325..2551403a5b83 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1783,6 +1783,12 @@ static int f2fs_expand_inode_data(struct inode *inod= e, loff_t offset, if (err) return err; =20 + if (len + offset > MAX_INLINE_TAIL(inode)) { + err =3D f2fs_convert_inline_tail(inode); + if (err) + return err; + } + f2fs_balance_fs(sbi, true); =20 pg_start =3D ((unsigned long long)offset) >> PAGE_SHIFT; diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index a542956d618a..c2f84f3dde67 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -235,6 +235,49 @@ int f2fs_clear_inline_tail(struct inode *inode, bool f= orce) return 0; } =20 +int f2fs_convert_inline_tail(struct inode *inode) +{ + struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); + struct dnode_of_data dn; + struct page *ipage, *page; + loff_t i_size =3D i_size_read(inode); + pgoff_t end_index =3D i_size >> PAGE_SHIFT; + int err =3D 0; + + if (!f2fs_has_inline_tail(inode)) + return 0; + + page =3D f2fs_grab_cache_page(inode->i_mapping, end_index, false); + if (!page) + return -ENOMEM; + + f2fs_lock_op(sbi); + + ipage =3D f2fs_get_node_page(sbi, inode->i_ino); + if (IS_ERR(ipage)) { + err =3D PTR_ERR(ipage); + goto out; + } + + set_new_dnode(&dn, inode, ipage, ipage, 0); + + if (f2fs_has_inline_tail(inode)) + err =3D f2fs_convert_inline_page(&dn, page); + + f2fs_put_dnode(&dn); +out: + f2fs_unlock_op(sbi); + + f2fs_put_page(page, 1); + + if (!err) { + err =3D f2fs_clear_inline_tail(inode, true); + f2fs_balance_fs(sbi, dn.node_changed); + } + + return err; +} + int f2fs_convert_inline_inode(struct inode *inode) { struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 AF2F17DA81 for ; Wed, 11 Sep 2024 03:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026233; cv=fail; b=Zu5ZJ0Q/j6LlhuytisY+TywVqLOYp9p5esMDIruP5EEheFft1wh/cJUzzZPoblIhKruWvB1Yx6Ha0y2pjnroAnX3ivzlyFICu0SDXcdXtUi7VfCf0zOjDQvz88JJJbeuFZf6+Zj3TVwR39Xn/qSO8qEtpCurH4UMuPaF53EZTzY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026233; c=relaxed/simple; bh=edtOBKHzBOSiRCBdIrz/ZrKbk3tC1xZL7TmtJVUVnCo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=pDLsQbtuRmzkaiWb4aXZSeSx0gKX8E8aVYGOhbQC2PoZRwoRN9Owv/f32dH9XQFLwlIGKtMWr82zKHdm9Va+ZZM3/WTlXXHn+ZGDEo7z81AfEV7J+RhaDZEyEFBI1K57JK0NNmZTsbZfsw6vhN5838Eizg/qE+N1K8rZq1xQE/0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=Ry8/SoGb; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="Ry8/SoGb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=a2cgjNKJ1x+MOyywpPy9gJUh3zdWxe3hxkiCW+VrSv4Q8t/k0FpGnFwQSa+v2rtAf8G+9Cm3HFH82xx5JGQhYsVC7D7a6o4a/9kr0otn7dm3NmTGco3nYUpngOl2kmjb8hvNf97gtG48KzInoX/6Rm/+Wgyc9nQf1UJOBkq1TTQR3eGGgnz1VSfYyiLU5zWYTLapVmhJ1BmrHWfP5HStTIfoaKhsew32pZoacq+AHWL8f7UtwR4n/50k33xbL/17yQb0P7xQnag3uLD8L9wYPAVZM4Ydh7dtJgkC/0adkrYyvlTG5SEVTzsYq5KS0Lmgv4mVuL6Gj5DQFnuflRsHww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=NMu3pawJjX7tZUFb0bQVd90/AKHOuyxS8U1KgIgm3H0=; b=rGi2rHuDW3oFdTkdxY0gnvqENpHvg49/Lqn5ie39/S895SFVzWy2d5Ym8+jjgldQN5JLU6EICygxz0FxBz5zbgl47e2wuvpk1VYRomDLz+9zk3MptAKnIXlTs1hwreX3kyYhwfzYQUcS8NZm4d4Mpk5RxjgYuo5uolLtgQzCqdddfMxeP6xaUtKtxvcMu5/vK7PFnlMePio1SlOn4clHih9KF5Hp07mQuzNXnpcrWftPLg4Wg5APZbfNiqxbAaP0ESb+TpyObvWG6DiSbXLuORvac9gwMjPlckor/VbTYyeevf5HZowAbC29sdJx3aLzoZ8rVhkZp/U3EveAtBzwZQ== 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=NMu3pawJjX7tZUFb0bQVd90/AKHOuyxS8U1KgIgm3H0=; b=Ry8/SoGbXR2EQXNXGV2xNxXCePE9XSMg0oekEZPu+xiZmu2qq+4hh9IfBBz2u/cmkDhjbDyO7QnQL47/SUVTkYc/J0E5usyvSf2PkZRxwUfJe7voz00YmS+R1BDK9DYEYemFpoZlNOW3Ue81OfutVwmzURYdfa9SigqcVydyfOxH4dcduvR9ydI0hh/qwp7jpuVHvp0Ww4gdwhIttmG6wbKzjgFv7lQXH4CmttWed1T791uwM0pyqENomQ51T+jGJZOv3G5E3bJptE/swM5ZtfdXgnW8qwyEPh9ziHFqQcqB5IIr3EWHuw/h3Wh4VTYwQ7kuZK50/uppkH1mQJ0AJQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:43 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:42 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 09/13] f2fs: fix data loss during inline tail writing Date: Tue, 10 Sep 2024 21:57:22 -0600 Message-Id: <067f905e4f3b71727cfada291b090896463ef796.1726024117.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: cdff4dde-1059-498a-b65f-08dcd213ee84 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Ss9DWppozGV6sIjKkUxjmPSUUa8Qhyx2qQMslagm5T5+g0uvjh2B1ZCLu2ZI?= =?us-ascii?Q?bsIf6f6hYidIn/Qeaq73JztgoZZ4R5ToPUZqkQgGxRRbqM4lO0QRGi2jerxh?= =?us-ascii?Q?e+cg4tGY0mVsRycuqPYj4ymXFcEluaT5vryO+qU3377d48jpoo3Yl4WXxNZw?= =?us-ascii?Q?bFnHcOoLdDEi/I+9+WWLZCPA1W69anAvcxuLDmAxS0Z0EopUi2yTuITGLPKE?= =?us-ascii?Q?Nl6jEtqfol/GN1j3x1QMp7f1IzJKSViTF/VZ44fK85v/YfvfwmITvix48u2Q?= =?us-ascii?Q?+L2y+l13reixdAYgB6Y6dXQ5kLrjwk2Y6U8e+rNEHXge+hnfAxTrYiqi1u12?= =?us-ascii?Q?qgeqqUtHx/uD3ALyrB0a064iueh53puw7nKmtam3tQbukVpCwmZHALdobfS4?= =?us-ascii?Q?iKTwFz8Byv61enx0aC91dBnmtP50PmvU+oXhd/aY+AeS0VdDsTJHwxq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Umq8nemL6622xkfmBxz1tNrENneD+UXv?= =?us-ascii?Q?TY4/TAQ2j065vyi2L1bZUrCM+YcLNA96HSJfmPujaBzMYc+DrA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?CX2/ugSHKNEahTe3/R7kYmfjW5vF3F3S187WNL4nwLXJRPGhZnqgZhRIZK9s?= =?us-ascii?Q?g2F+gRkrGd9okNwTpfYhMn5X1bRKcXPMAaUZclh7cPUHj0CkmbT68Rxk0LQ1?= =?us-ascii?Q?Aea2KFBFVW50YyANq21y+1SKfHPXRmR2zJ0L5ph1GrPnJK3rB+x12Axi3x1b?= =?us-ascii?Q?A9bUT+GLujOOnQRZbtXOw9z+9Wn48VGJRfD08J/gV0Ygd6EsiD2ZKPnOwfFp?= =?us-ascii?Q?FbBTy2R/5Wx+Lmw5PUIBcTT90ABvRDfkhl2LlJiAkJNCjKKXTTvHNDGsjoEf?= =?us-ascii?Q?zUSLrdf1Izxbabt8UTX4Bl9l2p/cZu1QyAaKmDbdBHWisdD2NJz3sz/bXWE8?= =?us-ascii?Q?eiUSgNrlWDJo8Af27kD/hxbyjpgGCV6BJ9iqNJm7CY4/Q3gbM9QQDKWSlIb6?= =?us-ascii?Q?n43JxekM9F5ByQUPeRDL0VK00TM9mG9Eb602lHzSE7W1Zpw7PWmZ3/d1b8n1?= =?us-ascii?Q?uWr7Lb+/NcxrheucwJcsaYz+ihdsQTwlUitzLo60jnJBmqw9+KC+Jlrv/Mja?= =?us-ascii?Q?YCMRWjBBtWwG1vHIXy8TmEbrLJ6IYnGFALk+TREDUPCqcGjE3n1GxLL3q7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+RFe2ovH7UqfumOTjP0AzMZk?= =?us-ascii?Q?DKofOA34jn2ys9L39VDGL7222AbYWcpXwqT3BVFXMdViLoXb1BBkQpjjneSl?= =?us-ascii?Q?6d0R+YouigcB5yht7VRO8ypMzM0SDeaP4uEJrcR9?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cdff4dde-1059-498a-b65f-08dcd213ee84 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:42.9244 (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: tkZLaHWG9XqFNpWDDyJg7zzkocszHKug5nnqmLyN6igtnqlD88jZzyBbhh7F1rBtmbCV8/vVWTWftlIOkCGH5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" This is detected by xfstest generic/114. The inline data needs to be read out before writing to avoid losing the already inline data. Signed-off-by: Wu Bo --- fs/f2fs/data.c | 3 ++- fs/f2fs/file.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 476325a26d4e..275c5739993e 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3477,7 +3477,8 @@ static int prepare_write_begin(struct f2fs_sb_info *s= bi, if (inode->i_nlink) set_page_private_inline(ipage); goto out; - } + } else if (f2fs_exist_data(inode)) + f2fs_do_read_inline_data(page_folio(page), ipage); } =20 if (!f2fs_lookup_read_extent_cache_block(inode, index, diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 2551403a5b83..64ea0bfc2e1e 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -4729,7 +4729,7 @@ static int f2fs_preallocate_blocks(struct kiocb *iocb= , struct iov_iter *iter, =20 if (f2fs_has_inline_tail(inode) && (pos + count > MAX_INLINE_TAIL(inode))) { - ret =3D f2fs_clear_inline_tail(inode, true); + ret =3D f2fs_convert_inline_tail(inode); if (ret) return ret; } @@ -4842,6 +4842,7 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb= , struct iov_iter *from, if (iocb->ki_flags & IOCB_NOWAIT) { /* f2fs_convert_inline_inode() and block allocation can block */ if (f2fs_has_inline_data(inode) || + f2fs_has_inline_tail(inode) || !f2fs_overwrite_io(inode, pos, count)) { ret =3D -EAGAIN; goto out; @@ -4861,6 +4862,10 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *ioc= b, struct iov_iter *from, if (ret) goto out; =20 + ret =3D f2fs_convert_inline_tail(inode); + if (ret) + goto out; + f2fs_down_read(&fi->i_gc_rwsem[WRITE]); if (do_opu) f2fs_down_read(&fi->i_gc_rwsem[READ]); --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 8A7E37E583 for ; Wed, 11 Sep 2024 03:43:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026235; cv=fail; b=aeYU+Wu3MFPcHIqWgb4fcP7526PgBuxQHw7C6pwemB50hWzOO/7yF8Ws5ADu6lx9FZ/NWJd5nGfn9S/UNRL5Ox0cXU+4KHtjdfIln+o8U8fa/j6Wv7i4Oeel773UDY/xL1bJ0sgZHSXmrQIBDdEN4XJXTpeYM8NqDC+EVYktXt0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026235; c=relaxed/simple; bh=lt1kuXig5/OcyT2+aCV/ZX0lUx+a7Paws8zyj6CObsI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=bLF9zTa04WOr0CcCEgSeVZNJz6jj8lVDYtzffoDtAgtxvz3JAZE2NbQXsYRksQ8oUQdTtjAuFRRnjGthL57iv+ky48jONJELV5G46NiZ0R/NUktjY9PVBnMoJPtyWjTzZDgpbRcXOgFbLtP6a4p1NF81WK7cqGmS8h1hatyaLjI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=KJjp5Mg5; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="KJjp5Mg5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JWObXJQh7DMaDk4Q1uSM0sKMjEj8TsITyDOu/ERZCv8d/hgVzUw/FcWvRsHYBMBmjz/cwPmcmh39G9VGbp/94TXglhFdf9m/54CF0Y4XfRQKwmgVKIPY9gVugDQ7j9uBFZSJmMXdZEpS3utxFJR1u5qnQmg2Q5sG24RxACG4Q0J6FnewkfXc3RW629GaZ1X69g/ozRskkXZEDNutuGvWw4TAKX+yZcGKvsFLy1EqbixZ2TjCBaX5BY8Usn0kIljCOWuTs58VEO+UKIhOISurq3MTLmwCIaJkQWqPBCRPMBNvXMOYMCxUuLNsIuwYs5vRkYk4t3Vv/oybGrVYlS/KpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=4fI4xqj9AK+cyUPbm9hBvT+ojMH7CRydVKcnjsmQTb8=; b=UqYoj3K/EHaO+ueq0QPA79DF+9YiBVyo+BbTGl+bUTUAqa3XEazV4ACCmv0dd+kuCIybVktvC0gweblzfrkXQYG6QtpxaktCmJI9WDsYLcttdhK+J6Lw4VME0HxgKI3TipqAfrDLqieENu/UfTxjrAR739uSJX44taDMd8avzv/T8AY8+VLTKlSFSYE0IhKBT4X/KcEr2yXtWFfhYuY5oMSznIIPj1bwBf/UQQq4pzX4bgcBu8K7AKjwkOjI/9htMC63hvPjD8Ab0MFo+xiSZcuYip+/bjjpI1xO28xzMGrPlaZuVLtCw678zMyXmGKtBezxY7I1D0HgsEsYLrrhrg== 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=4fI4xqj9AK+cyUPbm9hBvT+ojMH7CRydVKcnjsmQTb8=; b=KJjp5Mg5U1XkXIirzpfvsPmBDwTTab4NUC8Mioj5U5jU1gHFm4d0eRn3i+ep7HNMl5Rm8O6HrGSe7f+CImh/AeHwlbdBGxzsREYQXcjqTjpUjTzQWU6iJMwEH7rTzyJ2cxEOqQwaDX3sKvejXZAgCHyayxnDLM2OW7nm5x3e5+/o5qn4Us4Gqc5I6NuZxIMqTJ2k9OFPEAEicDJEalNKpsQNzqlDc5CObcW5WUYYA6WDHeNmr4aeTfIQfB6rlVdKqFcDAQdRzSNNJP4m6faJdxZAFpMbVAeTbFExfpE3d3uEU9ey++o/vI6COA8tffe3UKqGNTByPNpJZjarVDrjCA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:44 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:44 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 10/13] f2fs: avoid inlining quota files Date: Tue, 10 Sep 2024 21:57:23 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: dde63625-a6b2-4e99-8bff-08dcd213ef63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?dpEtUG2gSEgF9mgIT5sZAb8hO8SQhd9+Gki4YspSxVFRs5ahrd5O30ub7lXp?= =?us-ascii?Q?fILavCHMpAoQdiz6qSb605J87diMbUWcJqt9ULI/sTjA8QgzAFpgB8vWWoqw?= =?us-ascii?Q?+1cKsrDL6Zc6Uy3LS4LLHHGUKH7oOFc2LkKoaOZT8reAYTHGA5U5GA49IJch?= =?us-ascii?Q?FaviqEsEP+GUjHqZakD3hiBelD3+EMrcRNupqe9/ZRUXQGgTzPEZgJqNuTle?= =?us-ascii?Q?YOISrq5/hjpjQWg6fAgseh1LktYEQyl6THP49wySfsY0ajwVljQvogwtnVVD?= =?us-ascii?Q?my1NLiImPUqKMPRZnmRXWU7uEp+EwaX8IBB1zjA3ElPbQaHPdW4/rLWgFvmS?= =?us-ascii?Q?25XBt7aKU4ci1YzvdcNGnB/Y3PKenFT/Etedu45xr7LKsNwlQ9Tk7uAtRf1k?= =?us-ascii?Q?V0/iaXe8z4B32TBeSQM13oMWY3mzwHu79OFDZNQz3O75QUJ7bjO9EdQ2myeE?= =?us-ascii?Q?HNzd/712swHA4SFy+y5p6gJPxURxKaaYOjQS26z2ZVikq/33MeoRLlVlZrrJ?= =?us-ascii?Q?WWt75P1nJ2dvdBtGHJou4spBy90Htf7vgHdmpgxD+uuLQXOPnRgLqwgHzFJp?= =?us-ascii?Q?UgGSzrNXTJoLLjfz2QcNxXvOqOcetrdMrm9iPJizY78gEQo2OembJvJSR2Te?= =?us-ascii?Q?Ic4nXJf+4jzWWbarolbFdeCnHYFLfIqv07L2yy7nFvYFjpuouGP7UezLi9C9?= =?us-ascii?Q?UwagT1JNtfc2nhV9yBteM55j2UTudZH3KMP0e3BJU2g79RPRo8YSLl18xhqh?= =?us-ascii?Q?qhe5OBs8x01COnzPaBVUU8xqVf7ZWk44CDlwwhkadAqaeitcTIKY+8VveEmw?= =?us-ascii?Q?s0+DCon/iMhAWeUhQwTOghutO9rS8CX0SJkBq/EB/IXHBCMg80kJm6fLty9f?= =?us-ascii?Q?0jNDetAcZYWfdr0XlQYWY39n1ShBye7oIYpKKsA086Dzps+120t8WdVVdHVE?= =?us-ascii?Q?kLRShIfE+IIHzA7nzIj4Z7Pq05g6qjGrgU3ouH20xlS6CAedyx+Q6ouiQcYG?= =?us-ascii?Q?J191+zhLfDbgoClqB9xdfb/Zr1UglU/xuLf0r3m2opFl0zioPeL+OpdGdX8z?= =?us-ascii?Q?Y4WnR5e8Dxb7pOhI5s/KH0cQse/K/PEtzMmeYK3hlFoIvIuMuuKUxv58dzdO?= =?us-ascii?Q?Bqesec01ml9D+BR6cHxfqQBOM2E30qKDB86lMvnLeS5aWyc7+LeZ8/aIbqRb?= =?us-ascii?Q?t+hNwG0QX2FeuMbGrybY4MSi8U0mtiw1OMxA4bWgC69loEUJLu508N4bzWVv?= =?us-ascii?Q?35yoCYkeBP9d24PcHwQcAgj3HWrXpPsDSzpVpZskYmgiqgwr2RU3BvLl5ssz?= =?us-ascii?Q?jlFeLracFSL6y+rtkiBJyNkXwDpfM+w+HqIpsVWgGe0ghWwv5MhhBzAYjB/Y?= =?us-ascii?Q?8m8XoWZkagpk3XJoqgHXrnCST8nD4izsUToSwAUyFea7249UkQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?XnMnAtq4NitKc4UckgMVoWHV4Qfd6oI1N/5YMYRqmU2NwxSRTGfQQA5iBiPE?= =?us-ascii?Q?igkWuaDrwmeCXKHD5H/QEro2wp0hn/C9iBE9fC0KxOIaWD7AvG8r3WrqmYf0?= =?us-ascii?Q?0WeNsLY8Qj8FiNs+2cwsHZluDJODK9Zs8OtAGKYYsBNPxb+M+kTGka7p7nFT?=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/OrBZGZZ8aSSDGf9Om9EWGrnpx8Y2X58LPhayiX+?= =?us-ascii?Q?aBpJuxJUwpBBL6mDdHDi91+tmCj6FKr5KSxqiYL+Dtqc+E+Ib/+l2tdLFf8U?= =?us-ascii?Q?HMUK7o9kf3vg2MA7zSqIbnCtwhUuvYPxmEKDOd4Uilv8KHh5J62hxjucSolz?= =?us-ascii?Q?t1DEUnuE9XLj9Y38i9D6xC0isKc41OQuxFAx1f3HrFovYsn6cGUNpZjMYg7t?= =?us-ascii?Q?goNlhH2kiF+MujihWdvYdoYOWnne05+ady+GOvV3jeZJpnGHvgES4GmBDC+w?= =?us-ascii?Q?FfMAKs7O5+awn4j0cxdKjaA7V9DDDV5VrJT59G0Ellt160NGucO7YlKuVN6m?= =?us-ascii?Q?j+RPDEcylyQQF7ywPVB883Ts2fsaYChE8yvlGs+j8FqS42EVyPxgezLTO8vZ?= =?us-ascii?Q?ZyBwjY5HjHAyfr5oGuZk8lsaebbUClgc/pTKvFhApecIQrA9B3CDf3p9Vzhp?= =?us-ascii?Q?uRDuIAAdQ2/SLpMUxKJ+OXuuXLC2lDXY2/4F3nNtyBYzOZd4h2yriaAbo+JA?= =?us-ascii?Q?M8usGLFWAUjnZupLRbypLQM0aBDwFVeNXwi4NTXN?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: dde63625-a6b2-4e99-8bff-08dcd213ef63 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:44.3860 (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: thwrUHUsL02nqMLg1+FEhBj69/KxpefBiietE5u9S28yGjgRSmxga8rY0ARBF4lhjI7bEJ8aptDY5uBaoLvTmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" Quota files have a different write path and are incompatible with inlined inodes (whether data or tail inlined). To simplify the process, inlining is disabled for quota files here. Signed-off-by: Wu Bo --- fs/f2fs/data.c | 9 +++++++++ fs/f2fs/super.c | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 275c5739993e..6d7b6074763f 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3641,6 +3641,15 @@ static int f2fs_write_begin(struct file *file, struc= t address_space *mapping, goto fail; } =20 + if (IS_NOQUOTA(inode)) { + err =3D f2fs_convert_inline_inode(inode); + if (err) + goto fail; + err =3D f2fs_convert_inline_tail(inode); + if (err) + goto fail; + } + #ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_compressed_file(inode)) { int ret; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index d4ec32ba6cad..0f54c055f053 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2807,6 +2807,14 @@ static int f2fs_quota_enable(struct super_block *sb,= int type, int format_id, return PTR_ERR(qf_inode); } =20 + err =3D f2fs_convert_inline_inode(qf_inode); + if (err) + goto out; + + err =3D f2fs_convert_inline_tail(qf_inode); + if (err) + goto out; + /* Don't account quota for quota files to avoid recursion */ inode_lock(qf_inode); qf_inode->i_flags |=3D S_NOQUOTA; @@ -2818,6 +2826,8 @@ static int f2fs_quota_enable(struct super_block *sb, = int type, int format_id, inode_unlock(qf_inode); =20 err =3D dquot_load_quota_inode(qf_inode, type, format_id, flags); + +out: iput(qf_inode); return err; } --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 575AA130A54 for ; Wed, 11 Sep 2024 03:43:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026236; cv=fail; b=eDH9ialYGlkmTxJirBji9IaYsrFcKYlwNXjeshtDjbX4+GS9rkm3DUJIVDPdcZ+UMAqLnxkL0+BNUhuvOVNFMkR/2LXCv9aYB5Yho/eFuA5G4JJQ51ayGdN87scuHmAiFv4JB1SN1nmb3xxrN7HfsQmuxTC09IwT72AdrJ/ww5o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026236; c=relaxed/simple; bh=sPwhHRrQKPW7G8PdPrtZ2iMW8M+G5Q+xTJppa6iDR0w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=UXoUthC9+KYwiU51fyXVbI6NbyrvzelN2HF6fZJEVvtk2rZvGKJhRdNyAHgNt+rruIFA6SOvJKN3lVsrdUuMKivBEw3IbkiZQ/cUyz0O819aN/RWWVDMGJhWfk8Oe8T5nT7+QGNDipbV12/so0IvJip1Ne4QMMtgf8OYwOrMIsA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=cIc+vm4/; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="cIc+vm4/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VPN9g04UWuRoJDuuT8RXZLIMrtASbw6gp79MMXjewalSBGyWQQPjwsJIiCVlflzEsoBA48PMkcXMGHF57Lsm7Ua6ldRUD4JPuFnMX9gdU6EUVwMxYnO+GCrMRyD5jIQxId+hNfu99lRrVDkC4swruQbKiF12UxROSr50jJzAvfreshC9ibHqqCD3Fe6fVXf18K+bXNA/lD3Tn7IfGWk/2wavAwWGdgIpeQokvVGmWnqKFoIprqljvxS16bbrzctHxDuq4VkE0W2xpfhPEC61KWTSCKXYEI84RxYfXRpj5nqm+VuUNulkZcWFr9JHS6EKmKg82Hh0LIMLAPyQOsyETQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=6YkUHWkSyaZim2/FraKiN+n8vb8EDsmqhJ3U8NImOxA=; b=MF333iz5aWPf78NA2cA9FN2niA+KmewWORZ9obpIUt7yCK4PLcx/pxlKyZAcL+qTHJwy+DutCWHd6hwOmbQiNqN9N141/99PRFUiv+0tAua/DIx44hY4Jq5prIDctN4CE5qJCHiGrYzGRnVLKrepBE+ZoiU7UC4wF5XLhYFRYa7+QUfY+VyX/vhpMtVp7NdJ3bxWucyI2lKpdTyg45OpcJdbobjnmigZwT+z48EXj0gRedAULsOZ0Vej7CP0A5eBUm+ilRWg/9Plp7RZf+ql/9y1sTqdpzXBQNSBpq0mcjZAL/Yjpwc3XYTv2QqDQwSqbaeMkArtjOxoaj02xx2pOg== 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=6YkUHWkSyaZim2/FraKiN+n8vb8EDsmqhJ3U8NImOxA=; b=cIc+vm4/P/nlxJLGWkcMkebqw9uyZQBvNxueCMy9EEs/M6LEARXSbei7T/Sqn8sHlU499dTH8FotecWKVYRUJD8l3uwQG+XY9ymsG8VsWSn75Z5gU/andlAsK63A9rJzI8uwrJEk+UGS8cUql3VvF/STYLOLo9voY8TTxHOk82XFWnYVnDVK3M8wv+imI/CI8Ihm9X5tBEVPaHtz57ojIoLvvmIyBP8lnRwDZaZa12r5DPwhU7fN/ytARPMyIxjoVCSRfeLkh57dknzhR5yBxV0W7DOssur7kqtWEMQAFD4LciDzae7m9DLiKi409n5S3ebRWUyIpzreQyDStXdIMQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:45 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:45 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 11/13] f2fs: fix inline tail data lost Date: Tue, 10 Sep 2024 21:57:24 -0600 Message-Id: <64857ac35515abdb00cfad877094131b471a8776.1726024117.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: 92b06946-a1cd-4812-a468-08dcd213f03e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?lYhdtRgMgvXuU1+GCgFjaneo4y515buEbARLMsPJDQ8gKzW4MEtYBk8H2gKb?= =?us-ascii?Q?S/7M0DCLmhZUedGLl8Kdnhc+VNVXP8LkHCI0CxTb2skeKsBlvlizHKp5knrA?= =?us-ascii?Q?6HxR6aY2BO+FlJXFybQ89Zi/OxQGS2IGg1JuyDC8hNUaplUSwRrsbvnb4D4j?= =?us-ascii?Q?Vk/3MGK+Tu1mNrDTmkHYG8F7wtKem19iEPC8syU+o0BivQ2t1L9Tsyrk0MLZ?= =?us-ascii?Q?MTycPc0qwlFWe3WEcrlI3bie8263vNCQG11/QTEM2GQAJQZztsiMB07DP6lv?= =?us-ascii?Q?1gkmL9F2dxzlOwPM3AbNeZtTANf19r7W8MKonjKDC+bF0Cs4TqwqMGNWZNVZ?= =?us-ascii?Q?2JrTXA0V/+n9DT4VFIkKE3aeUaWL2QU1hEHVSA5DMDSJNvPINUmIwyPIp23o?= =?us-ascii?Q?0cmVK5YQjuMSaHC52mcJnKHEWz9dQMdwaoLoaQ/0yT5JdQnxiu3O/lqbPTYx?= =?us-ascii?Q?kZiCSWUp4/v8unVP7wTh6jfoyZ7+dMhdYdt+iFhBwjRUXRWlNKdQYq5G4IlX?= =?us-ascii?Q?pwTFEmN7vYz9yHtpvfJ/2gSOu/7a3bF2xduTsc0GQfzdqHfEmzp3qGbMAhbO?= =?us-ascii?Q?O2apEArIQ9oOwrs02poe4YIuqzjTTZBTHRGxUXGGTX0qxaS6xdkiw/jBhVZI?= =?us-ascii?Q?CGLbLXrJ5v6MCAax1+Jr+DwnND42oxzRCi2WNwUhV8TAiuBnybrFcVyrT/dT?= =?us-ascii?Q?alXWFR+80getRgXp3EkIszr0+2N3OeT2mTz1C6ewq/P0nruV82eRsHTd4+0E?= =?us-ascii?Q?hE/naQs6vr8A9CPc63r2lCSxUQ6qHbINmqENQqJSrpCueMOkfnbZx9IFIreI?= =?us-ascii?Q?gRqNhMyF+rkXA/A5uPi7ZklaJkjm8D90yLEukT1pcOiTDtB7eEp9gm7iJJsL?= =?us-ascii?Q?EN6/JHskIik1x5LZ7meYvP+Ca/PImI5k2F3YxkwRVkqxXaB2a960Z0uRIiBg?= =?us-ascii?Q?kk6WcI+su+DM6hZgtvpYuVxKUS3dR49PIP3E7RNXPw7iGos9+1PYBsw1607k?= =?us-ascii?Q?yyciY+mgv2bIWeC/8tN5yHPYTGfr1eBvHiiGjGszTmukB6/SiABbUU8q2yf4?= =?us-ascii?Q?saHZWYeCmJPUb1lsJGoXzRLU83Rldob+sddQlJ2aL1NxopywDvzvg0C71UX1?= =?us-ascii?Q?xkY6rdB7yeNi93u5XZKPgDpKOStPBnLbnwhqGvpMN0IewdJcopHibY7o7Tse?= =?us-ascii?Q?uGy/SZ6xSsnVOcJgPrpeNMlEhXmSnUNHT+b0TeQP/HuOUznfX4Kvf2Mz6fmm?= =?us-ascii?Q?lKmJYbs+vDouKJztpKBQ8bcmaxJIPNKrr917jn1dLJwdRjv32MkxVIcGIKiM?= =?us-ascii?Q?JLQANswtZEI6h5xu/Y2ymlJ+6wPJgBa7R8cwwEOlYWNlWq/yUI1tpQhk46do?= =?us-ascii?Q?elUWYyVNHauAbUnbINNWN0OE+CU0s9BgTAVzrsYQUynur8jk5Q=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Mst4N0yhhAmnixpWmf0QCKKBiwki1aXWcX6nCohRvoFiTLDBhr+0OkKVNlVR?= =?us-ascii?Q?9SrApU98iuL/QSDZZbUfAlE8F9a0a3iKVEi0HWpkzr71jriHY7UDoO3X0s3n?= =?us-ascii?Q?oz3a8WFUOdG/MiMzP8+h3Nlrn0eNm541DODcek0pGyel8wnXYxA0+ssSuh2D?= =?us-ascii?Q?HQfKpXMPW+iaU3S1YcmNLGCSZW2ttQze+bpj/2/B40ETxDEhHcHmeJzqQHaa?= =?us-ascii?Q?4yRe+T/URts7510IIyfb/DW2El6j3qeXUWQOWQiKqfu8YWUXbWyhiDbbFSur?= =?us-ascii?Q?qXXsKolwPyL/yK6BFaBEBpAVbLmwkUJIzeezTPO1ubnngFCcNv2L0HWuMDG9?= =?us-ascii?Q?oBexbQ66s+Xjgk5u+bXv2CqBiurfk2kf1O6juOL6jh+EhuIrFr/JkJRSWEXJ?= =?us-ascii?Q?5IeBfsJT8jc60VszxyNTF5XB0zuV8FtcSLMRzOcv+YoA7t3z3XZ+m4Hu1esf?= =?us-ascii?Q?74gfKLjgr8pmMbuGiz3lKj8mPN/s9jEL0V/EXDVZZJ35vQH0M+HkQCUhtRkh?= =?us-ascii?Q?I9tTQ5NF3CcnidGwhTP4VTHtBaLwst0U+/1x1VN7dv/QQ+VtJ4fWAg0dha3W?= =?us-ascii?Q?XsFPOS6fFg17VVYuSkIbidhYHgtMEk1igX2GtktWletT8sbO5FOlHgwwQ/HH?= =?us-ascii?Q?ub9Rq7O484brUHI32AGLbMdYJ+Oke/11GtZxfC8KFt1lddYnbN7RsZ+tvYjS?= =?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X+6QRbkxC1ygK?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 92b06946-a1cd-4812-a468-08dcd213f03e X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:45.8218 (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: jVKthDJ6ImnDk8fWmU09NIOh845/6tlBmPFIk41/LkWooa38CNiDi05ZDlLpuVbC6kLDwAOwPm3+gBKEDMpqeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" Before adding a new page to the tail, the old inlined tail page must be converted first; otherwise, the data on that page could be lost. Signed-off-by: Wu Bo --- fs/f2fs/data.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 6d7b6074763f..f52834c1cacd 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3418,7 +3418,9 @@ static int prepare_write_begin(struct f2fs_sb_info *s= bi, block_t *blk_addr, bool *node_changed) { struct inode *inode =3D page->mapping->host; + loff_t i_size =3D i_size_read(inode); pgoff_t index =3D page->index; + pgoff_t end_index =3D i_size >> PAGE_SHIFT; struct dnode_of_data dn; struct page *ipage; bool locked =3D false; @@ -3438,12 +3440,12 @@ static int prepare_write_begin(struct f2fs_sb_info = *sbi, flag =3D F2FS_GET_BLOCK_DEFAULT; f2fs_map_lock(sbi, flag); locked =3D true; - } else if (f2fs_has_inline_tail(inode)) { + } else if (f2fs_has_inline_tail(inode) && index >=3D end_index) { if (!support_tail_inline(inode, pos + len)) { f2fs_map_lock(sbi, flag); locked =3D true; } - } else if ((pos & PAGE_MASK) >=3D i_size_read(inode)) { + } else if ((pos & PAGE_MASK) >=3D i_size) { f2fs_map_lock(sbi, flag); locked =3D true; } @@ -3471,14 +3473,28 @@ static int prepare_write_begin(struct f2fs_sb_info = *sbi, goto out; } =20 - if (f2fs_has_inline_tail(inode)) { + if (f2fs_has_inline_tail(inode) && index >=3D end_index) { + if (index > end_index && f2fs_exist_data(inode)) { + struct page *tail_page =3D f2fs_grab_cache_page( + inode->i_mapping, end_index, false); + if (!page) { + err =3D -ENOMEM; + goto out; + } + err =3D f2fs_convert_inline_page(&dn, tail_page); + f2fs_put_page(tail_page, 1); + if (err || dn.data_blkaddr !=3D NULL_ADDR) + goto out; + } if (support_tail_inline(inode, pos + len)) { f2fs_do_read_inline_data(page_folio(page), ipage); if (inode->i_nlink) set_page_private_inline(ipage); goto out; - } else if (f2fs_exist_data(inode)) - f2fs_do_read_inline_data(page_folio(page), ipage); + } + err =3D f2fs_convert_inline_page(&dn, page); + if (err || dn.data_blkaddr !=3D NULL_ADDR) + goto out; } =20 if (!f2fs_lookup_read_extent_cache_block(inode, index, --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2086.outbound.protection.outlook.com [40.107.255.86]) (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 3472013A3F9 for ; Wed, 11 Sep 2024 03:43:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026239; cv=fail; b=bEr5TQGlvWXy7cyccTqskfXylA+r3PPR0Nt/oFZ7rmeBSaT5FwTB8DurzOVbQq3AiFt1lX41l/LKoE6nVxevd05aL8wl20ORGb/aNQ1xew9sdzeP9tsB+2vnItB0qE4/qwi5aI7s70r6TLUZDLluFIazFq29o2liGBNQhGSfjpM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026239; c=relaxed/simple; bh=aoXKwyCkI2oMCOwFGXiDOy+bY+HgnmOcFMLwyz/nOrQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=tiL/PD5bt9nxy3dbEOKrcV8ecRvghHWZOwSH7uo6QSyrbDruCxeAJei/bgcLW+6JDBmgEkZgeS4Ef98yWMHvdQyq+eEBhVcG1KPYrqL/IoUdncx2tzMWg9XnPvY9mdpQHPJFqDvY9+K0tcQn35bGt75U6G4AFx8C5RNtJCNkM48= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=m/KsiDEQ; arc=fail smtp.client-ip=40.107.255.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="m/KsiDEQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CWYX5xi9CvIOQskeUDg2XR0LcMaGhBf/mVNvFnk4P9zjeEpLkF1RnbBVRsc9CfUKu9nRNl2QdX4eYy4yVBBepNtVKZtFMIjO+mQO9c0tL+Y8o6p1eRvlH29ipQZOWstHJwmZ7asCUeE2Q6gq0Puq0GbdGLTZwNKTdMjhlgFyROCLNWhkrgL59H9DrMWlW8n+XKcHa7oXjusb/ruSSeRK3csw6kGXQwqGasKipBcN26Dwga+U1PhBL2nrtB/JOoX8ecA+kxHAJA7JZ+NmOsMpM4faZd9wgJu1S6pN7trRCVtL2rFqhF9p9ZxH8vcaWQ6zYqudDCh3q6T6VCrvGooR4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=hJpfXRt+D/Xi10u7fADuMjbX+4YLotlKl+Ws+v+nkzo=; b=LcCzD+eB35gxxOevA8wIV7xvfrXcpGT9qwSmSTVeFGSAeqjyjruhHecDs9WOubO8zXU6p9OrS7Y51MKHNKPb/uSlHBM6mDhgDsXD5gb939XrMeQoRq4K3/WiTutuLB7AOWidjwVyTXe4HyqIytVcgqPbvDHfsr5R0kb2KG9mV7rvtMMqAT1vSxDpbyPSU4c7N3RllwA+0OJmRrmNJGrDkYjnPTbCGDZ539kHA3lpkh1gTTaauMQhb5Lddp/5T4wduOMsVSBbfOEMEgn/4DVsUlELsHziLL3XT3e1TOAZuH89hcuRY3e6PUwrfY/aSEtd8gfyVoMaKVHm/bsZF8jLVA== 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=hJpfXRt+D/Xi10u7fADuMjbX+4YLotlKl+Ws+v+nkzo=; b=m/KsiDEQFaBr+X1O8eN0pMWwrQG+e0jZTe6t1vulmBbKf3zQKagZwa7ReP6dwRl78O5sV4ThIYaHYVRpWLqI6af2Avl9Wip22oFLRZygFnXDdfSdtbTUC29ZRQQ6meRIVctSjrki5HP4d38glvSGRYR2yhU0IQhUo96Y6G7JrOux982jN+Q29ScZ5RES6T77V6yQchroe4OV4gz50+QjAj2l42pO2LA0a5ZQxuaQmQ74l3lPaA5ceOTs2kK3vZfPytB+cVU26jl0jwAqFSU+w9OGsI1Aje9VRu2NWl+ktWXyy6YYPdgk+U9OvqxRSg58wWUB47siw4srihi8WypRww== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:47 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:47 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 12/13] f2fs: convert inline tails to avoid potential issues Date: Tue, 10 Sep 2024 21:57:25 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: b70cfb3f-8389-442f-b9d7-08dcd213f12b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014; X-Micros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7JrGPobwBvaNLF0jbMZFciFUK3rIAGHLXaZ/66VpQ9m?= =?us-ascii?Q?4420QNie44TI5XMKVzcqg98K9mFLq7sz3i42oGYP3shUB6Jxkb8kcyrLLjZp?= =?us-ascii?Q?cvDaGBDgz7R+pT+eJ0f3hK/YJjvLiuhO63u2/nyoMhkSQ7kSMrPkr1wxDNWV?= =?us-ascii?Q?8Hm5HlMH4De4QilmAzCx0QuhtaCD1BFPqPhhtW23CnNvDVT3G42pOqESbrjU?= =?us-ascii?Q?5cEO8CQgkAisrRmGqT1S8u/KFPQviBIRnmi9iwkx/y/g8aumBQdnVUdT/h8a?= =?us-ascii?Q?i/r9M+mhFELzUdi8mERuHHgUeEByzBxw6DnD1XFABhMqVDXZinvoG6BIxcIi?= =?us-ascii?Q?vf9xODn1uw6e0vv+13v9Jp1PXe/VdroGpwDTPK7x07v6iiek/uNTCiOgJzls?= =?us-ascii?Q?rpDFVVF5KKTHyrMh4Sut75xvtUeGLZ6JmfnV6ckQNumJ5cJLaXm7YbPk3Z9m?= =?us-ascii?Q?SO8YfMxo7z48nGVwb3yG6inbD8HHfNe9NtuoZQaTsrkwSnRTy1BGDtPYwiSl?= =?us-ascii?Q?PhCmmJ3dcowbNxCTF0GVNisAtAdOovjjkw+hIUeVDVPJ3U4e2g=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?1XDYL6cG533Aflir+q+xbd4PIwAHpkMM7dcLzSB/ML9gKyVNjMSaiPfeSGMD?= =?us-ascii?Q?nVWhj4iaWfmPL7PmnB+PkuX/+VUqlmgqtU8FE3mLzY6M50G5lRiPWA+N9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mX58fkE6Atnf/5Kda3QPfEdcamoCAi4+hOeUw?= =?us-ascii?Q?dWvBbKsmZbM+pgPpxgqwUhyZBDHoHHW3CGtCaBdYupxsVsAd5bt1wB1EsaU9?= =?us-ascii?Q?TevHEvNiDZHKcRLQdb/A5zc1paZG733wsY+NL0obSE2IbKffcKWGRlUXSmZu?= =?us-ascii?Q?/jimTbA8OkJNJdYsoK63rhVJYm3VFimgSOz5B1lbmHN3YwiFwAI7lVtvhfXi?= =?us-ascii?Q?FT3k+lnoafRgBATCbUA9T6eI6Le42EH4RtL8nOiL4VssufLS2rR0X4kVLzOT?= =?us-ascii?Q?umYBxucgNUMEqrocLFxMdTynpixGlamAMA/9MEVGvQAPJkGFgboeGKimlt4d?= =?us-ascii?Q?HdvU/IuXLjXVL0SLtzteYqL3czlbfBmFK80aVrSeXkZeRk/ocRXoIotTapBW?= =?us-ascii?Q?GneK3RA/5diT1BQjNYvcYu4Q7MeT5SNhcg6mTV6GFK+l9bgFJasF/ryaH4+h?= =?us-ascii?Q?6FyGfVuoqrezuKV+MyXrcEUMXr9DZKy86CW2BQ22K7mPbCHxhVkZ5VckGs6h?= =?us-ascii?Q?gRmgYiNXUImlDgLfqUN3OWulMUr2CY+qFoicLO+rKk3I6peg7nazFckGLlXa?= =?us-ascii?Q?6pIHyv23IX02GsRrVR1wanOIeHuo3RTGaTq43KVM?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b70cfb3f-8389-442f-b9d7-08dcd213f12b X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:47.4260 (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: paU7Bzf2AWWyd15bVgVrrIXwJGtDqpXh3KLIdNEXcEDctMUMZE8CabBNhA6LJaZK5Sc1J7bfcp6ouzZJN4qFww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" Like the commit: commit b3d208f96d6b ("f2fs: revisit inline_data to avoid data races and pot= ential bugs") Due to the limitations of inline data, there are many scenarios where inline isn't supported well, such as move file range. Therefore, in these scenarios, convert the inline tail file to a regular file. Signed-off-by: Wu Bo --- fs/f2fs/data.c | 4 ++++ fs/f2fs/file.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ fs/f2fs/verity.c | 4 ++++ 3 files changed, 55 insertions(+) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index f52834c1cacd..a59758e1c878 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -4141,6 +4141,10 @@ static int f2fs_swap_activate(struct swap_info_struc= t *sis, struct file *file, if (ret) return ret; =20 + ret =3D f2fs_convert_inline_tail(inode); + if (ret) + return ret; + if (!f2fs_disable_compressed_file(inode)) return -EINVAL; =20 diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 64ea0bfc2e1e..3dcc5e363c13 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -84,6 +84,10 @@ static vm_fault_t f2fs_vm_page_mkwrite(struct vm_fault *= vmf) if (err) goto out; =20 + err =3D f2fs_convert_inline_tail(inode); + if (err) + goto out; + #ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_compressed_file(inode)) { int ret =3D f2fs_is_compressed_cluster(inode, page->index); @@ -1070,6 +1074,12 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct den= try *dentry, return err; } =20 + if (attr->ia_size > MAX_INLINE_TAIL(inode)) { + err =3D f2fs_convert_inline_tail(inode); + if (err) + return err; + } + f2fs_down_write(&fi->i_gc_rwsem[WRITE]); filemap_invalidate_lock(inode->i_mapping); =20 @@ -1191,6 +1201,10 @@ static int f2fs_punch_hole(struct inode *inode, loff= _t offset, loff_t len) if (ret) return ret; =20 + ret =3D f2fs_convert_inline_tail(inode); + if (ret) + return ret; + pg_start =3D ((unsigned long long) offset) >> PAGE_SHIFT; pg_end =3D ((unsigned long long) offset + len) >> PAGE_SHIFT; =20 @@ -1501,6 +1515,10 @@ static int f2fs_collapse_range(struct inode *inode, = loff_t offset, loff_t len) if (ret) return ret; =20 + ret =3D f2fs_convert_inline_tail(inode); + if (ret) + return ret; + /* write out all dirty pages from offset */ ret =3D filemap_write_and_wait_range(inode->i_mapping, offset, LLONG_MAX); if (ret) @@ -1591,6 +1609,10 @@ static int f2fs_zero_range(struct inode *inode, loff= _t offset, loff_t len, if (ret) return ret; =20 + ret =3D f2fs_convert_inline_tail(inode); + if (ret) + return ret; + ret =3D filemap_write_and_wait_range(mapping, offset, offset + len - 1); if (ret) return ret; @@ -1705,6 +1727,10 @@ static int f2fs_insert_range(struct inode *inode, lo= ff_t offset, loff_t len) if (ret) return ret; =20 + ret =3D f2fs_convert_inline_tail(inode); + if (ret) + return ret; + f2fs_balance_fs(sbi, true); =20 filemap_invalidate_lock(mapping); @@ -2010,6 +2036,9 @@ static int f2fs_setflags_common(struct inode *inode, = u32 iflags, u32 mask) } else { /* try to convert inline_data to support compression */ int err =3D f2fs_convert_inline_inode(inode); + if (err) + return err; + err =3D f2fs_convert_inline_tail(inode); if (err) return err; =20 @@ -2172,6 +2201,10 @@ static int f2fs_ioc_start_atomic_write(struct file *= filp, bool truncate) if (ret) goto out; =20 + ret =3D f2fs_convert_inline_tail(inode); + if (ret) + goto out; + f2fs_down_write(&fi->i_gc_rwsem[WRITE]); =20 /* @@ -2964,10 +2997,16 @@ static int f2fs_move_file_range(struct file *file_i= n, loff_t pos_in, goto out_unlock; =20 ret =3D f2fs_convert_inline_inode(src); + if (ret) + goto out_unlock; + ret =3D f2fs_convert_inline_tail(src); if (ret) goto out_unlock; =20 ret =3D f2fs_convert_inline_inode(dst); + if (ret) + goto out_unlock; + ret =3D f2fs_convert_inline_tail(dst); if (ret) goto out_unlock; =20 @@ -3353,6 +3392,10 @@ static int f2fs_ioc_set_pin_file(struct file *filp, = unsigned long arg) if (ret) goto out; =20 + ret =3D f2fs_convert_inline_tail(inode); + if (ret) + goto out; + if (!f2fs_disable_compressed_file(inode)) { ret =3D -EOPNOTSUPP; goto out; @@ -3998,6 +4041,10 @@ static int f2fs_sec_trim_file(struct file *filp, uns= igned long arg) if (ret) goto err; =20 + ret =3D f2fs_convert_inline_tail(inode); + if (ret) + goto err; + f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); filemap_invalidate_lock(mapping); =20 diff --git a/fs/f2fs/verity.c b/fs/f2fs/verity.c index f7bb0c54502c..aaf3e754140a 100644 --- a/fs/f2fs/verity.c +++ b/fs/f2fs/verity.c @@ -139,6 +139,10 @@ static int f2fs_begin_enable_verity(struct file *filp) if (err) return err; =20 + err =3D f2fs_convert_inline_tail(inode); + if (err) + return err; + set_inode_flag(inode, FI_VERITY_IN_PROGRESS); return 0; } --=20 2.35.3 From nobody Sat Nov 30 05:41:35 2024 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2047.outbound.protection.outlook.com [40.107.117.47]) (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 7D2C913B5BD for ; Wed, 11 Sep 2024 03:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026242; cv=fail; b=G2QrgIBQhUFFk7YrHGwoGeVmz51J5imkmwN51icnDeYkPIHXxK+erdCxftUzMuN59RtxyVOkCxm76JNhAcpPTHTUxoE1eMt40/mYHwoh4WnTZeAVGz8FH0ybjCtRbjoMk54c30musff2lLpds9kw73ZnMgZzX/DYYELQInjvlFk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726026242; c=relaxed/simple; bh=4b21qwXYmc6BNWSeLiCzttwLnHxTk3EYJG6mv1Wxsy0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=qBmrpDTbifZIewcA+W7nuVMNctzMWI/5AnQ9o+V7DkqCoh797RhMWz7zRit5IBctyax2SkmCEMuvhjSxRFrtSmNAsNGMsTkwRdIgef0ccjO6IUGbhpK+TSatIbi6wFOMWgfl9GGYebJ9YAsIIecL9XpDUnNVuJ/JFZjv3/ScMm8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=naKQ+KNy; arc=fail smtp.client-ip=40.107.117.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="naKQ+KNy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rZgyVmNgmBfJ+7r3/AeKuDruuwGwjoo5+R/BipKBUnRqoISC3LRFlOwQcSpj0tIYx+gO1KY8+3ABMMmH41b8U43Rl9eI80x7BiDy3SnxQQV4XEF4vGxEVZGO31SSX1UruaCjxIJ3RZAAJKWcDLsTklvglaM9D3qLc/4qyCHcrEEfMwfdFqYl4dQTs/FQcrhY3j8AEvYTdPpHltPNixXEzdITdclg5H85nfmGzeih0f9g7Ykokm1dYqF8b43YxkRm+g8HyGTkhnoiJed/g87VEruCr8toUFeC9Zedxy5RsM0unV4Mr5fA1BHLSJuX18DBVEEYkwPjReBxJfEDjb5ltw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/598dfLJPy+7sPDqd8Q4BZGjCDpXKKLbaoHLDkGjkWk=; b=fYMiaqLP7sJ1DLz5VqnH3vnk7asm2w4OzLIpoFGCCrZ2MJ/i0FhpSpCSIH/1e80Odhw+R7fG0pgVMkQToQqvM+ShtBB8C8tAHacufswwI3JT2PZoGFep7Z49ts2jlsjCrxtAkdv0ptmrnOea725LIMiGC0Sx+Sj4YJS37nxnPdRff5D71agIyuNGpG+dJdQ+lm/WMHxIkXw8TDyjHzTMRplW4B33mO6fl3LVWYFgfatF54FZGrXRGZ3y1ZSh3WvNX7ea6ZBAxbTO3dTbxTtqruHnMCItddAG5bpD+Q79CvluX6vfbt/DOkF40FL22TuJBQA/QzKyszInNJ7/yyLgug== 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=/598dfLJPy+7sPDqd8Q4BZGjCDpXKKLbaoHLDkGjkWk=; b=naKQ+KNy7lB0LmMIhSQv4chHha5Q13OASrIPMSfOm1cQsAujAEVXRVflXIRnrWeBQGUGdLU5B1vJr1Mg3npqRDTmIGy7zsvG5gSyfkaWr4wAtbOi4AK/ZASf7Jceux2P2UXHyrLBA+KCy7S5Z16PdIKb4wk+8k9LzUlB+ECv3+yCkHMq82QHZTZhKpFG+dCqR7kpRVp/dpmvJ66K95VIw1QbQESVc85GTKgVJE+Yeb+GjoOmBjY8niQqsvAKi5XcF5Tg7lqjcoiCYC9CnU3WT0x9ZoDJiMGYomxQJ9/VIYt6Z0SsI/Nctlplmb0Vijf5HJy1spcoieQZjPmt0gVIiQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6917.apcprd06.prod.outlook.com (2603:1096:990:67::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Wed, 11 Sep 2024 03:43:49 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:48 +0000 From: Wu Bo To: linux-kernel@vger.kernel.org Cc: Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Wu Bo , Wu Bo Subject: [PATCH v2 13/13] f2fs: implement inline tail forward recovery Date: Tue, 10 Sep 2024 21:57:26 -0600 Message-Id: <57e1dbb2f348ab61cbc82be7161d788a08b5fbed.1726024117.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: PSAPR06MB4486:EE_|JH0PR06MB6917:EE_ X-MS-Office365-Filtering-Correlation-Id: 0af2ed3b-d4ad-4a41-ebcf-08dcd213f211 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|52116014|376014|38350700014;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5tzOT37zjYagmBSWL4X2bnVtArwr0BMvOwhrtxGTM+Bg4p?= =?us-ascii?Q?jHp6mZtceoFzzcboA+cYLSBoXAkdoSPFtaYQoga7CMR/YbtzHydo5yo+vjp5?= =?us-ascii?Q?HvsxXgZmOYuCK1kJfMQ1vdqxbwCvm4yW6gmnZog6A4lZu4u7B4jt9MuouXMv?= =?us-ascii?Q?JZ2WG9iPPRnhbVKFOoAGzmjBYCJlTrttNQ158/vMCcOlND8o9yzxvKHwnPmL?= =?us-ascii?Q?3iHsXuq0M5jM9BPia5OyX2xfScEqILKaqYatfgjbfkp35/SK8yMvdGr4NUoW?= =?us-ascii?Q?YJ+ZPtgvKC/mHE1Ihnk4iVmPdsRummNWDnYvHjkwwaimOFOULiowv8Gt1RUv?= =?us-ascii?Q?psdAmcU1gmLWvvS+gSKv0GG84CuyOvA3ged6jQzmlPF1ulHyR+oyYa5Tcgwq?= =?us-ascii?Q?R5jK4Z2l4ShGmBHrKyJ1WdG7l/whGDyah/0a26ZqBmx3kDFFapInAR+mZt7u?= =?us-ascii?Q?zIRfsU7xzRfAVm66mMAplS7NRVJ/ybo6GBon8W8lJzbsOnZOURhsHRl0HCgF?= =?us-ascii?Q?wGTxIo0wkl+YpNoXDOZ7QD6lchZXIn/WW554dpKMoPlctk2Mmw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?czu8XGCwmSm2Vv/o6eGzVGOBRlIrmCGFMpH9UlB2aebllBZLndqvOPBifXLm?= =?us-ascii?Q?DO/EnS7orxqGh+0Iu0NHNHirHpYxkpyLyGv70qP0orcePqX3dF+LSX3fbs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MNkboOuKLuW1heFlvSFar05ZeALZebTbSLhr?= =?us-ascii?Q?x2Px86NZmcNzVx8OHPeYzN8PlHDwQa53fzmn4KQORKfWz/UyTTUrV0yOfPgP?= =?us-ascii?Q?wr8XPUm0IGVPRBHPip6FyaEoqajX9I8ycS2hYRbWHrhNvRT+auy0izB/dH+r?= =?us-ascii?Q?7dO3bamKhFRlyqI1D1FXn0erT3K71N4pBXu2SE1yExPrK6Pb3ngKYgMrTefE?= =?us-ascii?Q?9Z71jHRcq/engCXv0h9j4Kx9suLhHR2h6pthqOSxsMRGxqXs1stBwcQt0qov?= =?us-ascii?Q?GG0mOhXzqmeVmlCvQoVC/fn01/ICF9f7JsHOtkX4znVUXKBrwclfP0nHjCKN?= =?us-ascii?Q?nEZhdjn5eu0NAG+sDF9NOX93rZBOfeNYvPHb+EFsqVIFeAvt2MDmQmgl8Knq?= =?us-ascii?Q?FPGNcUCya+o2hCsKYRP1SlaHW1MZ2GjFzy5J5IBgaKOAfmxkUkhBZ//hFPiF?= =?us-ascii?Q?wvXxopX31i1H3p/3L7Nyj0KX06QdEQryHJVcZnFBDaukSyjtH0OCROH3mQ9y?= =?us-ascii?Q?TYRte7Q5h8qzSMg0AW9rsOV/j1Fs356z2NNAkQOSGllYu4P9SbWoAXHhzeAG?= =?us-ascii?Q?2awPX4e/UtSyrrW97vIjij/PLK+c/h43O2AW4BF6?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0af2ed3b-d4ad-4a41-ebcf-08dcd213f211 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:48.8654 (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: ACRkSFC6+7TSsZkqWtLOu+LTU7rH5+DjtfkV7Twz8OuLjsTuOAU/02b8CU8gwllDyEB5bu3pQLzvihpVBeEl0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6917 Content-Type: text/plain; charset="utf-8" The recovery logic is similar to that of inline data, except that the inline tail may require recovery of some blocks. This is because the inline tail has a 16-size block address array, whereas inline data does not. Signed-off-by: Wu Bo --- fs/f2fs/f2fs.h | 1 + fs/f2fs/inline.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++ fs/f2fs/recovery.c | 9 +++++++- 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index f889d97209c7..7d5348e2127b 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -4217,6 +4217,7 @@ int f2fs_clear_inline_tail(struct inode *inode, bool = force); int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry); int f2fs_write_inline_data(struct inode *inode, struct page *page); int f2fs_recover_inline_data(struct inode *inode, struct page *npage); +int f2fs_recover_inline_tail(struct inode *inode, struct page *npage); struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, const struct f2fs_filename *fname, struct page **res_page); diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index c2f84f3dde67..76e0ff62be51 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -414,6 +414,57 @@ int f2fs_recover_inline_data(struct inode *inode, stru= ct page *npage) return 0; } =20 +int f2fs_recover_inline_tail(struct inode *inode, struct page *npage) +{ + struct f2fs_sb_info *sbi =3D F2FS_I_SB(inode); + struct f2fs_inode *ri =3D NULL; + void *src_addr, *dst_addr; + struct page *ipage; + + if (IS_INODE(npage)) + ri =3D F2FS_INODE(npage); + + if (f2fs_has_inline_tail(inode) && + ri && (le32_to_cpu(ri->i_flags) & F2FS_INLINE_TAIL)) { +process_inline: + if (!(ri->i_inline & F2FS_DATA_EXIST)) + return 0; + + ipage =3D f2fs_get_node_page(sbi, inode->i_ino); + if (IS_ERR(ipage)) + return PTR_ERR(ipage); + + f2fs_wait_on_page_writeback(ipage, NODE, true, true); + + src_addr =3D inline_data_addr(inode, npage); + dst_addr =3D inline_data_addr(inode, ipage); + memcpy(dst_addr, src_addr, MAX_INLINE_DATA(inode)); + + set_inode_flag(inode, FI_DATA_EXIST); + + set_page_dirty(ipage); + f2fs_put_page(ipage, 1); + return 0; + } + + if (f2fs_has_inline_tail(inode)) { + ipage =3D f2fs_get_node_page(sbi, inode->i_ino); + if (IS_ERR(ipage)) + return PTR_ERR(ipage); + f2fs_truncate_inline_inode(inode, ipage, 0); + clear_inode_flag(inode, FI_INLINE_TAIL); + f2fs_put_page(ipage, 1); + } else if (ri && (le32_to_cpu(ri->i_inline) & F2FS_INLINE_TAIL)) { + int ret; + + ret =3D f2fs_truncate_blocks(inode, + COMPACT_ADDRS_PER_INODE >> PAGE_SHIFT, false); + if (ret) + return ret; + goto process_inline; + } + return 0; +} struct f2fs_dir_entry *f2fs_find_in_inline_dir(struct inode *dir, const struct f2fs_filename *fname, struct page **res_page) diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index 9756f0f2b7f7..d73a557b82d9 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c @@ -645,9 +645,16 @@ static int do_recover_data(struct f2fs_sb_info *sbi, s= truct inode *inode, goto out; } =20 + err =3D f2fs_recover_inline_tail(inode, page); + if (err) + goto out; + /* step 3: recover data indices */ start =3D f2fs_start_bidx_of_node(ofs_of_node(page), inode); - end =3D start + ADDRS_PER_PAGE(page, inode); + if (f2fs_has_inline_tail(inode)) + end =3D COMPACT_ADDRS_PER_INODE; + else + end =3D start + ADDRS_PER_PAGE(page, inode); =20 set_new_dnode(&dn, inode, NULL, NULL, 0); retry_dn: --=20 2.35.3