From patchwork Wed Sep 11 03:57:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CDCA4EE0204 for ; Wed, 11 Sep 2024 03:43:45 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGg-0001sg-2J; Wed, 11 Sep 2024 03:43:45 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGe-0001sW-Be for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=789fi2cjANDVURtNHSKg2uT0fvFJ1Bmx9d+l7fPmobM=; b=ADP7lKjgaNSkR0hiWJKRI2Y0iK bgsTIIIwWub5CgWjGtR3/BdFY7AmVVe0Krpec4zhoB7DhxDlVsZM0BYTpyNWvnEJcEpZV9wOGP8Mg 4rZ58Y1R0+2OIl3o65qKbC3YZMkDWoLxlcxD6uv/hsetw/eH7C0lT6D++a/dV3xA1VrQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=789fi2cjANDVURtNHSKg2uT0fvFJ1Bmx9d+l7fPmobM=; b=byTNrE6OVjdcolzUKEPlvk/uK6 o4v6Z9Krs4pd2YO+HvL7APLmO+GBr+GifRfPD0zOSc1nbWHjVJ2Dsfpw30bJB2hc8riXCQuIAYBRl 7bXk6y4X1tsDKAIF8ZD/8nL/N/v98KxFQ6mIvlbQTOywVA7brxzo9Mq3T+dMkCbGokSQ=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGd-0000Nz-3C for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:43 +0000 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 To: linux-kernel@vger.kernel.org Date: Tue, 10 Sep 2024 21:57:14 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: DkEWqez+q8xUJs+KbGF7e3ctqPjEnVkmadRsVAUBzQx0fDKTpUPF/dPbjcgAoZCVKTiMWkVDOiVP4gfigR+99iL1n10/XoWhcvFoQ+iPCsUmxWA7SirG1j5vzsYAauxMuos1zNkxm056jy2y//GOjT2LV84v9S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Se9GRcRqomIn0FGx6yO2wPvpBBGxsbUANxAV5gK8LNbNUSGlesOdvWii7ydczdc3DZEOayabdTAkJ91d7Tz6ZHpIGsFSgPlMPWva/9PRg5g7twlMIa1RtcqMnPeyVkp8N9uJVUqvkLl5LpLOLubdJ1J8cnzWUEyx2lG74/vHwnVE8392p1aQfWPEGc2AA7TVp/dPOsyjfw== 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: GOlSSmpk9ZGl6RnpTwF5ohzmg3uTwU0CluAOyZ0L1OWde74qvGjCn5ghetXWSsqoJREhYoxAgox06QWKBouho0xsRKetAPKou/bJvU62O20V39Icrlt5wJs2iE/FdRH4TmbDspUKrwC8iHovoUHfUxnVVwLvWiY/WxsrvYnfCGM5ZP3EgTIWsiKds2pCfK21Ot9/N3vDMq7N5ZDk8vnER+lRpTRaKVJjPPKf1FVJ/4/NAyoQ4hGJjEzjohlczM6MG+rz8aJtAHBtZC4umEmZDOzFVVJorYICV0Mca7eML15LFxN/WvdslVFBwmNqHedIXvb4g/Uh1QDWfTwUOKNv7Uj+9kvdP+ac9I6KbUT4hCJhpj6hPOOyrCOwmsthcFAz5PpujsnOhj4mSs/Xz0L9v4x1+QAQ1exVbIbJwAPtWOCgLKdPCwW+avIEGAZWOc/kMeFLxhb0MVw3d3Zgxsq23Upsi7GNady5jVUgCrVPAAXb2+s2915DJ49cqsOSvzIP/8VWl/wD8oyQR32sb23+su9rOvXjrVC0t4tTZ4Q4p4ta/HgXB9spbvHadvu/SNvaYq0+w/2yqB1vwMyfmQMPw8DyT4KZISkhWJnJOHoDhmlIJEXw6Gk18QV6bKAjJLLGuGHvBdGmad6EeWFTwqHYvikJsiE13ksjgX5Ueqh5o6tCePxT6GGTohUXncjh2QMHCeY20DTjn8GNjzPh1pIOLM6LSQEPkoQCMnP9AIRVYB4RDHeiSx30jHtccAl8WVjfiekDEKyL+SXodV/KxXHsCaAUlyXKBOcgAYo9WdSoA9Df9Ik7wERzSrK/+UMUAvottMU4T9b81bgiGULggir1dz8kyOKNueP0+Gt2yXG/4SdF8ecsMsFC58VRHmJYZMrGKx3piDHVDhQqbKhlxxbKv2qJbrN/LcGLPz84yLIct/qXzAqeO5UoXka3MDuND4wNqNfK3HyDC/XLLwjjeUDbUNai4dulcw1zflqxFhWLOFY+sNf7vTk7YE2BLmrRqqc/XKXUsB9WmlTdTfZgwyZoCWtYM1W3CLizsklq6rmJMRnhqsu7LXfIxbcgkCemlfAPTuHW4rbOIZuuwIAhy/NhLErM/WyPGzz9iGET5YuWD2Wgpp8ii4u1Miqz7oJUMFCE+0BJlIAXW3wygXbhLY6AJElvhUl5ZWWFJAd2aNG8TYebf0cuQ51DnFGuO0gRZiQ21sNiRFsT70YpJFWrcip7d5NyMhbbUjRf84BmUuX3YSrn7O4EXB/cpf6wCNQwuOEH+o9GJ5UrIpPmWQsZbuSf5rsOPQHald5m/4KSMD4Kmwnm3zA1s9F1IWlKaQykTMUBiLUZ29CHhYTuYJFhEq2RoiJbeKdy9/cd8aQIgz+Gtn4AnMxmINVQv/Qepy0UYhUCg52DymHusQbjA2K2iF0n9EV0JLiPgT31Zf1ttyLg6gXoHPxqc5xT8iuJJgzDo4UGm7qPBbt0iDGaCp6qrVWyHHLcKZpiOF8DZPgOFQpUuTDzZsF9yImcOEKSFSY36NVQBKeHTOSjHhD8p5adhOymDwNZFNu1np7az2v6QceZDmc6NK7O2pcSfEpDT8gvr+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 X-Headers-End: 1soEGd-0000Nz-3C Subject: [f2fs-dev] [PATCH v2 01/13] f2fs: add inline tail mount option X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 #define F2FS_OPTION(sbi) ((sbi)->mount_opt) #define clear_opt(sbi, option) (F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option) 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 = { {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 = { {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=%u"}, {Opt_resgid, "resgid=%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, struct 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 = 0; sbi->sb->s_flags |= SB_LAZYTIME; From patchwork Wed Sep 11 03:57:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 83DBCEDE997 for ; Wed, 11 Sep 2024 03:43:45 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGf-0007bX-5B; Wed, 11 Sep 2024 03:43:45 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGc-0007bN-NN for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ui23Wl4gzNHQSlumlPbHvIZ7K3txKFrFBs2u97Fs0kA=; b=PiiXXqu2lWlNI7xJ1lfPpu6RZ9 ueVeA5xxW/ZNBwb0rR7eELNcC68sXcLiZSnV9JKQxK2Y+8tmgHFMk3jlddKyajHQKQ6bJFfPLqFao Df30szeeGwW4K9sQBYZOQziCemsVfWxI2FmeeCztTxaKg/Pq0pfsn0XRWJqG8s/UQuwk=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ui23Wl4gzNHQSlumlPbHvIZ7K3txKFrFBs2u97Fs0kA=; b=B0eAz2punNRgXMk8npx7sqAluk xvJcn2H/hiABiCPAJpTHM3dCI3X+0oo62reN9QHIIdBJUDpzZqXMsKHzwIG0RcPtaOcUur78nH53M tic6CT2SZC/+vRvuazL0yI83VxvEad5UJqNLbRu1xWsUlPPvy40NFryrCFg27Dj1d9mw=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGb-0000Nz-Tx for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:42 +0000 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 To: linux-kernel@vger.kernel.org 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: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: SdM9nOqdPJ1yGyT9w4EX4fSf+qitFm8s+/3bVAF/UfvjnBVxBGwSgerLdGnHtim2sdVmltj72TeLZYBY3/lJaepyioCel+S0wN0L3zuWf8QRpn0jWLYHQ4ykfCH4nw0oJGPz1i5xQ6Iz1upsgZ44XoYvVNGsKVCiKycea5QXUzWiAcsEf91a+NJ73lvaG5hVR86XbTe6usUr+rhPpQ7FmEThVE4VFLTCufeboENoS5eNTWbTxikzySybATNiL+IaUy8VCAN/HI/Kyg7PX2mJQnsaMPa9mccg/SYfXbpuWzpuOqfAYzmh++lFULD5NoNW8RQ0mBAeRTogVAmj+cm+lCxsbju8HQg+yWo3OhPJDQHhxEH+i33YZp3b5Iv8mrLVphtCYZDlEFoGPJgYcX7cuJnJxNAb19XL8JBHaOSBy6g/QK+bsmAkyhIAEMH0iWCbes/oJDLC9HVPwOUA1H8s10iGZw9i+7c3MN7jd6WEb7l3i57YQuyM+adg8WIGTUvBmXLap2wCEo2Mu++u9kZXjjpqV0n+Uur0toMXek1MWxbLCzGw8R+rlJzxvGD8lpUvq4fvD5GGkUWThZx3wpl4mzC0r3RtpJuJt9lKNvbwpAHUVyIQ8KzU32F59vx/IR350WcCcLX3wJsHamylPRs2KTPISA6pp8h5yoPSt32zflZTwqo2SSTzjZqB+WAPrdl/vBnfOiBGffsxs6exF+hGCeeWYH2CYAMkCW8x8bB242aLPrA8Lah9NACBFYzc++X3R+1d4dLZWcM+Vit6AQICnKHXJTlDHPovHB9MWJZ64YBVtLNj7b2o/PRYkXo6BNopMfwBLw0WPnIZc/t2s2JH/59RY9sf2DXHn1Yhx5twsMsjvre6J9x0BlTXgKmetoj3bZrKa5PAo50soNsjhKchUfxDv576iPdMkPwMnwvJT1JkQt935vYFzVF8K1L0SrEoPndBzpp/Vr7tGAZAga/iMe8gWGJLp+Yn87pmgUVnDHD8SvpKCXaFQ6b4xvfsFQpKgIluyPpOh6k6nkqy4widw2h+zUXuLED9OnszpzyzRZbAvtK21XnDxazxKZL5tLi2wcomq9hUEgPOo9/0CWY3KPOiK3LMreg6LsEpsWp95+T4IpXXJCSE2HREGNu7p8FPgUqyD3g+gptVMWHAaiBt+7atwdJIgBLNm+Bw+J2rs13bp16PjI+7KbULL3npX1+M4QdVfXUZiExqTGDeHr+j/xJbe/8iAouSXeFSFlniUdy9OV1NiNJL8mMiQ5OBiqmHZms9qjD3mMHM+UhoXrbX3sl3kQSTZpJ7ntbs88B0UsHJvuXwJBELCxUHXx6nOoZf33J39k9EuZzUDsy+rGdCDiR+vP2AheP+HCQHhvzSxENYH+wa2kUb1an/krMAChK0iyP+hUD23iSRKoIJNVIifg== 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: NT5Md5M7L/yo9Pv0+BO2a0VK5M3UdlBRczlFRCobPeeHo3IVEh7GiDhK/SEJ2r7ZF/I0yzKW5RalIEh7ZdE+VIIrZG+yZpQYRM6X/Xj6N3gK6nCyMRI3UjwLm6eYAe2MG5cVAQVXu5Ef9N7fAxvnnOV8pHOmAIpmCl2+19hIqYOEcGi3pSVTT9cjhvbEGJz+T/f1qn9ue//zt5xO74JrLIsTjr1EY2qULqtL6pZeClubsAI/2zzgOJvsxWfReig9L/YamH7yTChvfydIFsz9Bj61uwZ6QO2byc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v1nUyvve3Cy24+XBzQqP847VKR45wyu3H1ooYCHscQgazB+PLuED7jQcMn2Mj0dF99xf3DD6Ld86IwTsWfcoImmp+LIr2QPwSZenc9oe0ou6v2UaQbr3N0ytrZ+oDO6LvUhB8tVdX7TpqWE0J1xUkvTApRr8vSSJQWo5zNucVn1n28gKGV5wq+T2dpE5gxKaAnZ0kZF5+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 X-Headers-End: 1soEGb-0000Nz-Tx Subject: [f2fs-dev] [PATCH v2 02/13] f2fs: add inline tail disk layout definition X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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_journal *journal, /* 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)) /* 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 */ }; @@ -3002,6 +3008,7 @@ static inline void f2fs_change_bit(unsigned int nr, char *addr) #define F2FS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */ #define F2FS_PROJINHERIT_FL 0x20000000 /* Create with parents projid */ #define F2FS_CASEFOLD_FL 0x40000000 /* Casefolded file */ +#define F2FS_INLINE_TAIL 0x80000000 /* Has inline tail */ #define F2FS_QUOTA_DEFAULT_FL (F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL) @@ -3263,6 +3270,11 @@ static inline int f2fs_has_inline_data(struct inode *inode) return is_inode_flag_set(inode, FI_INLINE_DATA); } +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 *inode, struct page *page) { __le32 *addr = get_dnode_addr(inode, page); + if (f2fs_has_inline_tail(inode)) + addr += COMPACT_ADDRS_PER_INODE; + return (void *)(addr + DEF_INLINE_RESERVED_SIZE); } @@ -3428,6 +3443,16 @@ static inline int get_extra_isize(struct inode *inode) return F2FS_I(inode)->i_extra_isize / sizeof(__le32); } +static inline int get_reserved_addrs(struct inode *inode) +{ + int size = DEF_INLINE_RESERVED_SIZE; + + if (f2fs_has_inline_tail(inode)) + size += 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 = ri->i_dir_level; get_inline_info(inode, ri); + if (fi->i_flags & F2FS_INLINE_TAIL) + set_bit(FI_INLINE_TAIL, fi->flags); fi->i_extra_isize = 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 page *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 |= F2FS_INLINE_TAIL; + else + F2FS_I(inode)->i_flags &= ~F2FS_INLINE_TAIL; ri->i_atime = cpu_to_le64(inode_get_atime_sec(inode)); ri->i_ctime = cpu_to_le64(inode_get_ctime_sec(inode)); From patchwork Wed Sep 11 03:57:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799659 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8AB1EDE997 for ; Wed, 11 Sep 2024 03:43:59 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGt-0001vB-Uc; Wed, 11 Sep 2024 03:43:59 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGr-0001uv-W0 for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jKRdl5s09iCG/1hRn+pGFaA9OVaf3V4M//GwCRvnKxk=; b=LgIkBPDwWn4PGH6BkUbnwK01GI kMHhDrUClZVHE7kKq13l77DK/tBPJTJvHWjAl5DobdTQ9W+bkb/0hWpLGn826enZVYRLdH65Xs8b3 9qYs37HsSKLwasSfwPj7qJ3+kHozYcLLY4p1T4pCiKcPi90NzXKk2YXL7cIvbwFit42g=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jKRdl5s09iCG/1hRn+pGFaA9OVaf3V4M//GwCRvnKxk=; b=VONcPdPFb75LGo0SsylWC18RnX XIqkAZpfEoPpKpVrDs9ij35R8Wd3u1qLc/D3lRPZvmBNau46FUNKkORGpArG1mrYKySFvnk2fozST JAuMSPuMTKszpXwhnNXbdXZKUCSFrp7a0lk6/kWKOYSsII513magvcetsE2QOnDGN++w=; Received: from mail-psaapc01on2057.outbound.protection.outlook.com ([40.107.255.57] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGp-0000Oo-Fr for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:57 +0000 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 To: linux-kernel@vger.kernel.org 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: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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-Antisp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gZG5KGjElWCls73NYTs3+mTLOPjG4FfHN9hPupWQazCPbcLFnD1ysJJoykRal861zlHgkWQrDz3q8ApbLMuSDUFukbf057lMoxI1dYVq67nnsDoOYUmEBj4uPHk3gfBRMXTqV/A44u9HMt616crZDbmbEnuo72B08pPeGH+1xvLXU4KQAF4ajajdAt8yo63P5mDDr0ksfDRqu3ikc6FDWz3+1FSHANsxgaA6G70d7g1aCcvycTraMPR/uCwRjRKrkD3idPcEIwuatrKU54mNVXwdM9jwdzprcCoUw2/25XULD09Q2WrWkwFTBS236nanEwyUj/2yJ9mNu2FC2qoaoDTv1zpjwzYqQxuTHEzUQnx8WLdpopnIAF0YJpsZK7X37ODpQc+EV9POe30KEgXbVsGISmQ== 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: y37IUIzDGR9ofzg6GOtfvgbVDpJYEL8L3ALVR0z+/iuJ57v+2Yle61SpuflvrZWbxkg4lDs55Q4e7tG+nUeUbQCr5yquprGclP0NMRJU3qarhbmmOallIMtcXJkaxzUo/Fn9RQAXQ++3LnATq0aNHfG2HPCBnCuydvpGRxfFjbC1nJk62ueqYjhKqpn7NF+rN+wHGVxRH7y/sG79DI0rYjX01AqFrWQFNj38rYieHKQu8ar06LiIkI0K8ZV4uAtxytzFIpcsxh0Utz3XZL8ZjcT2gzwX/X8dQRbEA0QuQzuZu2lmpTOlRn+4ajxXrUYyNsJk419DXCegotIQovDYFf0Nhpow0gh7ay+FjqSNaCyPca8wiksC0TCo/IU/C8cRQSwx55oD+3JpXRDS4ceaG6iY/rsNJ6r4YoMO+csyIkdn+ZJIsFPluPCwyb3Gx+5RLTSw5qNwyio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qzREl6RoTUd/VJGWL/e/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 X-Headers-End: 1soEGp-0000Oo-Fr Subject: [f2fs-dev] [PATCH v2 03/13] f2fs: implement inline tail write & truncate X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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, int *submitted, loff_t psize = (loff_t)(page->index + 1) << PAGE_SHIFT; unsigned offset = 0; bool need_balance_fs = false; + bool need_clear_tail = false; bool quota_inode = IS_NOQUOTA(inode); int err = 0; struct f2fs_io_info fio = { @@ -2867,6 +2868,16 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, goto out; } + if (f2fs_has_inline_tail(inode) && page->index == end_index) { + if (support_tail_inline(inode, i_size)) { + err = f2fs_write_inline_data(inode, page); + if (!err) + goto out; + } else { + need_clear_tail = true; + } + } + if (err == -EAGAIN) { err = f2fs_do_write_data_page(&fio); if (err == -EAGAIN) { @@ -2889,6 +2900,11 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, if (err && err != -ENOENT) goto redirty_out; + if (need_clear_tail) { + err = 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 = F2FS_GET_BLOCK_DEFAULT; f2fs_map_lock(sbi, flag); locked = true; + } else if (f2fs_has_inline_tail(inode)) { + if (!support_tail_inline(inode, pos + len)) { + f2fs_map_lock(sbi, flag); + locked = true; + } } else if ((pos & PAGE_MASK) >= i_size_read(inode)) { f2fs_map_lock(sbi, flag); locked = true; @@ -3421,6 +3442,15 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, goto out; } + 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 inode *inode) return is_inode_flag_set(inode, FI_INLINE_DENTRY); } +static inline bool support_tail_inline(struct inode *inode, loff_t i_size) +{ + const pgoff_t tail_index = ((unsigned long long)i_size) >> PAGE_SHIFT; + unsigned long tail_len = 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 from, bool lock) goto out; } + 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 = f2fs_get_dnode_of_data(&dn, free_from, LOOKUP_NODE_RA); if (err) { @@ -4703,6 +4706,13 @@ static int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *iter, return ret; } + if (f2fs_has_inline_tail(inode) && + (pos + count > MAX_INLINE_TAIL(inode))) { + ret = f2fs_clear_inline_tail(inode, true); + if (ret) + return ret; + } + /* Do not preallocate blocks that will be written partially in 4KB. */ map.m_lblk = F2FS_BLK_ALIGN(pos); map.m_len = 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; + from = from & (PAGE_SIZE - 1); if (from >= MAX_INLINE_DATA(inode)) return; @@ -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 = page->index; if (!f2fs_exist_data(dn->inode)) goto clear_out; - err = f2fs_reserve_block(dn, 0); + err = f2fs_reserve_block(dn, index); if (err) return err; @@ -176,8 +178,8 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page) if (unlikely(dn->data_blkaddr != NEW_ADDR)) { f2fs_put_dnode(dn); set_sbi_flag(fio.sbi, SBI_NEED_FSCK); - f2fs_warn(fio.sbi, "%s: corrupted inline inode ino=%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=%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 >= COMPACT_ADDRS_PER_INODE) + clear_inode_flag(dn->inode, FI_INLINE_TAIL); f2fs_put_dnode(dn); return 0; } +int f2fs_clear_inline_tail(struct inode *inode, bool force) +{ + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); + struct page *ipage; + loff_t i_size = i_size_read(inode); + pgoff_t end_index = i_size >> PAGE_SHIFT; + + ipage = 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 >= 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 = 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 = page->index; int err; set_new_dnode(&dn, inode, NULL, NULL, 0); - err = f2fs_get_dnode_of_data(&dn, 0, LOOKUP_NODE); + err = f2fs_get_dnode_of_data(&dn, index, LOOKUP_NODE); if (err) return err; - if (!f2fs_has_inline_data(inode)) { + if (!f2fs_has_inline_data(inode) && !f2fs_has_inline_tail(inode)) { f2fs_put_dnode(&dn); return -EAGAIN; } - 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 *sbi, nid_t ino) { struct inode *inode; struct page *page; + loff_t i_size; + pgoff_t end_index; int ret; /* should flush inline_data before evict_inode */ @@ -1521,7 +1523,9 @@ static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino) if (!inode) return; - page = f2fs_pagecache_get_page(inode->i_mapping, 0, + i_size = i_size_read(inode); + end_index = i_size >> PAGE_SHIFT; + page = f2fs_pagecache_get_page(inode->i_mapping, end_index, FGP_LOCK|FGP_NOWAIT, 0); if (!page) goto iput_out; From patchwork Wed Sep 11 03:57:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18D22EDE997 for ; Wed, 11 Sep 2024 03:43:49 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGi-0005jC-Ox; Wed, 11 Sep 2024 03:43:48 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGe-0005iq-U4 for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=zV/wxBoWCpRDMX0E9pav3c5V0+kf6YRvt/E5k66a+Hw=; b=UPGO77s5mQph01ZVD/3T0rkupJ 1KAlpW/iyZB52dQa8tnNitS70Ph/dn6/c+hDM1cu4bpqu/XSK1/i+O7azCJVbfk/DyVSJw6aFtGoN Y6KpZtDP4mpt9SliHfO4blP0pg9cHgLjhtt9qDco1pHfzf7JZLawqlBlQqCN4QV7UMm0=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=zV/wxBoWCpRDMX0E9pav3c5V0+kf6YRvt/E5k66a+Hw=; b=FNh+qIDtSMpAQaJvjsMFXzKjA/ PDiq0WE+p8otMcV6WH+GOhUVa0GIZGCUEBX+uXqa3+vBDHzDVyiU1W2qLGRUl7L9aYWbH92Kb2Yod oc7pkZ1rCVkbb8rW+eWA64hheGnyBdi1I2lx89E/dgNh6zaSwPNkTvknHglmqhihhSp8=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGe-0000Nz-5S for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:44 +0000 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 To: linux-kernel@vger.kernel.org Date: Tue, 10 Sep 2024 21:57:17 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: yLtzmSq2G1IeBkYrVwcs9Pegz+dmRCu/LJknhNkEktrPhu0N+pTD5g9lQ6PJm5jOHW7FFezIBAeE5pJNyiyJusraJAMgKPzVdLZPKffCsCOF6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Qxr7VDEF6KaL31T6vVDlLjyzGOLVQeRl6eUTfPOcJczsOFImXzaJizwa5NhevsP58SxR1p6P/VDqIESPTyMWTr+4LIFPY4zKk3viX072wzJ+hlaGSrX/YhlgyCrThkjGMOrLuSmb/gbAQZp75p0znjsN9+JIebcEtH7gnfOBJJVcabhEF2MT+wWVxDnZvKATuOZjJJI5PGqDPjeF8LWOtDOwOTlSY6xHD8dUCwZAc3OSLPl6wxCw== 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: d5VS0CcjORqSCPjnC82nRv6k0pf+dCtKBXsQat9Z5ilIAr+AkCOA3aeVwo4NCTASaN+yDQt4s+OGR+YwTTDAI3Ws6q5QMjR2MBeSYl2g58A1FduB8YbbO3N6/f/Xf5+zSz3qJUrgxNrOZ7FrS8shpl/Gq+5QY0tWuZqcQtQWmSKRMvs2qbEK6Yr280xJCqDshVGjza6BAHaQxj5R9mroArNuAwd6F9gJtK51apEokkzaCZkx3RLW58La/t0Quo/7Ngtds/+sgCqfBLcp6G5gOkfCKxtHh6BsRnIYe5sKVGKRSStEzphh54ti5eMgVE4ORx0Uz1rTANYhvmdRDMMOJpxeE3QzpUG0lgnCpe8YmAgC0zh1T+PsZa+DNsixVs7LBiat/zmLog716NdwUFu9kqodONJGEG4W1+QjKFORDvAem6K6i0K/MPCwslju5ApLhBoS5JYlwBhVaOW3S7RtVxrAQ8/jnFjTCpFG6D9oag12U8rpLIlNQ1NiQBA4DUqiNRJAU/CQT/ZT/+PoqLXqdktua5bqya+v2Q/IKE6PxcrFJFiIq46lC4MnEuJ75f3uuOhvdafmUsR+59GS8zTndCES5pRxU0OdohLDQ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ant-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 X-Headers-End: 1soEGe-0000Nz-5S Subject: [f2fs-dev] [PATCH v2 04/13] f2fs: implement inline tail read & fiemap X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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_extent_info *fieinfo, u64 logical = 0, phys = 0, size = 0; u32 flags = 0; int ret = 0; - bool compr_cluster = false, compr_appended; + bool compr_cluster = false, compr_appended, inline_tail = false; unsigned int cluster_size = F2FS_I(inode)->i_cluster_size; unsigned int count_in_cluster = 0; + loff_t i_size = i_size_read(inode); + pgoff_t end_index = i_size >> PAGE_SHIFT; loff_t maxbytes; if (fieinfo->fi_flags & FIEMAP_FLAG_CACHE) { @@ -1983,6 +1985,16 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, /* 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 == end_index + && f2fs_exist_data(inode)) { + inline_tail = true; + goto fill_extent; + } + start_blk = next_pgofs; if (blks_to_bytes(inode, start_blk) < blks_to_bytes(inode, @@ -2000,6 +2012,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, goto skip_fill; } +fill_extent: if (size) { flags |= FIEMAP_EXTENT_MERGED; if (IS_ENCRYPTED(inode)) @@ -2013,6 +2026,13 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, size = 0; } + if (inline_tail) { + start = blks_to_bytes(inode, start_blk); + ret = f2fs_inline_data_fiemap(inode, fieinfo, start, len); + if (ret != -EAGAIN) + goto out; + } + if (start_blk > last_blk) goto out; @@ -2377,6 +2397,8 @@ static int f2fs_mpage_readpages(struct inode *inode, #endif unsigned nr_pages = rac ? readahead_count(rac) : 1; unsigned max_nr_pages = nr_pages; + loff_t i_size = i_size_read(inode); + pgoff_t end_index = i_size >> PAGE_SHIFT; pgoff_t index; int ret = 0; @@ -2397,6 +2419,12 @@ static int f2fs_mpage_readpages(struct inode *inode, index = folio_index(folio); + if (f2fs_has_inline_tail(inode) && index == end_index && + f2fs_exist_data(inode)) { + ret = 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; - f2fs_bug_on(F2FS_I_SB(inode), folio_index(folio)); - folio_zero_segment(folio, MAX_INLINE_DATA(inode), folio_size(folio)); /* 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); } - if (!f2fs_has_inline_data(inode)) { + if (!f2fs_has_inline_data(inode) && !f2fs_has_inline_tail(inode)) { f2fs_put_page(ipage, 1); return -EAGAIN; } - 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); 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 = 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); 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 = -EAGAIN; goto out; } @@ -836,12 +832,14 @@ int f2fs_inline_data_fiemap(struct inode *inode, goto out; } - ilen = min_t(size_t, MAX_INLINE_DATA(inode), i_size_read(inode)); - if (start >= ilen) + ilen = min_t(size_t, MAX_INLINE_DATA(inode), + i_size_read(inode) & (PAGE_SIZE - 1)); + offset = start & (PAGE_SIZE - 1); + if (offset >= ilen) goto out; - if (start + len < ilen) - ilen = start + len; - ilen -= start; + if (offset + len < ilen) + ilen = offset + len; + ilen -= offset; err = f2fs_get_node_info(F2FS_I_SB(inode), inode->i_ino, &ni, false); if (err) From patchwork Wed Sep 11 03:57:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E04AAEDE997 for ; Wed, 11 Sep 2024 03:43:51 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGk-0003w5-Rg; Wed, 11 Sep 2024 03:43:51 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGf-0003vs-4d for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jLg/Ort+dktxydWc7L68s9DMFyaM5EKCxEMzSwa7J1A=; b=eZKA7xHF7sXs/sDLCjJKpUXPZy j69+SmyR/hcJGoP0LusqJZxft8Ekm2UBlOEVTv3ugGb/vH2lMgZ/Ici2gK/s42xG3lC7AaYUJOUNR 5Ebg7stQGYhaSSsroCPumFyk5dGg2DA5wwKNQ9ORKhb+cqBLN5KTlFYpyeHLjKaIRd1o=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=jLg/Ort+dktxydWc7L68s9DMFyaM5EKCxEMzSwa7J1A=; b=Cu+CXM3j+SYTaUM0YaCgOCkH28 A6s3EUHOd+GreQIy2D6PuHefTTlDQAMuMfkP1+wYQUELuWpDri5KL67x5SvhH2dxjGiZbRrzFklat 3yDz8ZvfUflGjZx0qHpaVN1XPvgGikNvNE7VW20vbI5TRxXE9lLL8g3713uk8olQ9GEQ=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGf-0000Nz-9m for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:45 +0000 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 To: linux-kernel@vger.kernel.org Date: Tue, 10 Sep 2024 21:57:18 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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-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iaiZH0tXiwSxbPE/a4Yg9k3s5A72P9ygJQdiMq4tWlfiXeqRRFOCQJ1RBDffc94s5BNf0MlBYGqpgh+3cekW5TgAWiF+uD7v0UprdjoZ1nQZsFP+5Fp6IhkUIIRxaGcDwTDcd+lozFV20TlSCnasSGWG3uUQ0Og7PtbCsDLIvAyG//jG00SCJYbv0v0TghU8pTtXSxunRr+XEiEW0uLSRy1JHaaC6L0p6Bj9Apq2x0FcQ4XQsQFFcKP34Gt8AxykIlt1xsiKAQRPoN4xLYhquE8mVgXa6MzJOMWkxR1mB+mX5MUXHS5JokAFoEuym5WQ+E+IEy1BkDJTaX+FUoc29FQaVj99Yb24I4W46UA== 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: eFZyXr2+hzrdK1a8LOMrW4h4QGiNBSJ/pL4ZN2E2rvkI3c+auKWaNoM5HhOhvibTGFhorXMZLZqqPZQVs3ev4suIikZnxKWEqLDw/WQGA9eH5MWOzqwku6dvgHkdIBWjHZbhUFtHUDrjkc19zCStIutEIuxHi3sFN71D2D2u7Z6hUZxnAVvksizwfVxoYevtH6S8YtWVkJyl/pIW9IqgD09UuTXs20uIYPj+lKU0DIEH9/Lofl6hqPR8BZZtMyDn2aqBMaIXEGSptpnFaCvun9GHnogJUgdBvnHQqe1uM2jWNlgjp9axxMSG9al+/06W+7La3Y8STpuOK+6t7FGlJrqfZEBkjhjsidap78PPNBnoSM5pLLHlW3np5UlSu8OYYd5O6WVyu/1e7Cn7p6Zx1NSMx5Ie7DDWVIrcxIIX88T2M+lPeDGntwKYMov/HlYYtQBHpT+Wt+5Pi4KgXvqzLrpnMkdsxALPSNsK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iBVEJGX9OY9T+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 X-Headers-End: 1soEGf-0000Nz-9m Subject: [f2fs-dev] [PATCH v2 05/13] f2fs: set inline tail flag when create inode X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 *idmap, /* 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); if (name && !test_opt(sbi, DISABLE_EXT_IDENTIFY)) set_file_temperature(sbi, inode, name); From patchwork Wed Sep 11 03:57:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799658 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB149EE0204 for ; Wed, 11 Sep 2024 03:43:57 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGr-0007dZ-EE; Wed, 11 Sep 2024 03:43:57 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGp-0007d8-8H for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=cbAYiYW42KdJTqSuWfOstLknlNwHmM+iHowcLx3rDog=; b=gVLm+ULJdKg4nhoAIPygnTwghB ayWfBjjj+CZU1W1/AVvkNa4+TlmHYwrQVvbf+ZKZztWyJQdmd/fB8PJ1foBclt4csmMHPbYeRr622 iYKVNuHXlHCjCC/n+sS2eWkxa5zNl/YNMu+y/Ud1ykNBc7XdaJ9HNJQcvgsXxWvoM+SQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=cbAYiYW42KdJTqSuWfOstLknlNwHmM+iHowcLx3rDog=; b=TGIaY/A/KlMboBcSNPKkU04fYK d+hQ5kOggrOqsw0gP4km7pSrLO17P9j7jyGsehqHa5wS46FVslr8Vg/Eo87zHftorRmpzMCifKZOA QI3CzI8nMHaDgMaT4DPDlcQ3xnaUxBmJznSSLd4TAiCBiqR9bdHWAfVp84D1RClOGpeg=; Received: from mail-eastasiaazon11010021.outbound.protection.outlook.com ([52.101.128.21] helo=HK2PR02CU002.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGo-0000Oj-Jc for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:55 +0000 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 To: linux-kernel@vger.kernel.org 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: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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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AbIO0/aGlIzy8Rt8aI24NPwjTtR6PRUsdf3yuzi2qVNfhPJMb/yo8oBlGF3lvDiRZswdxCWenKcQusJ+lF0veJ+QDEYl+izka19Ub55pSRUMW5yU6eSveNMIKJBdxoRS6SmMlCTFnTwt1kjVl5JrEXPt1EzlbZjTPaybnq6XB/HWAKfyITxeWhc3ht+TBnEl8XlWivCjo4c8L5+2YIyiukyEyVRjJfV7IgxcCPeBbYorejxxyOYSEIIFoqhvfQfRtOc22zl6Bxkpsf64AyMs5Ev9UIkA0TbR+Cd+mgTHIR9FGW3W9c3oLnLx/a9yduevhCS+Zq7kD9xUO6RIl6tgP9MUJIC3gr7cz61H0DQNne78PBjW8AfR0JLXD3+mnGcHgYF9+NfBF67LcB/aXlWWfxjOPfyAORpr0TQbSOWkU4zT2GbSlXRQhiUQ== 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: szMCZhptJGqDzQWHTnXmAOXTWGhTWWfP0SfJD7ZIi+jPYc/qHsGu+gPtrCyKLDJwViIIK/e4pXA0VljTxLCMrD757LKQQlGoZr0me8iL/Ov67CD+XT6U2BfaBUDZUGktJTqWK6X5Av2DeZCLejtCS7H9A7Ra5I2roRIeFspqzlGEHnz59T7GG0FO8793e235lAEmoNMTqldHsmUA9KMH6Ha+v4se/oPdDTHCX2gP6ZU8Qqqkhp92fPnK1Iz5xJDhA6ertgcZ/RQ+PD1m5Gpulp7zMxhWMp8+GB7WuUvha4KUDpG/IxoNTL2bPLyeoTSZ9/jnjJMQrICnxM3IU/Go0c3FNyZ6Sr/AJ3f4t4sbdAaopNQZcjvggALyicYyAnqg10BdR8QQWUFOd4RfG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6xyv7ORs6VwJHHMhbrYtKHMEWGrHJK0ggUTo5n4tN19EWBFpcoTxe7ItrpFDEoSDJveUXh7OQpHbCgf6TIUS+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 X-Headers-End: 1soEGo-0000Oj-Jc Subject: [f2fs-dev] [PATCH v2 06/13] f2fs: fix address info has been truncated X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 force) if (IS_ERR(ipage)) return PTR_ERR(ipage); - f2fs_truncate_inline_inode(inode, ipage, 0); + if (f2fs_exist_data(inode)) + f2fs_truncate_inline_inode(inode, ipage, 0); clear_page_private_inline(ipage); if (force || end_index >= COMPACT_ADDRS_PER_INODE) From patchwork Wed Sep 11 03:57:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2EBEEE0208 for ; Wed, 11 Sep 2024 03:43:50 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGk-0007cA-H7; Wed, 11 Sep 2024 03:43:50 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGh-0007bq-53 for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=zpt7hATAjsNzxEZ1b9rWksG+1m8LwfMM2LU47Jz15y0=; b=cROYG3QPCaNtk0oMLT4MmoHgDp A7YconSNVgpnBy28Lp9utFniFdD1jzS6Ve84P7ou7YBcDGQVhMQHROpZ9U7lm7HUaLUjPyZAYH3z8 vZwCs61PHBJTsxziGtdmNVzlgfe82dLrSF9xRkL8EjK0dgREOzrrYwW72LjxRqh8REcw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=zpt7hATAjsNzxEZ1b9rWksG+1m8LwfMM2LU47Jz15y0=; b=aycgwsEgY+5yXeENnZ+YUKYp9X LkMgos0YerdAtJlxksIEcg46iA2Eh6bojjO4McnEHl0CZQIa3BvsJCpOgVIE9xLVnGbgzQgRTa33a QWlfUR7loYI0lf381dBrG2z8QbBplPA90DmkBFVApy/jTxWIHcb5yIVlEox1TxSYPeXI=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGg-0000Nz-8I for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:46 +0000 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 To: linux-kernel@vger.kernel.org Date: Tue, 10 Sep 2024 21:57:20 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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|38350700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C9MtUr+pdjF+DPms/04jCWnbZc3sl6VuJhqKmcGi3Th8J4vsxHIQOcNjwnozmUE6gTsa0nrRUotzJPxQGTvriOqo5kl91MGc9Y83VKm3z9hfM9j2WdeMegDUPp0UaBDHM+MO86RIrKYdxGgYShpvzGgxLnaqRlq2cvULVIysKrnL9Rf2YeJJ2Z4RjPfg5JoOGsMZeeshZklaJGHQYf6DXE2p98RSq5JPumb9dIXjt3W59wIadp0R+Eb4+n68TGpNlI0EsnqLQX2UoIUSRKze3s0ySrhICvuMjdFHFcVSnTYd7N2WPMgGmuvNnKGx66feyH8fyPu547ecd/JVCYiQnH7TI2U4XQs8m56TQysVlWew2u02pnaHiw== 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: PyE0ylNESw7V3dgni1J8WSSyCv9wBTB+jaDiWVav2hT9YKv+zGAdLTVMFpjGdpItUgTDW1rUnyS0EVc21/jWwqxDwVzsHYisDA4cqA4Z5l42gXrbh0VR2TNahYYHWYCM4ARXCWSE1+fRMp9t2po3bXNAHQPjssQgv/o3ovzs100ThLYJSVBWf6BCwQ13V332qRUVAfWf/0Zirp2ZHEvu2AiOxvcROlkM/fE5+G10I0E+gP4l3jOFjASIt567LYDZ1D0qde8QtgdTN+HV7UtnuOvDTYjHt5kGx7co6UxRbC3OjOkdJzHSYdRwHRKxp73VmZ4XlYQuTBwig2fIaBxQuCaXDaGi7At2IJK48YOSLHcSwh2DBoUak2z3CvgQWDDehndnBMVHfG5Sq06mpVu8yoqXnPKpSE6w/XygSDa3Zg34Q1kkmQZw63MtR+mNZFFQm+LJx5MS3YYbCxKLSrANgdW77s093pJ3kvbBlyQL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gWSU1gBlfjTGACDHFVLuyWq0OhJn4HztpuOz 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 X-Headers-End: 1soEGg-0000Nz-8I Subject: [f2fs-dev] [PATCH v2 07/13] f2fs: support seek for inline tail X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 *mapping, block_t blkaddr = f2fs_data_blkaddr(dn); struct inode *inode = mapping->host; bool compressed_cluster = false; + bool inline_tail = false; if (f2fs_compressed_file(inode)) { block_t first_blkaddr = data_blkaddr(dn->inode, dn->node_page, @@ -408,6 +409,14 @@ static bool __found_offset(struct address_space *mapping, compressed_cluster = first_blkaddr == COMPRESS_ADDR; } + if (f2fs_has_inline_tail(inode)) { + loff_t isize = i_size_read(inode); + if ((isize >> PAGE_SHIFT == index) && + (f2fs_exist_data(inode) || + xa_get_mark(&mapping->i_pages, index, PAGECACHE_TAG_DIRTY))) + inline_tail = true; + } + switch (whence) { case SEEK_DATA: if (__is_valid_data_blkaddr(blkaddr)) @@ -417,11 +426,13 @@ static bool __found_offset(struct address_space *mapping, return true; if (compressed_cluster) return true; + if (inline_tail) + return true; break; case SEEK_HOLE: if (compressed_cluster) return false; - if (blkaddr == NULL_ADDR) + if (blkaddr == 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) } end_offset = ADDRS_PER_PAGE(dn.node_page, inode); + if (f2fs_has_inline_tail(inode)) + end_offset = COMPACT_ADDRS_PER_INODE + 1; /* 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 == end_offset) + goto fail; } if (whence == SEEK_DATA) From patchwork Wed Sep 11 03:57:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CB96AEE0206 for ; Wed, 11 Sep 2024 03:43:49 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGk-0001tH-0P; Wed, 11 Sep 2024 03:43:49 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGi-0001t7-I4 for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=7CC/3LcYA72yvGa3hWCirw1THavdhx+JFL9Z/mwmypc=; b=Ca/C0mIcsPUysc3R5JO2xVETLb FH+4EENstzUuftKErTRkLE4QLioXgXr33pDJFRovsOL9OFCF5VLxx3jBeicFWK5OzY83bLKtk1Yb4 byozozo4jBMr7b/pCx4qJ0COKuXvRNSknWpAJnGFvCibvegbJayXO4ObbwJjrcMCTLok=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7CC/3LcYA72yvGa3hWCirw1THavdhx+JFL9Z/mwmypc=; b=GwiPqZ80UKpnqg1kufgfyWrkZ/ f7PmWw3ADwvEZWInq1wIF9SdpQNjfRlSWmqIxErKvfhJeqrbE/mfs6mbQem7nDfGw49e0nkMptUtC t75JOrZs+df/hUrhVXthrQlabXAigmgztScibWT9AImbuOCmXNanxjHTDp1uYnhfnGj8=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGh-0000Nz-9F for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:47 +0000 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 To: linux-kernel@vger.kernel.org Date: Tue, 10 Sep 2024 21:57:21 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: ysDu6CASKiRbXh/vjtXmIva45wHbpTNhUKjtMnYCrrMBOW5FQU7PCySt7DNLAJ+NEQQOVzMJ/bWPWdxcVt2K9RYkZsLTRMVPGnft1woLtO78FD0Tq/6uD6q1x/OMp/jsuEQYeR2XMJmz1Cj0c016YS6tHNKm0HyAc/R9FFzd6TrbqyitPF1kMJTCEQFBFmaWDbPdcoq4TUWX0jggrUvEYpKJn7abQcEdLQOgSGts+7GO3qTCToJhoO3Kv65ezCvnCuW9+p7O2QTYFLiCTLhRiw0w2Rr0qQnfgsnLIy+2P5j3lzFYhedqut/MyzWfQDz0z4mo0UVm/JeKlba2k7HY2ZHiJJs5v/eXTwldDZAQyVHqaiT+ERSxJED3NN1Jl6ILbgER9ijRXOiruO5Gp4BVb2SiPSSeis0Cl8t0cqX8nhC3Mw2UjRck/RNjGR74NGoWeqbj75oq4Wa5Mt3XLQSQbIkTgEzTQIlT0346RHjDJY3tRCOhzPqbmkvHmVb8iGpmDmevMwNNLAUd2JwI9NXkocHMwti2af/Qe2snI3b3wHRLqMq3VADDBr50JadrPhCLgJNhTfQkm2Jr+vro0KE+itKmv6rO/Z6/uJnOZK+XYDH/6DhoiZnf8N7Yrn2TCShRmp1BsvxzG0QbdBsLWb3V/4bVuXeaxgz8pJwJW+VLSt4KUoerJqJkDbkWq97tcqKN+hNkGLH4TSyQQA57oQH7ITBcRDOLCcxY8rICK7S5EyYkIf3xsYvPzuRdFCyjQhf73B9Epj68IkbP5q0FqbQkPYob8QIYWHpcBg3aOLVnwHj05ii0D11RtPpw/ltxZqXhtGq+Ivba1U38Ehom61lHAlOOPQd6aAshZyA/+rV68xoqNFGAIHrwTtvP8cZHRdTJPdYnO7+L3jc/YPThYYZGcwMFi4FJKD779giKHjpKAgiYQqRtrVwoshnSbv4gbbz5D7DQF9Jus7Bc/b4dhC29CdklKdf+gb/PkAwIBH+Y4Tv14Iccu/mFxfzusWEVbcq68wK0JqgMGwLspejIIwDv7FVGtWmz8KmEPB5kQDgn39x1q9oSvck7F26NVqyE11UQaR4t/S/BjIaH8xHpPjvAXanT/R++49J5Ma4bPWLwR2u5zAO5sLd9wPYh+JR4zB50FI3XYojkw+QZk2n/uZ+lCwC47QdgMmFDnj+TVPdz7OrQmz/b9FmvQqOjXhSDzGa7F68wZLYldqLS976GJTUyODZQkYAdyToof5v+QY1fKPpL9QZDhmTT03okYnb9BdYX6R4MMke6vq9LEKrH0PHhmovBy58bLnZlBr5vcXDQTj26hYPJ2Fs3TQEfLE1+5JFmhcTqXYGYborFt/4KhYAqqDoN3DcbzTeFzZsNZsbVJOAXXQpwBqzFEIJKhpjrOJxdBho6FWTRm9DxS9ciSpc1Iw== 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; S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EGX2w6/PlyCDFhEyZKmB82z7/Kibv217OGLnm8izSgNG49mHjzNhndRHteSCByE4IpSJ/0qHtg234rw/sWG8wlbav2/vhvb59N6t1qY4cO3HvCam0+jmePby6y0r5Yq2N6i8oFy5KuQ3U0EYqm6kX1CdNsh1MW+B+vp+n7lyo1t5lFU8mX8DUuSdPL0Tg/Xq4fanoWKqiZO3TTM8WVgWPu3vs7lRmnn7xzMbSf27XKbYkG2x5oqoGUhaIQUfGfV82UOetiYFXZ4tNtpsOwqlDCkNA7eLGgZmetsgUzes9KHphbHNCRYFvRaVGdcjFdLLZ148af/vChUAf2ZvbyKLAtWr72OzEuQkKJ89xVZ1G5W6yFCi+hmMwf4/0CXUMbnOV4ajl/v6w1Ynbq9A9sEprRK6RDdSPgzP/iGpsBuNCgvOoWYJv0kQCqrDuhat1laippMHyORkLnvtfg4eApYMAVkljYxdgnTz1Urkwv/RfhVeTLONDZ2nSGq5+T4DR3pmkYwYQXRu5L8wJaWyqICbJjtHZyEdlhM3ppUug4Y670CUuhYypRQafoH3xlj6/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 X-Headers-End: 1soEGh-0000Nz-9F Subject: [f2fs-dev] [PATCH v2 08/13] f2fs: convert inline tail when inode expand X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 *inode, loff_t offset, if (err) return err; + if (len + offset > MAX_INLINE_TAIL(inode)) { + err = f2fs_convert_inline_tail(inode); + if (err) + return err; + } + f2fs_balance_fs(sbi, true); pg_start = ((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 force) return 0; } +int f2fs_convert_inline_tail(struct inode *inode) +{ + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); + struct dnode_of_data dn; + struct page *ipage, *page; + loff_t i_size = i_size_read(inode); + pgoff_t end_index = i_size >> PAGE_SHIFT; + int err = 0; + + if (!f2fs_has_inline_tail(inode)) + return 0; + + page = f2fs_grab_cache_page(inode->i_mapping, end_index, false); + if (!page) + return -ENOMEM; + + f2fs_lock_op(sbi); + + ipage = f2fs_get_node_page(sbi, inode->i_ino); + if (IS_ERR(ipage)) { + err = PTR_ERR(ipage); + goto out; + } + + set_new_dnode(&dn, inode, ipage, ipage, 0); + + if (f2fs_has_inline_tail(inode)) + err = f2fs_convert_inline_page(&dn, page); + + f2fs_put_dnode(&dn); +out: + f2fs_unlock_op(sbi); + + f2fs_put_page(page, 1); + + if (!err) { + err = 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 = F2FS_I_SB(inode); From patchwork Wed Sep 11 03:57:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB4EAEE0206 for ; Wed, 11 Sep 2024 03:43:53 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGn-0005jr-Ap; Wed, 11 Sep 2024 03:43:53 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGk-0005jZ-Ci for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=NMu3pawJjX7tZUFb0bQVd90/AKHOuyxS8U1KgIgm3H0=; b=kmzv8cvaJrycn+Y14+gfEu78/I sJdPXV4X2XOWprN0My3oz1hgPmPYTRt6KiAgHAU1zz0bchZc4DAhvZjk1c0L02DLCe/ycYYEsKeKc iO9KmhWH0sQt0J4WyOjkqM11K3AzPjelQ1FvY3G8/XtsaTi0IvgcnZdrgIxLpNYiZ5fM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=NMu3pawJjX7tZUFb0bQVd90/AKHOuyxS8U1KgIgm3H0=; b=UHsbrzB++/qEJznaCp7Ca8B8AH gcLicQVPrEUi/F7aIdmuA5LyvaPUTBG/9Kbce07Q0A9iH9mPCbaShfsIg1ife1TLc9lOa1sC5qrKp 8HrbYcluyDsjjrC0Lcm2r4FrwuzVZ9hJAK4GVxQD9Tk65rJ2PDUfwp4zTE+2npdUu7O4=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGj-0000Nz-OS for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:50 +0000 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 To: linux-kernel@vger.kernel.org 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: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: Ss9DWppozGV6sIjKkUxjmPSUUa8Qhyx2qQMslagm5T5+g0uvjh2B1ZCLu2ZIbsIf6f6hYidIn/Qeaq73JztgoZZ4R5ToPUZqkQgGxRRbqM4lO0QRGi2jerxhe+cg4tGY0mVsRycuqPYj4ymXFcEluaT5vryO+qU3377d48jpoo3Yl4WXxNZwbFnHcOoLdDEi/I+9+WWLZCPA1W69anAvcxuLDmAxS0Z0EopUi2yTuITGLPKENl6jEtqfol/GN1j3x1QMp7f1IzJKSViTF/VZ44fK85v/YfvfwmITvix48u2Q+L2y+l13reixdAYgB6Y6dXQ5kLrjwk2Y6U8e+rNEHXge+hnfAxTrYiqi1u12qgeqqUtHx/uD3ALyrB0a064iueh53puw7nKmtam3tQbukVpCwmZHALdobfS4iKTwFz8Byv61enx0aC91dBnmtP50PmvU+oXhd/aY+AeS0VdDsTJHwxqjy871QFfI6lqe4o8vc8DvqRoapASkPPX2z2NbGEQsrpLJd3SnZLv3SIA/s3fH8q0WN8Cxj1d7/1q+d0P6QK3nXqDse8Ts4rUhDx5rmfg+FIFFERNJEv/DV8+ZPTPM5Li3GhpjhT96t8wFdjF0X5ak3tA3G1bDIczSqeeSW3X+9xNFmBZnqYBvbmCmIoiNz+9F6y55XD7UbBGlg6P1imxltgfWAGXTUBiUdK0IE/ubMPrmz2xBbIna1LCaOqtzrghNneBLBcvOeqFUyaYNq7NYL51y+HuwM6pFV49xE9nNX+vwiVqfe13uY9cfCNlDooTbaPIq3lxFtqiQH11o9+PqGUPu/PGcrPwb+mIyQej+IArVPs/ghgpr2M0Ey54lvr4wWt5HhhKbEZeE4ZrgTEAuFG2Fbv/uGO5LRLLIzPOIG1SKN2KjXC6xIhFW+2S7LogvYS9YmLFQK5t7aOclFaFOr8zMPzTtRpGQCrx5IKQyPNZENyb+Vs6DngEFnmumWSmAdOcv1jNJHmw6tJQu7goZUg/AfmCmyPl9utDlx11CPs4zaEbWZYb/iQCdPbIunqiLe9MFb+a1aHeMVp7cvD6+PImp0Ww46CzNI3JGOEO1zjIJQ7XnIO2+8z1b80JQO/t6N2S3RaILIiGALzSPyXmUt52u3TKV40IWhceLNRBSujYK/aMRphDISL5z/2AjXBuFTVNvg07G759E4tyqXxKQkArktLXdzhEBd7ef429wO8E4TnW1S89k3noXBzFxDBAj3vz/ezUnPSsHCGoHSQs6SVMoG169rurMWh8JxRDRc/Sub7vkx8jFd8veSu6zy/2+/+LYBBC6B5tgVgO0+3kDIIi0rpAShHvGbmIHtF2wUmq8nemL6622xkfmBxz1tNrENneD+UXvTY4/TAQ2j065vyi2L1bZUrCM+YcLNA96HSJfmPujaBzMYc+DrA== 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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/7kgks7Xdpy8gnaDOfbzP6HrVXMgfKu3+vDqhaX7sphCy0CRE7yKqoAtrSU8EjZR3ZM1r3eOn4Y+NLHRb2xrYc+tWqkmD99usI0iQb+QRLd4W0+UyPZFdzf5KRit5LEAPtG7cBjkoV/60MGlhfYadar4dTAVEZGnh0A7gYqwaa0Jy+KY/pYeivLI/i3a37b00LcZirOoUpKQ5VFrOjfFOHg08De1biq/U1INhc4IzeDa3HyV58d2aNFgqIgxXEVZ8pGY6bh0U5g/FNXx4tRBiKqLa+fuhm5TPPDj3JHXBXoju/g4TAdNZCvirizEeG5mHmjF3a5IyMkK2EbZkapv/dlgJe9LhAf8gtTmED+Ytce/+nY6zmn05yN5nuhDVq3z2zUl85J+LQVWX/7/JpVankq9mqS2qtJD0Rj51PIg9hB1axZs8izG1k0+RFe2ovH7UqfumOTjP0AzMZkDKofOA34jn2ys9L39VDGL7222AbYWcpXwqT3BVFXMdViLoXb1BBkQpjjneSl6d0R+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 X-Headers-End: 1soEGj-0000Nz-OS Subject: [f2fs-dev] [PATCH v2 09/13] f2fs: fix data loss during inline tail writing X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 *sbi, 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); } 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, if (f2fs_has_inline_tail(inode) && (pos + count > MAX_INLINE_TAIL(inode))) { - ret = f2fs_clear_inline_tail(inode, true); + ret = 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 = -EAGAIN; goto out; @@ -4861,6 +4862,10 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from, if (ret) goto out; + ret = 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]); From patchwork Wed Sep 11 03:57:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 303D0EE0204 for ; Wed, 11 Sep 2024 03:43:55 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGo-0007cr-Ru; Wed, 11 Sep 2024 03:43:54 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGl-0007cR-CK for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4fI4xqj9AK+cyUPbm9hBvT+ojMH7CRydVKcnjsmQTb8=; b=QxA3ZhT2U8ixvruwsF7Nx8z/Ia Z9DbJHg96O358iKWpJYp6CQuxE7NSu09SVGO7ZMgA6lD8Z04Kb5k69Gr1nDc8iLcHG6nw7mUb8VPL B+E+FSdE3BKZsD0n5CY6eQnw3gW6XdbGTv6xq2hM1L7H5ljTJlMo1nD3qG1rF96x/e6g=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4fI4xqj9AK+cyUPbm9hBvT+ojMH7CRydVKcnjsmQTb8=; b=P9x7NLaFmSoNt18Jkd80wWhrVJ u4cocE0x8acvOdOCBl7a6j1H7qGYjSyBLt7L2vS6DGgWBTNJaus6CXehyzeBe4Uu2D15QOJxxI/dv iPZ9HsoBWC3YhtxvyzbAUtO3fsncvt/+pcUl7W7FaGPFd9FljhXK2+mvMQDnK3z71X3s=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGk-0000Nz-P8 for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:51 +0000 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 To: linux-kernel@vger.kernel.org Date: Tue, 10 Sep 2024 21:57:23 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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-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4WnR5e8Dxb7pOhI5s/KH0cQse/K/PEtzMmeYK3hlFoIvIuMuuKUxv58dzdOBqesec01ml9D+BR6cHxfqQBOM2E30qKDB86lMvnLeS5aWyc7+LeZ8/aIbqRbt+hNwG0QX2FeuMbGrybY4MSi8U0mtiw1OMxA4bWgC69loEUJLu508N4bzWVv35yoCYkeBP9d24PcHwQcAgj3HWrXpPsDSzpVpZskYmgiqgwr2RU3BvLl5sszjlFeLracFSL6y+rtkiBJyNkXwDpfM+w+HqIpsVWgGe0ghWwv5MhhBzAYjB/Y8m8XoWZkagpk3XJoqgHXrnCST8nD4izsUToSwAUyFea7249UkQ== 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: XnMnAtq4NitKc4UckgMVoWHV4Qfd6oI1N/5YMYRqmU2NwxSRTGfQQA5iBiPEigkWuaDrwmeCXKHD5H/QEro2wp0hn/C9iBE9fC0KxOIaWD7AvG8r3WrqmYf00WeNsLY8Qj8FiNs+2cwsHZluDJODK9Zs8OtAGKYYsBNPxb+M+kTGka7p7nFTdv9l1QunhpzfN1URqZtGV5kaFQQ0W7xi4lcmv4SUeYuwAcmhK+ue99IHnbwi5wdrmKQLlemfQdpY6GMaMyS6sfiSQEmBgcgDhN0J/Q+ZVEr6b2EIyDjkaEvdsPQvQ8AtZdUd4bFK1ndIvSbvLpZPq4nXjHrBCfQn8/F67ahoC7oiNaELk/HwBWU6sTOB8ZtxbMBUYnb8E7B0ZZ3zEuJGjkUOgqmyldCjSPXQuu+SZa0Xnw9fDul5iSKnIMfkPEmqhCJNs4OaoqWc9QEh/vKAo6zbUzTm75WJsjpt5mRnrk43Ja+ELVoU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AUjnZupLRbypLQM0aBDwFVeNXwi4NTXN 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 X-Headers-End: 1soEGk-0000Nz-P8 Subject: [f2fs-dev] [PATCH v2 10/13] f2fs: avoid inlining quota files X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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, struct address_space *mapping, goto fail; } + if (IS_NOQUOTA(inode)) { + err = f2fs_convert_inline_inode(inode); + if (err) + goto fail; + err = 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); } + err = f2fs_convert_inline_inode(qf_inode); + if (err) + goto out; + + err = 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 |= S_NOQUOTA; @@ -2818,6 +2826,8 @@ static int f2fs_quota_enable(struct super_block *sb, int type, int format_id, inode_unlock(qf_inode); err = dquot_load_quota_inode(qf_inode, type, format_id, flags); + +out: iput(qf_inode); return err; } From patchwork Wed Sep 11 03:57:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EEDCEDE997 for ; Wed, 11 Sep 2024 03:43:54 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGo-0001uE-Jp; Wed, 11 Sep 2024 03:43:54 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGm-0001ty-Vf for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6YkUHWkSyaZim2/FraKiN+n8vb8EDsmqhJ3U8NImOxA=; b=EXQ8duLJX0ovTs9TT0PmNPzadm 3N3fsDcjojDaEQRf213XJFadLY/IUaqWln+gaTYfkSPygwZk+SLdLAPUCOkhS9wzhD46DHLCfpqmn 3/UVP+SesGLDwpKo2dbLzUCKxNswq3Yb8dbK6Xhh2I6EM9+eJfzwyYfprSht/V7hPooM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=6YkUHWkSyaZim2/FraKiN+n8vb8EDsmqhJ3U8NImOxA=; b=MJ7zMz0CDgF5CjoqSyXOSJcH7c x1XcoyZEfUrk/RDJopVUw2SlRihRPJ0rYr6gseDkbqul0Ar8CBzz0i3Fpi6YcYeGG/lAlb8IHGJPL B9A9NUn5BPY84m1RhMnPqFaVORoD1y9ZWPZ2FcPimLPPoqKqctXQhxF1ek/1tyvkZfYw=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGl-0000Nz-ON for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:52 +0000 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 To: linux-kernel@vger.kernel.org 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: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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: lYhdtRgMgvXuU1+GCgFjaneo4y515buEbARLMsPJDQ8gKzW4MEtYBk8H2gKbS/7M0DCLmhZUedGLl8Kdnhc+VNVXP8LkHCI0CxTb2skeKsBlvlizHKp5knrA6HxR6aY2BO+FlJXFybQ89Zi/OxQGS2IGg1JuyDC8hNUaplUSwRrsbvnb4D4jVk/3MGK+Tu1mNrDTmkHYG8F7wtKem19iEPC8syU+o0BivQ2t1L9Tsyrk0MLZMTycPc0qwlFWe3WEcrlI3bie8263vNCQG11/QTEM2GQAJQZztsiMB07DP6lv1gkmL9F2dxzlOwPM3AbNeZtTANf19r7W8MKonjKDC+bF0Cs4TqwqMGNWZNVZ2JrTXA0V/+n9DT4VFIkKE3aeUaWL2QU1hEHVSA5DMDSJNvPINUmIwyPIp23o0cmVK5YQjuMSaHC52mcJnKHEWz9dQMdwaoLoaQ/0yT5JdQnxiu3O/lqbPTYxkZiCSWUp4/v8unVP7wTh6jfoyZ7+dMhdYdt+iFhBwjRUXRWlNKdQYq5G4IlXpwTFEmN7vYz9yHtpvfJ/2gSOu/7a3bF2xduTsc0GQfzdqHfEmzp3qGbMAhbOO2apEArIQ9oOwrs02poe4YIuqzjTTZBTHRGxUXGGTX0qxaS6xdkiw/jBhVZICGLbLXrJ5v6MCAax1+Jr+DwnND42oxzRCi2WNwUhV8TAiuBnybrFcVyrT/dTalXWFR+80getRgXp3EkIszr0+2N3OeT2mTz1C6ewq/P0nruV82eRsHTd4+0EhE/naQs6vr8A9CPc63r2lCSxUQ6qHbINmqENQqJSrpCueMOkfnbZx9IFIreIgRqNhMyF+rkXA/A5uPi7ZklaJkjm8D90yLEukT1pcOiTDtB7eEp9gm7iJJsLEN6/JHskIik1x5LZ7meYvP+Ca/PImI5k2F3YxkwRVkqxXaB2a960Z0uRIiBgkk6WcI+su+DM6hZgtvpYuVxKUS3dR49PIP3E7RNXPw7iGos9+1PYBsw1607kyyciY+mgv2bIWeC/8tN5yHPYTGfr1eBvHiiGjGszTmukB6/SiABbUU8q2yf4saHZWYeCmJPUb1lsJGoXzRLU83Rldob+sddQlJ2aL1NxopywDvzvg0C71UX1xkY6rdB7yeNi93u5XZKPgDpKOStPBnLbnwhqGvpMN0IewdJcopHibY7o7TseuGy/SZ6xSsnVOcJgPrpeNMlEhXmSnUNHT+b0TeQP/HuOUznfX4Kvf2Mz6fmmlKmJYbs+vDouKJztpKBQ8bcmaxJIPNKrr917jn1dLJwdRjv32MkxVIcGIKiMJLQANswtZEI6h5xu/Y2ymlJ+6wPJgBa7R8cwwEOlYWNlWq/yUI1tpQhk46doelUWYyVNHauAbUnbINNWN0OE+CU0s9BgTAVzrsYQUynur8jk5Q== 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: Mst4N0yhhAmnixpWmf0QCKKBiwki1aXWcX6nCohRvoFiTLDBhr+0OkKVNlVR9SrApU98iuL/QSDZZbUfAlE8F9a0a3i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2WU3RBCypy8hRzYLnYKGbX5/fgkfX9hSjSa7MRIQq8BSvRDBpuz75+NMJAtsChDJmfbFV8n0mcBt0ln0/SRDjw8AUqJvTxZVDbPP1ekPz2EyhSFekFhiRJQF+EHUlOH8vXHDrA8SiN3DInvdEpbQg76WJbWShoEpb6b2Fs71m63dlggRPfizvwmOKBU+c8iclk5v1hr37tdYcR+MESr/3A8FtsnEi4ZaneZ4SSTeloy0HX8w27Dt4FbOFo1sawgTQDrrJUVesUFsC3nq1GYm5SxPNhu5z6Wtvz4sx3s4SepQjC1b8n+amnc18vgdANdJtv/QM6gLLKjaNJKviU4X3VkKSEm82xyHYaFvaqyDETDYZoaNfndPNcYaYIWuQ3HWHpUWcy4YvN0+zNzd1pdIclSweyIcwWufb1KgmwleRYoJ4iX+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 X-Headers-End: 1soEGl-0000Nz-ON Subject: [f2fs-dev] [PATCH v2 11/13] f2fs: fix inline tail data lost X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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 *sbi, block_t *blk_addr, bool *node_changed) { struct inode *inode = page->mapping->host; + loff_t i_size = i_size_read(inode); pgoff_t index = page->index; + pgoff_t end_index = i_size >> PAGE_SHIFT; struct dnode_of_data dn; struct page *ipage; bool locked = false; @@ -3438,12 +3440,12 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, flag = F2FS_GET_BLOCK_DEFAULT; f2fs_map_lock(sbi, flag); locked = true; - } else if (f2fs_has_inline_tail(inode)) { + } else if (f2fs_has_inline_tail(inode) && index >= end_index) { if (!support_tail_inline(inode, pos + len)) { f2fs_map_lock(sbi, flag); locked = true; } - } else if ((pos & PAGE_MASK) >= i_size_read(inode)) { + } else if ((pos & PAGE_MASK) >= i_size) { f2fs_map_lock(sbi, flag); locked = true; } @@ -3471,14 +3473,28 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, goto out; } - if (f2fs_has_inline_tail(inode)) { + if (f2fs_has_inline_tail(inode) && index >= end_index) { + if (index > end_index && f2fs_exist_data(inode)) { + struct page *tail_page = f2fs_grab_cache_page( + inode->i_mapping, end_index, false); + if (!page) { + err = -ENOMEM; + goto out; + } + err = f2fs_convert_inline_page(&dn, tail_page); + f2fs_put_page(tail_page, 1); + if (err || dn.data_blkaddr != 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 = f2fs_convert_inline_page(&dn, page); + if (err || dn.data_blkaddr != NULL_ADDR) + goto out; } if (!f2fs_lookup_read_extent_cache_block(inode, index, From patchwork Wed Sep 11 03:57:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C73C9EE0208 for ; Wed, 11 Sep 2024 03:43:55 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGp-0005kX-FZ; Wed, 11 Sep 2024 03:43:55 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGn-0005k1-H3 for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hJpfXRt+D/Xi10u7fADuMjbX+4YLotlKl+Ws+v+nkzo=; b=KhU4NZMk1vGJ4YeRbFhRHMSscC tliHaiIERYu4cL+Pwqzl12BKHewiTeCBpZe/ctxRsX578VR9xaaZnjQDf6qLs3kob418IwodiCNvJ hvvpUkp2wDVYiG9JlhNiD8MtS/306MQqOmx/mKCTNjlgYj+HjeLIXxRBezVtzIvZxaFE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=hJpfXRt+D/Xi10u7fADuMjbX+4YLotlKl+Ws+v+nkzo=; b=Ll2qi9DHEiuHnuJRhhw2kCjLTw ulUxzZts2/JkVzwluts6dUr8qGy8STU1IyJU2RcErhJqQubhFNCPm44uu/f5WzYk69nMbSv3wSrfC uMg6Q46qcZhO8yvjUMdrZGqze3fD8dBriM+T2AIMwCbNVrMl5tyrvLhhU7ZMB1vscGYc=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGm-0000Nz-Oa for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:53 +0000 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 To: linux-kernel@vger.kernel.org Date: Tue, 10 Sep 2024 21:57:25 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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|1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AzCx0QuhtaCD1BFPqPhhtW23CnNvDVT3G42pOqESbrjU5cEO8CQgkAisrRmGqT1S8u/KFPQviBIRnmi9iwkx/y/g8aumBQdnVUdT/h8ai/r9M+mhFELzUdi8mERuHHgUeEByzBxw6DnD1XFABhMqVDXZinvoG6BIxcIivf9xODn1uw6e0vv+13v9Jp1PXe/VdroGpwDTPK7x07v6iiek/uNTCiOgJzlsrpDFVVF5KKTHyrMh4Sut75xvtUeGLZ6JmfnV6ckQNumJ5cJLaXm7YbPk3Z9mSO8YfMxo7z48nGVwb3yG6inbD8HHfNe9NtuoZQaTsrkwSnRTy1BGDtPYwiSlPhCmmJ3dcowbNxCTF0GVNisAtAdOovjjkw+hIUeVDVPJ3U4e2g== 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: 1XDYL6cG533Aflir+q+xbd4PIwAHpkMM7dcLzSB/ML9gKyVNjMSaiPfeSGMDnVWhj4iaWfmPL7PmnB+PkuX/+VUqlmgqtU8FE3mLzY6M50G5lRiPWA+N9ijLjN/zhMqtIAmpcUbJe7lu+rYjmMuiIK6joEb4YuVNDEXg9xxwbnR42qe1z8W5RvEOM/yXV7lSfOUfTMYtqAL2UtPy0bKR/pwf843JClY/BwPuM8um9T+h2v/ljZWGepD8CTKrMjjp1V3NJRW9JItF0aHmc4DoEFfm7Zr5soNZZJw+qmllixNJBtXiUW+uWAiX+ndoJXZNw1YOwE2Tq6l+tuCBt5vgwGxaG4aAMOkI4hPEc5c35T5txGBAUtfPayli2Gj2owKpCJ1cinTY8PbXNH15h5sIoEK6ybx6NLXm3W8eBPCOmbUJjlVVPYnD1KFBoQGL3x7+ST/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O+rKk3I6peg7nazFckGLlXa6pIHyv23IX02GsRrVR1wanOIeHuo3RTGaTq43KVM 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 X-Headers-End: 1soEGm-0000Nz-Oa Subject: [f2fs-dev] [PATCH v2 12/13] f2fs: convert inline tails to avoid potential issues X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Like the commit: commit b3d208f96d6b ("f2fs: revisit inline_data to avoid data races and potential 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_struct *sis, struct file *file, if (ret) return ret; + ret = f2fs_convert_inline_tail(inode); + if (ret) + return ret; + if (!f2fs_disable_compressed_file(inode)) return -EINVAL; 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; + err = f2fs_convert_inline_tail(inode); + if (err) + goto out; + #ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_compressed_file(inode)) { int ret = f2fs_is_compressed_cluster(inode, page->index); @@ -1070,6 +1074,12 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry, return err; } + if (attr->ia_size > MAX_INLINE_TAIL(inode)) { + err = f2fs_convert_inline_tail(inode); + if (err) + return err; + } + f2fs_down_write(&fi->i_gc_rwsem[WRITE]); filemap_invalidate_lock(inode->i_mapping); @@ -1191,6 +1201,10 @@ static int f2fs_punch_hole(struct inode *inode, loff_t offset, loff_t len) if (ret) return ret; + ret = f2fs_convert_inline_tail(inode); + if (ret) + return ret; + pg_start = ((unsigned long long) offset) >> PAGE_SHIFT; pg_end = ((unsigned long long) offset + len) >> PAGE_SHIFT; @@ -1501,6 +1515,10 @@ static int f2fs_collapse_range(struct inode *inode, loff_t offset, loff_t len) if (ret) return ret; + ret = f2fs_convert_inline_tail(inode); + if (ret) + return ret; + /* write out all dirty pages from offset */ ret = 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; + ret = f2fs_convert_inline_tail(inode); + if (ret) + return ret; + ret = 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, loff_t offset, loff_t len) if (ret) return ret; + ret = f2fs_convert_inline_tail(inode); + if (ret) + return ret; + f2fs_balance_fs(sbi, true); 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 = f2fs_convert_inline_inode(inode); + if (err) + return err; + err = f2fs_convert_inline_tail(inode); if (err) return err; @@ -2172,6 +2201,10 @@ static int f2fs_ioc_start_atomic_write(struct file *filp, bool truncate) if (ret) goto out; + ret = f2fs_convert_inline_tail(inode); + if (ret) + goto out; + f2fs_down_write(&fi->i_gc_rwsem[WRITE]); /* @@ -2964,10 +2997,16 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, goto out_unlock; ret = f2fs_convert_inline_inode(src); + if (ret) + goto out_unlock; + ret = f2fs_convert_inline_tail(src); if (ret) goto out_unlock; ret = f2fs_convert_inline_inode(dst); + if (ret) + goto out_unlock; + ret = f2fs_convert_inline_tail(dst); if (ret) goto out_unlock; @@ -3353,6 +3392,10 @@ static int f2fs_ioc_set_pin_file(struct file *filp, unsigned long arg) if (ret) goto out; + ret = f2fs_convert_inline_tail(inode); + if (ret) + goto out; + if (!f2fs_disable_compressed_file(inode)) { ret = -EOPNOTSUPP; goto out; @@ -3998,6 +4041,10 @@ static int f2fs_sec_trim_file(struct file *filp, unsigned long arg) if (ret) goto err; + ret = f2fs_convert_inline_tail(inode); + if (ret) + goto err; + f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]); filemap_invalidate_lock(mapping); 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; + err = f2fs_convert_inline_tail(inode); + if (err) + return err; + set_inode_flag(inode, FI_VERITY_IN_PROGRESS); return 0; } From patchwork Wed Sep 11 03:57:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 64F59EE0206 for ; Wed, 11 Sep 2024 03:43:57 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1soEGq-0003wg-BB; Wed, 11 Sep 2024 03:43:57 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1soEGn-0003wS-QF for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/598dfLJPy+7sPDqd8Q4BZGjCDpXKKLbaoHLDkGjkWk=; b=LEH01waV+btDryKBVgJ8Cg1Nyu G8CGUsQ+SWru87zMtuFqB0bpLOz504Jow8JHyy2IGBVXWMIXJ+WjYWuB3RFAMpR3dHjY605BWftDu Dp41skQtkxKCiIrZkA8if5eF64AbpPW3UoHf+e0La5sX8gfefeSq7elq6pgj0sf0ZB4c=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=MIME-Version:Content-Type:Content-Transfer-Encoding:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=/598dfLJPy+7sPDqd8Q4BZGjCDpXKKLbaoHLDkGjkWk=; b=L2DtgTydA+OiKjXTvRCcVugsow 7xXfi2Iv/d7bReS1thE7X3aj8roXIn03G7/CR68oHL5LVkDPmy6GuqkZnq2OiHCADiiYVhtwesFjn RrUlLOngeKKQI+emp1lzvOi6eLKU8LeOWDY1mKONkudiYXMSNUxSkJuueXLuGf8gCTrI=; Received: from mail-psaapc01on2082.outbound.protection.outlook.com ([40.107.255.82] helo=APC01-PSA-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1soEGn-0000Nz-Sb for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:54 +0000 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 To: linux-kernel@vger.kernel.org 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: X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) 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; X-Microsoft-Antispam-Message-Info: 9Z14hrNdP5kQoHyEezs+IzxGoUduxWny3QmImpxu37CjUxFzwDFIq43eGAC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4NUoWYJ+ZPtgvKC/mHE1Ihnk4iVmPdsRummNWDnYvHjkwwaimOFOULiowv8Gt1RUvpsdAmcU1gmLWvvS+gSKv0GG84CuyOvA3ged6jQzmlPF1ulHyR+oyYa5TcgwqR5jK4Z2l4ShGmBHrKyJ1WdG7l/whGDyah/0a26ZqBmx3kDFFapInAR+mZt7uzIRfsU7xzRfAVm66mMAplS7NRVJ/ybo6GBon8W8lJzbsOnZOURhsHRl0HCgFwGTxIo0wkl+YpNoXDOZ7QD6lchZXIn/WW554dpKMoPlctk2Mmw== 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: czu8XGCwmSm2Vv/o6eGzVGOBRlIrmCGFMpH9UlB2aebllBZLndqvOPBifXLmDO/EnS7orxqGh+0Iu0NHNHirHpYxkpyLyGv70qP0orcePqX3dF+LSX3fbsJdv57yfEXkKIguKQ9+7VXRjJaFVzYZ5yMFTJk8ExcbdgdeMkbRufKsoMF+6TbQpw1pmnBiBWDlBtSKhK/f76DNmdIl+JpWcDhSP8SGI57MwvCetRAJH4AS5miCLE0H7NSrQhMhBRI+fj9PrrlL3KaOIkA1/5ZwguzoY4AuxKHr/QoQuV+6GwQWunINca7mxCKXgKf0xGkz+QWOldVoSTvyS2YY6/PWt5zjztqoj9+LIPlpGsjKkjZ5TyXZPWBmj1V+8gKDbkaRdjZpIQMCYvCAoiT1h0kR4zljymy6NgCoczESfzMRL3tsSlsB7wM7oM/R66HXZjyjA5/COprsw5ZOdIobD6qSTRb3lD1erzY40xrRLYcO2asgKYu5Q4Uz4W7PCc3otQxIfb3hKX55+0ydPSlRG4GSJBpzaXNA1TmgpuGyD6Wc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ant-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 X-Headers-End: 1soEGn-0000Nz-Sb Subject: [f2fs-dev] [PATCH v2 13/13] f2fs: implement inline tail forward recovery X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wu Bo via Linux-f2fs-devel From: Wu Bo Reply-To: Wu Bo Cc: Wu Bo , Jaegeuk Kim , Wu Bo , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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, struct page *npage) return 0; } +int f2fs_recover_inline_tail(struct inode *inode, struct page *npage) +{ + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); + struct f2fs_inode *ri = NULL; + void *src_addr, *dst_addr; + struct page *ipage; + + if (IS_INODE(npage)) + ri = 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 = 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 = inline_data_addr(inode, npage); + dst_addr = 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 = 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 = 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, struct inode *inode, goto out; } + err = f2fs_recover_inline_tail(inode, page); + if (err) + goto out; + /* step 3: recover data indices */ start = f2fs_start_bidx_of_node(ofs_of_node(page), inode); - end = start + ADDRS_PER_PAGE(page, inode); + if (f2fs_has_inline_tail(inode)) + end = COMPACT_ADDRS_PER_INODE; + else + end = start + ADDRS_PER_PAGE(page, inode); set_new_dnode(&dn, inode, NULL, NULL, 0); retry_dn: