From patchwork Wed Jul 10 01:33:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13728763 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 0F1BDC2BD09 for ; Wed, 10 Jul 2024 01:19:23 +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 1sRLzN-0006WL-QP; Wed, 10 Jul 2024 01:19:22 +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 1sRLzM-0006W4-5f for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PBaH0PkeaImO+eKS/ucYKs543kc0eWiiKQ/EnznIztI=; b=CzRNTOXhlZv6Ptg3Lam4aFO1Jk dlr2lVpC4gOrImrM0BwXaY++bqXAX7sDusQ2bJuVVP56r9yZeJOFerzE+EwPlcl7wO3WDvGIedJLn Pefe/eVecx05gbGs5VkYJivSUf8OGjMDACmQYS5J9Ueej/GcOS+PePYw8qGwx3Twui1k=; 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=PBaH0PkeaImO+eKS/ucYKs543kc0eWiiKQ/EnznIztI=; b=aWFWXK4PVJTjYZTeux/TZf32so 4CVeBIZbLKmHA7wT8znDy4yCK/ozHA3zXnCIwARNnelJi1AzP5cQ9/3KMInBWYCRQ/2Iux4FxnxAq yswdcpu/pp2BzLungYtokC/W31U74vOokqFdD/nKcRfuiBgoiFhyCTeQjXpb1uAk3xf0=; Received: from mail-tyzapc01on2079.outbound.protection.outlook.com ([40.107.117.79] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sRLzM-0004qO-De for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N5pAS2cfSqg64UpKOz6sOetChKQJb+wY/Lgn1OP+mpA4yVRL2vF0eZ4OE+rIJ771h9QjZ2HL5OlcaxgB8tD11nxwoX3XIi6+RIxKilNHjXIXDnQXs+5gxcCGAbiLQlzLjZrigZsdF6sy5SemOil4jWcQ8H2gZzw5RBKyHWISdU0KlaUO7Cr/zTIgslKTjvJRMSjrWP+5iQZY9rVrt6qjeVVj12iCROi6hp0mBG1saVRzeklL8RUt3H52CZY9n6b6OARN3OfGRfGKCTfu8M83zL81T/GnYBExMoueYSI2H6kUXJUaVXIy87JyjA3v/erQPcPN6rHAkjACJ5dA8sutHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PBaH0PkeaImO+eKS/ucYKs543kc0eWiiKQ/EnznIztI=; b=bLKp3VaA9KqZyeX21bJACTqbeLTtMxX5nGJ+iNoN5FAV6lwekIpSqPKevdnNZNmV6vRCZ8F2Z4ukCBox4XTFtbmfS9eiZXtejFeFxYlpGz3H9o7pA1UNFvrAjhEocOJhCVcmKUd0V2aQsp3YEg79CaFGtdrmNuuisj+/IOn+ZakbRsRqi9NKxpmrHI9sLzJmilPkI3nCIWpeadzM7niX+UhVVeyHPXf8gNiQtj0yA9sU/ER2YPgjbTLgQdFBqRT6sy5n7pcbAiw8ZqC7JGUgjEzubJw6Hg+ebaWP0yk627cmSrNhnJoa7n2rrQcgLlMlgIXKOo+S4J3ogRzvt/Y9Tw== 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=PBaH0PkeaImO+eKS/ucYKs543kc0eWiiKQ/EnznIztI=; b=ZpNbPM5Zsh94Jv8G0C04EZcN1gIdTZJMq3yhbvIWQWs1jZGnhFTAZ4TPePFWsU72BvQM55QmWYlzOiB/k43RRp5mSIPMPViHrGeU6l0f/Ba1DHIYx9QHNarEvZ7xG/vh+39IsGgfWrsLG03cuXyOkJhpNZqd6HgTV1gYHkXLF4RVJ0fD9ZGRzt968amjzDiKiN6AI3RqyJsCxovSV8viU0vRT32jlFzCg32DW2R7euylL4rsxRcbiREdw8xJTiYkHjfLvg6msVwPmapflG48y0S1umh7gBvh3yXpmEAbdwEuaxn8z2udG9vxk5LhwDtcRtbBgsuAHn0oSWO3OD/2Pw== 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 JH0PR06MB6889.apcprd06.prod.outlook.com (2603:1096:990:46::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Wed, 10 Jul 2024 01:19:12 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%5]) with mapi id 15.20.7741.033; Wed, 10 Jul 2024 01:19:12 +0000 To: Jaegeuk Kim , Chao Yu Date: Tue, 9 Jul 2024 19:33:03 -0600 Message-Id: <4c6bd9379897e65dba427ba1f63acf09fd05fa72.1720515215.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0030.apcprd01.prod.exchangelabs.com (2603:1096:4:192::15) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|JH0PR06MB6889:EE_ X-MS-Office365-Filtering-Correlation-Id: c1e1cee0-4013-4f10-3071-08dca07e4e8b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: em9VO5cvhSErvlypZ5E+4BgN4KDQv9G/ilIT0MWcNmxXOrkm8/43K54lK5VPkO7zykQUGkSVELiiRonUiN2kXBnqO1clBxD7A0w1/0ekgv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YjZnyk+YXpEezTxDNR+8UaxJ5ETX/5ew0QIWnbp+D5c9hgpn2lWG6uTc6XPZ0p9KkNuyoJ4skuk707qQSqlprqp3araxmURZU/jv7XHtKSg989HZ+KjcCaf1eWxqqZZKVj1UESCnLVSyxztN6rRAcMON1InO51LhEgCWQAM1SUQ1PJvC0/07wPwm0CYbeCfuSpQ+YXElMvdM8CyuMvahtwzCOXFOgfbE91Nmo2y6y4EGeBwNPO2UEeniewj9xA== 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: MLbJPfk1entlWS+P+VVltq1W4ruELawFJE+iH6O6UoZw0QJRtwHTuan6rdmPV4pPdtctTpQYxtbRx0lLuqsk6MRgP1DXa+q7SftbmmzvhldSR30mZGiV6WNQUVN8oCBjRYaJhs/qD7vzQ4D5D5mILJ1//cN1bBd1UR7uHuUiA1ZEpjG57ucqKSkRGZ6BjcbVmZ1XuEuyzdNKoyrMlNwI5u6bCVWcBRluT9W91p9I7x4PA8iDG8ZkoS8O0TVUuVMGI/Yt9NFqID7729Fjm+TGcqAmnr30YP45z4zh6B3S2BlqhNNZg9KmuUSRrP+gBYF0mrmHG71khoz+IsG6Zmv0R2XAt0puidlcARypj9qEUaCJ2PWUYAMkhG5VWs7aZyLcODH2YvOsF9anbtif/M7XQAEXzDAx6rVd+mNoNHyBgTxIWqyOaZvDbXGZvPmtbN5HKtIZABsTp1rmuAv0k5iPGlZIkcle01smnSUwS6RBkbPnmm3a6rncsEqBVc9aKbA7jXBvvsT4419uqTQ3vPExsM7kA1+iBh5uXqum6XSIaz2/p/a9qhsV8d43Rmoomv1U5PdoUi1XJbLzGwM8AbiqbsBomW5D197fIYXI3u73nkep5emEKH41QYm4fv1gnGFS7t0bJrBvdXxneQLn1SPrShDNwOdTmpDfqPMk/j7TZuHdmXkLGSDud8qhod45LyotnxstXENusHBOqTx5E1mSgbMdh/4RGPMk4PNCGAy2Q8UwS2QkRveadh8HiO7YCxusnvBAvmgPBRsHw62QAM4Sddp7ZKIZRqNKWS61PoWZiuYEX+yOQ0Kt69PXpkdrNPyBm48FlrBrBnlgzp1Wn2lnqzS/8rnt3x4D899t7u5y9OXJy0D1L1eJvV0XTI0Xp0oCLDI1uk1p81BE+pwCrMkR2lzNSXVN4etEr0CCGCWDyCRyeFxk7sN/ofqfjBT1rgRnCvjvi82cqxNO9SEUqceoKnyd7uXnMJ/cg2sw8K14D7nnmsIgBsLh/8tBHG8PwCKIisOkVCRimBEXvUt2/c2jufGiOVQhipRJ0/JYELYwqOm+agyedA/6dWIR0bEjvCjj7jn65vaqfz2pCX5r5spah2PERmXcvIfZqvsg0MADjg/k6BOiJAWLo9yVWVSrqtXXwA+f6eGo3vOXzTeZ7KqAtIbLz61yowuPRD5bGBA/qH0bTtsAJm4ad5jyKDT0XhUMysPb6aHYSWcX/OvZbnDtOT9z0yMjn7fcaIOUHZyCPE1p8h4kopdYvpJByB0+Ktn5QCaJBhyk7MfxN5sPNK393Fo5JCyZp4cCoUFVRg8Ocl2RilPu9YW7N4drcAeYH/uvW8+nHz8ASd+qAm3yvYOdzrwfFPAEnBEDa1NJ+ifG13HQFA/extbRbGXG+tQUr9EudaehSngJawxPtagoWencqN1YnNndKvAe6bpuH9OlN/TcKFFvMG8t4IcRSc+h3l9oLaj1H+FiRacoCGJHYtRBdRCyprjE4qoQGempGzlahrxW1h1LTA06iA+CZdEG6+5lRqoPlnM7nykwr11Dju0i33Vck4xry41SjeXyzRhYW+nXIJRo/5NSupwXNaHwyxpj X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1e1cee0-4013-4f10-3071-08dca07e4e8b X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2024 01:19:12.5301 (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: t9qmzMormzweZMZaF5QkoerklvdnzohkiJmovV7GXu8M89osfWansaEhx3+db6xENe+EFHWTA3MOibG8rDiBCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6889 X-Headers-End: 1sRLzM-0004qO-De Subject: [f2fs-dev] [RFC PATCH 1/5] 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 , linux-kernel@vger.kernel.org, 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 1974b6aff397..a1d8d8e0a49a 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 1f1b3647a998..5cd0466cb37f 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, @@ -214,6 +216,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"}, @@ -222,6 +225,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"}, @@ -815,6 +819,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; @@ -839,6 +846,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; @@ -1999,6 +2009,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 @@ -2148,6 +2162,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 Jul 10 01:33:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13728765 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 DE849C3DA41 for ; Wed, 10 Jul 2024 01:19:25 +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 1sRLzQ-00035F-9h; Wed, 10 Jul 2024 01:19:23 +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 1sRLzO-000358-8V for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:21 +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=8AKRQcvo5J4iDqXd1yESKVO4LUEpAwanjBrOyPziXNM=; b=Qp5a/53uwysxx2i0tbkspP9fxr 2mpe9Pqt8B8qnZcy2GWCNB1R8VuUb+UIgIXctaiVs5OX0ktq2MWIPWRA0u8y9aM3poU6w1CuqXarA NvYPk+GIcSpfN/Xaq+bM5ftCTZDR2rLgFks+JCNw7YHpU3Ntp8vA3pvlCgcGsc1qnEjs=; 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=8AKRQcvo5J4iDqXd1yESKVO4LUEpAwanjBrOyPziXNM=; b=PYXRI9ETMz5b8rv7bVAYS2VAY9 CWFtnd28BxiwvMjp8ZVB17DL5Nb0UBsleH2ZRy9CKDQlWAlwUSlBa/dPLu0qX0wwwHWMWDjn5gEtV Q9B5oQhsQnrMAsr6+7b55p9ryCCvCnSH0/bmHxAAwl9vO8Lk4MJ0TigIkm9Zd1X3ceGg=; Received: from mail-tyzapc01on2079.outbound.protection.outlook.com ([40.107.117.79] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sRLzN-0004qO-JZ for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fs92WSpC7V30ml0IohReshDJ/DnAm+7OnSELJA1SfsVDOiquw+q4TlpApsq9I7hiv8+lia2bIXsya0ndpOHirlBnmm/pLV8XaQLK0L2zq7ONfTD1HAzXhD6eJUUffBJfQTpR5XqwMbgBtqnkMeXDIFCCadOGrsMID69Ynq7EaHPJV3Lp4VetNANFAsUKBOe46k/AIY3V4h930Lj56seTbtSAD3czeuDwlDtsyUoiwspTgKHpllvNRFhGXHgtbyTuXas0n/cDn75J3mRhHS9MEoeJML+hOCjizZT7h+j3felfAuhnihhSY2eV9I3qFAtGykOp+PO7MQvQrnPUxbseGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8AKRQcvo5J4iDqXd1yESKVO4LUEpAwanjBrOyPziXNM=; b=Pqbni5IwPDV5iLsFDeoMDS5FiN2Y40vFVuOip/2JYkH5w0Y2bUFrYxi8ZWYLwZyWESrTMcDwGwWp4/hntdwtcyFj9RnfPl38v/Fpg+AFW9VNjMddM54mLjfkp7QuDHWpFN07/kuTteX353wLLGto5bNwHh894xlaQVRN8r1FIfwo4puK22DFnOKLcAFNF/P8DhsBAavErW8na8nsQwbqU1ELESBYY0h8c6YPjq37JanQhSJSsBPfYruSOAaw4wRzi4W+CipKfCuESw/YTErlglol0gG3beFbp6ZHJafTf1T5yajstxFd6q3TluJOVG8DNnuUagWYrrL1cZ4cZ73ExQ== 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=8AKRQcvo5J4iDqXd1yESKVO4LUEpAwanjBrOyPziXNM=; b=KbxRgJxvqGCc5Q+tX2yg7L8NETo7ou7AQxGsKUoxtlodDJY2Xzdgik0UtHd95vw+Y5foX4cEdcU6RzXt7WSvfV0oXUxqfwtHbVBova3g6X7FkfBqpTQziq/sdBCA3pgtTKcaL9MG1+Kd5MRy9Nb5jEfwPYXnB35viXA+5KAc7ewZigApwyTpmkKVIMXBebK2RVX/HZMg7P5JZHrKA87MPoqPeg/3UZpAh6pVgls4Ms3wqeVhRslWNuBUhobOahdiLF8zQHefBJOjN0jHTya4f3nKduBXvfsObLzQ6SjECgJ8og3pjfFhZY6iauzkEXEjTUqUhmwr0yX218ElPSKn9w== 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 JH0PR06MB6889.apcprd06.prod.outlook.com (2603:1096:990:46::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Wed, 10 Jul 2024 01:19:18 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%5]) with mapi id 15.20.7741.033; Wed, 10 Jul 2024 01:19:18 +0000 To: Jaegeuk Kim , Chao Yu Date: Tue, 9 Jul 2024 19:33:04 -0600 Message-Id: <24fd8ff68cec7e8bfa1f6d3a676425044e21acb2.1720515215.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0030.apcprd01.prod.exchangelabs.com (2603:1096:4:192::15) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|JH0PR06MB6889:EE_ X-MS-Office365-Filtering-Correlation-Id: bc23e70a-bd73-42d9-4fd9-08dca07e5206 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: nDxQlQzz9OkFOc7YUcvFyDJrWPoI8iNnrWry4IHvAtEyfHGW0FtzFBPDVyuJEFxLK4/KzRTvtH648Z/1c6DvbKZq6E6SIwa5/wO1vtGv57UcG9tK8Fq8hNI2376fb6I2ZXqVtjqpdAyBwNOX73KBF3L25gqTpz1v2Eyp4swh/A6dA5XnUP1Ka1j0raNV5vyhWbD04ZDmwxhP9Tq990dK5e+gFggmAI3LFnxwZLbdJ616rDHDmR0ndrGxc0sKZByMwqF1wAgpp8ga0BnpFm+LwJprSaq5HntcoNW62hhfSL+hIczfg0CXipUmQASISHdnidUp1Db3J/uxw3hhF7zy2rKxfmWTPvK1LoDBUHJJps2zEC3bgr3rxAxKwAC27W9olBdcuh50iovcPBf4crwLCDbIO+sKyXlAT1q+IlmCrcxsxNq5k9b8HqGUM53Aha5ItjwaMZfckoC7qUcVpRqomAywxBkG00YBUwQCqJV79YpuoLWQ1H+cwmuDHa3cTGOZWj0RDl1IgsV0q57q0QwqEIyPVQj2SR3anWZ/QFiJZLDqxi39QjD9sYEMZRV0OpBewq49zafskUnTACSQQU1onlENxRG+pLIahs9jVebO9zrLy4DzmIZve/8tqe0o0hz5JqENjgNZJJW9T2ZGLyYUxDCQtiv6cb3PrfrsRf4dN7qj4sBuGZCb81KTXWE81hrJHKfB2Ajb02dFe8jCp3RMa6Z70y7mSm9VgqDf7d+jm30BNMLTfxoXyTPSFo71svqO9rz+Y3bY3xYeo9EP0Q01LIDEyOVwWbcnLAGvcMmYFdJ6mn4dqybEzHX876o+uq0iHtEtJuv4U2QMwU/YWTXQh8C0daRuXIztlXTfWeo3osRUHmYwkEZtOUVbgrTcS6HrpTAYbyNVALicF7ktT7z58alEahovEo34l/iJnmWJStgchIHbYDGajuZe/dOneViTIj3aGgS239Rx0WKw6Syp2WKCtFD7PbhJsEYBeCBJqBEix+IC9Zh8jssyqhCHn+0FHwuh+ofWTD2bqHOnowIEuVa835+T88SXPhoA8Eo9rfqvsjpBvHgv12/27V0nolVZjeiTuhomiW1QJMKgJmTHu6mqtqSpXVSzNp5mgcGZArwXPvcDweowpPrnQlbfYy0QqiSV3y20e5DTFLRRrpl2uL72IkmRgP91vVWOkdrJc47dt8wFWc/hlUHGgpkc9f6de4A94JjGga9V6qSHRj/7ri+OrhfgStwx67ygm/X0QpqP5gFMkoSKVxqq+O3WCPQCcp72eAIxcWWA1KFrNvqEes+zmCXixyQkl6pkbQJ5AiYsAxJ3h9MsNZqYtrJOH+CRCnIsptipgTQRSx5ZI8PIYFim2IZRrfwpNsrzDguUEL7B6MJV+XbY2ck25rDBrgFgeDPyzUbMZvWuZXofHkdS8w== 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: Na3ncw6t6svnO5tRoSioyCCy6wK4P5bRnQCxjeqmgVC0bcXqlxEhh+M5+uoC3I++mAC5VylI8eZQaUUTiQWymSXbZPuY27mxSbzk8cBZ4ue6wFDFOIOFwumQ3fkizzuGhtFB9Ok1htkuaRQN8vdf0s0gifHmEP0McxvSn8YM54MYppOVbUbJc7qWKMrU5IRiJQuCOOfBirJ6bV20Kx7OJgDPf7NXISiwYXuC60CPfwwcPZueCMlAkELUoR3wP3S2r9puGSNhNTgsz80SCMBK6U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bfRQUjPBoXmBhqG+KyVeA0JiWP9TniGhcwTX8/9XR+xTUZJb7ce5dJPqXVYXZ91HfMPwezgWjrB/3yGb40kKGwzTFlNJGH0IFiZonR8O9tzfTiQEPruriYcv/stqymi3Cibq4BM+YEVnXveDx44W4rjl+M6iRmZ3W2av6pyQmF2QcOmwy/pgn+MIaot0Z61xVgHqcC64ShfY5pmrWJgu7UiQZwxHuoSOLQnJ3ycxr X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc23e70a-bd73-42d9-4fd9-08dca07e5206 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2024 01:19:18.3494 (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: Z34lMab2MmVUfY5h+EjoCQmKGw8nXLiEDiTeYaPJAeBJz4YtOG/X8Iqnto9VIIhXp6tJ/MsJzzgJr8RN1T/SoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6889 X-Headers-End: 1sRLzN-0004qO-JZ Subject: [f2fs-dev] [RFC PATCH 2/5] 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 , linux-kernel@vger.kernel.org, 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 a1d8d8e0a49a..4595b6fa3714 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 / \ @@ -804,6 +809,7 @@ enum { FI_COW_FILE, /* indicate COW file */ FI_ATOMIC_COMMITTED, /* indicate atomic commit completed except disk sync */ FI_ATOMIC_REPLACE, /* indicate atomic replace */ + FI_INLINE_TAIL, /* used for inline tail */ FI_MAX, /* max flag, never be used */ }; @@ -2997,6 +3003,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) @@ -3264,6 +3271,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); @@ -3300,6 +3312,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); } @@ -3429,6 +3444,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 005dde72aff3..4bb098af4742 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -426,6 +426,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; @@ -674,6 +676,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 Jul 10 01:33:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13728766 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 2A9BEC2BD09 for ; Wed, 10 Jul 2024 01:19:32 +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 1sRLzW-0000Sd-Kf; Wed, 10 Jul 2024 01:19:31 +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 1sRLzV-0000SS-8i for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=L1D+drMLeIaMKiEciEHJEbpJrxrCBk8iHlY//84KaaA=; b=CcnWCBzAHWTzc6+66F5PNqJMTk pDDMgp4oH0xsweCRWyfYYiZqq35wbs+KKjxWUngSHkR8b5aikvXPLHAwfSqGo+59rhxjS0WOBqiFI gyGP75SHPweUg/zK/IS5jQf2dskbvJgnRe1AcQFTSXgUedHH2YBo1EmRvixG6xJFNnss=; 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=L1D+drMLeIaMKiEciEHJEbpJrxrCBk8iHlY//84KaaA=; b=nNUaAwT3/vS7psSrQIAct74+Vy uWQ9YQ3qAHgYFns7zcXVS5NmiWIO0tYv8ZK8VQnbDyiamPOwiFqfqW+RqFCdJqMU8v/24yAGI+TMc 4x2TCxM4newdSIkp8dpFO226X5vFzpMwdHK1vdIjjHVlmLePjdBzaIfC7MGd9HpA94+Q=; Received: from mail-tyzapc01on2049.outbound.protection.outlook.com ([40.107.117.49] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sRLzW-0004qo-2l for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eT0MSKCHlUytJynp41R9/ZI8lviRvUd0u5U9/J3PYX0OgzGyMmIQv5zp0CRw4z7TbjK4ll3vex1iM53lBwPWmyA2N/d/2nUQiWi62+igrENVkxvlnwBt2a+nuT6cP/iHUvNmWB+Hhur8HWoPdhKHwr1ev8NSiv8T3zc6HwTRzdf6UV5ufvqYJUVCKi4v/I6WJjK/HYB62lS9AVzQtQ3II9A2EBFkRDitXCi4K6FWpdtBP1kWUAajKhj7BSIO0/QHSuicGd7QVIeyHFQnMCe5OWUErBVssE91Xnv7xbY/B2rJ9aT1MEdsIx3wa0D0YdTUBStCg7XAdlnSyCXRCxZnPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L1D+drMLeIaMKiEciEHJEbpJrxrCBk8iHlY//84KaaA=; b=IaIn695juYEfTDXomUP3P4KdP9ClnCDESVkskSVAloNlACs3qgyXDvJjpDFJGBPhwocu82Qbh7b11ohPgIaRVelQkyZULRCdG6QhNFcLx9wGuTyMlvFREblsrLEZ5z6n4Kxw2cw2uCq2dzXbWauTQ5d+B/OWOU0KQd+EV3NbyCUugwmCviTIUwemTZdcEQHGhLXpGDS10u57D5d5Xsiz09f7YJ9M+n6YAyhXT9DY2XuNg6Hp4r5Oc2gPWYU6vDlMjvuiSS5UqTY8HrSmPMpxb2XP08HW/yKvx27KlRgw5kxrVl4JKd+XqsqM+MORJETgpJrf5y1G0J13cMA7QdQbYQ== 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=L1D+drMLeIaMKiEciEHJEbpJrxrCBk8iHlY//84KaaA=; b=jqL+7ZKBSRYV3TZVu28Z672sVmlxkltU8KNYsSrYRpzrvOwzC/lxuuaGuXjREhMkXr1f5endZIRaj3dmzqeTwk59eXRDsWzXhJUb9i5CjGcAtAY3H4VhWzQpqD7hP4hN/PkR1FByz1dShRTSMELLtYSFdrG2VO/EmocFAZZ5Ky1Luoi+9UO3sv+xAjCLLSK8tFv+lRUEMbq8c8NsOGz8HxLzBGvnGWnC0DRrnLRVYdRbwxE264/PDkeHF4a7II2pfgpc+3ejYy8MhlWPtaO+m9904fX4kMI1b8BmTmA/PzNULrmpTqDdHJKIza88P3jTVaa68QnJS/96FDzHgB3SKw== 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 JH0PR06MB6889.apcprd06.prod.outlook.com (2603:1096:990:46::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Wed, 10 Jul 2024 01:19:21 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%5]) with mapi id 15.20.7741.033; Wed, 10 Jul 2024 01:19:20 +0000 To: Jaegeuk Kim , Chao Yu Date: Tue, 9 Jul 2024 19:33:05 -0600 Message-Id: <058fdab7474a21ea1aedb3b39179828d43d267c7.1720515215.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0030.apcprd01.prod.exchangelabs.com (2603:1096:4:192::15) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|JH0PR06MB6889:EE_ X-MS-Office365-Filtering-Correlation-Id: 089ea007-9ad6-4ea7-1c5b-08dca07e5387 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: f+7PmTata59V5avwSxoFIu5IhCaFCHljws24BZGJ3maF5xMNAkpr/Svg7c85pG+vPkHTcS/gPvJ0G7ZNmvU7a6ssXyb6oRKjAqHRgI1BvZpU5MQWfy00Mf56xC/i5wYF6WfwnQEzvaVrd/t7uziYv7qxRuRRORIQ/NfZ2I6gsF+SfZaWoUjhjvzZQ4lTRmiDIDccAXnvH9iOX2p0LWh9X6iXNj5fpQmf00iBuRxC3ASp+TBlch8A0uJRYoqqobA4uRiuCi4cysRl/9HP6GTmOKQ5OlaV4L4ILGmGPrOnRPuOaJ5sGoCmBS3yJdvQlnfp52PSPxPM6PS6oOFnap+RqPaXbUYLSkDgf+kdj/Cf13WSajZqG4nWTpADkTsiF7p8Id3w6Y0IStiuNuN9c+ZcNz58Ai8hFgBtBKqSOEi47GBbQSYLOtdcoZDQYqNMl9DyLHi9Yq3OiReFf0H7/KnUDcohlZNiSDLcJF3yuYN7ns/P/JmfwlX3rpyoD7CGEM9sGMmfCOkRfRdpdWBKGOX+YrsdM2dez2bPM8E8bkboE1oyKK2/a2IVxyR2GV4H5JM9KOWbDvTZX3t+OybCfA6z4BjUyj4iP3TOojAz/FldrC8cfiY68+QtmwpXYtRz5+FWpb/tsbHDDHrVpMd6CRwlhaN5SDqKc9f5tZQEaQmrKtUdqp02lkry4kulvMQy/GwSEY/Q8W6AG+bcqxC1yaOePhl/svO6eNYsCgNynf4QycdagN8WGzTomh2xHT3Mq2+RiRHGWMJGV1VFdItkhM14cvSUs5Q7lMFw+O5lqFVU2tqqWWzoM0Anzh/u1DTlJQ4GhOvp092TCyso+bgHRtBTZhKUH154Mq71bYfO/GwYiNrkonKdqe7XNpJKjNf3/IKc1Z2MnErH0clCpQ35bYVDb8E9Hv79vHKksskKaiktd0shrfNv37dptVf01ggrjOj63lwu0UZHPB7GiIiVCi7s5x3/LApe3YPbkWTaxWEKqp7xdfNyr6pT+dQ9oBe0Y+Du67balH+z8daEJ56VGFYFelVZk/7v6Ky6kPo5QQpwC+jpz66CgTI3x3taiBJnl9E+QRsYd1fTH02Icx/Sztd3Vab+mA767m2tjWf8I5xUNKPpZYErOSSKcj52FjOOoWUGAkor7Uyf/ZPbduL6J7fR8T3rnMnApqc+xR/EHtr4wKg0A3hKRp5e4Y1QeCj88X9e/422F7lM1UMCC+I6XmKyiP2tfGVeQmFmnUhjJpAHOFEm48UsLOpvrmcYh7npg3YFETF6gwulykFK/zw8BmqH6WAF2iq7voISO8gKni1g88DzAKXhAJ8QcsZXJYJj0NKpGt/7a5hila0KoF226/X0RtDFC6dxcPSljmKZQuCmcOAGpNrGJuFWgfQnJNDeQhKReXO8Ab3T6JXCMABqkJaykg== 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: xHIBFgwrgmak8IgXwn5dOPLJHPPAJZSsevUN+cLyPegJzWqcCHuPlClvwe7aMfmdnyzuzURUV52lWiHhmUoEy91Y5oK5eoEuewWa3im6dQVXNAVwStd9cFA1C4dqkgkxDhtD9LvAf+4VjfefGO+2cuzVxto3kIzhQS636K01GQZUhWn3BDegh4dXM0oFaXQz+Wq36TuxcOCotrLZcQZlnlNK6MiXoa4UlDMGJT7kFzmUo6SOgTOE/0ATT+uLPj1uFvh25xRbExexHrFwwKX6nnzCZo2nBc7ITYTaPM6pryl8jjMTBdyTaLWglS/Dq6lBpNYUrZ4as4SiOMYd6Qi5nEB97KuLAjdjjJEfqbYNlpG2KVMSGeRCAKfWf6OI0dhGlkL8FZMcqtWy4xu8Yi/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IMWDSDRzkXIKvswj2E7z2s8Gb3Rz+o6uR49DWC68UAVkBiiJif5d+Wj8sCx8ZH2tDRY9pKv3zFB9kBd+NbS4Sc73o0AkE/0OddJx+0g4qQFod6VBFMiXtoOHs X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 089ea007-9ad6-4ea7-1c5b-08dca07e5387 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2024 01:19:20.8848 (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: ki8BESFgk8JmSdwsZAAM440cuogx2J4a6hRomyvil5tLyaMX37AW9+vbSxZ5Lc068Yqzvl0y/QzPlj54+O1Q0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6889 X-Headers-End: 1sRLzW-0004qo-2l Subject: [f2fs-dev] [RFC PATCH 3/5] 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 , linux-kernel@vger.kernel.org, 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 b9b0debc6b3d..2481da74c13d 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -2769,6 +2769,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 = { @@ -2860,6 +2861,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) { @@ -2882,6 +2893,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) { @@ -3386,6 +3402,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; @@ -3414,6 +3435,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 4595b6fa3714..ca43396df4df 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3323,6 +3323,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; @@ -4183,6 +4198,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 5c0b281a70f3..19d65ef0fd00 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -708,6 +708,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) { @@ -4648,6 +4651,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 7638d0d7b7ee..8c1636c1ff2f 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -84,6 +84,7 @@ void f2fs_truncate_inline_inode(struct inode *inode, { void *addr; + from = from & (PAGE_SIZE - 1); if (from >= MAX_INLINE_DATA(inode)) return; @@ -138,11 +139,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; @@ -158,8 +160,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; } @@ -192,10 +194,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); @@ -243,20 +268,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 Jul 10 01:33:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13728767 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 620D4C3DA47 for ; Wed, 10 Jul 2024 01:19:33 +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 1sRLzY-0006Y0-Cp; Wed, 10 Jul 2024 01:19:32 +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 1sRLzX-0006Xm-9f for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:31 +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=kSxp0Z9sy8zL14aTilIZMNBsf5lvlnuWdkZrA8tEkZ4=; b=hRrNu3KTZ5pzIf26XT99rQj2gh +fmQ39tX8gDhyGBTJFsxxUSnDALdJZ4v075slPuIUf3ewcYKYGVysy2q+m9tLOYDDCK5PXX7xUH9P o+UoGpPWYAjb0TqrY39cRes/tISLpppFybHZWWw/0DI3XgQnbXjLtJOS3dl8sDikbBzU=; 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=kSxp0Z9sy8zL14aTilIZMNBsf5lvlnuWdkZrA8tEkZ4=; b=CrYlk7IT8UqPEv+p7Hc8i0gzWq f1H6vGJHnOZ0EF9+td2Gp4fQsf/EYg5WtkludNFiMpaifU6+pFzb7wn+d935iCwY+2+OoPugDOXJR XHCkqRDqBE2CLk665t+stlGYnTW5Xn3wJYQ1XQ8+9JNJNO4TEhPe9DjXcH8sTljCcxV0=; Received: from mail-tyzapc01on2049.outbound.protection.outlook.com ([40.107.117.49] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sRLzX-0004qo-Hp for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mZY92rAaaKG70YtutbblbavkLoG8w4XnTjzMgVu4NNTuXgYSWTU7vY3CkeUVuopM5N0RSGVtjzOF9QLTxQ8vYamisjmXIP06vMUaCQeP9Y3H3ZXUFpf4BEUYhShFft8/yxCWFO8GIQc2QJa9z4/7ZvtZx1IVcVcTDb6PibG0X7Y3BJctYOyN7QZI0CGDXIqh7Wu2sKN60Dgd4lXjjBTZBretmphzLMnrQtiyr2jU4IjBlqUS/yXctI1O8DWSna6VOOzSMF1WOs89houVhGEbbnSf3QJc444DMM1HwsCrpkJqZxcvQa/DpQMULHxh6sjlnGjiaa1ASgI4oq3YiGxvTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kSxp0Z9sy8zL14aTilIZMNBsf5lvlnuWdkZrA8tEkZ4=; b=WRXO/M62F2bwoQON9fPzay75avN8gHK8ML8AYvImINz0uw1SdR9qrNKtM+o3PPr4rfznDo9RbretJWCbI4lc9H8YVHf5mNXTKXnikOiEOOcsleDUy6dJ6+iyQPsJEGJcnneueQAXa4mMKKJRFw1Z7Gxi5zXx29FcSLp1orHe9vsYl1exTLYHW4YF1cU2rV04nl/RVpw4wLP6xykHK31vW6Fh17wC9QbWABfJXHWSKXMUsNuJ8sow1S1YKdZz+8CH7C8eOto56Z9F4xDFn0tAPOTCn9wOMM1PyIWCi9PXXFu2BWiumJEGTKO0Kveiq9uIkaxBetXWC+qYmzD77ZaAkQ== 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=kSxp0Z9sy8zL14aTilIZMNBsf5lvlnuWdkZrA8tEkZ4=; b=BilNDH9Mao1arKCdP5aRo9H+jjwCY9XBnzRwJeAefPeY+2v+7TJIHPcGvuqOpRXcQs0z+p0BCRQPiw1uv8K2qCMWMZP/NRxJ1rcrO8JR6ypjP9HT/CZPnPIWQov5oItpl2JIQPmY7MaQ9rtwFshZHX/LFWT6VtOn9rejMx0c5R8AlYuha+yhXoEBGVpze9l6QzapdeRwaKl/k/xVNaRwsmXmrOoqyRIk03CAnDhe2kISBeVIf7KCZ+Q/L3KE205fYMx6uBcZCDkC868BW0PulD+Qzxmlpa5VxDieRGVUk0aMIPRgB4MtlhQaAR+icm3Jwj+amXuDHDGvNGuGNaLo1w== 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 JH0PR06MB6889.apcprd06.prod.outlook.com (2603:1096:990:46::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Wed, 10 Jul 2024 01:19:23 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%5]) with mapi id 15.20.7741.033; Wed, 10 Jul 2024 01:19:23 +0000 To: Jaegeuk Kim , Chao Yu Date: Tue, 9 Jul 2024 19:33:06 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0030.apcprd01.prod.exchangelabs.com (2603:1096:4:192::15) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|JH0PR06MB6889:EE_ X-MS-Office365-Filtering-Correlation-Id: b660b001-d784-46b4-ea0c-08dca07e5522 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: lPcDXUenU3eltiuHDJISFbaXISKXH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xz1CnlSJ1UQMLtYbEiIdRnkE0cGepa1ulfa4F/ML3wWhQNsn4M51FAtguE1lG+CNCFCHqTN38oOYpfzrbQ2EuMMcc82yFGbO07fDSBQR4Em+jFDLz1wIyTFVFziLeSGDn99AZy0bkVWWth75FrwxnH24gZuxz9QEBsmhr+XBL6E7QKjDNg6z9kkcOITm2xENavKrP/TzZGaxk4KZG4x4brO0WA8s91Dejoucr9+I7lAGtm2JyEmSXWwzZPQU4MBMSWFgzyrhUIMFeVZL/j3X22TP9wBT1w25ObVFPB/cUks3OrXJhBH+dHvLMHnft7Ug== 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: vOCg/WIet7hTbMdXRQcdTW7ohSMooE+w2ctSLhcDhFjc09YHxKd37nbd0Wr7jHkAOJ+knLHRocEMw6qE61dV40xyo7bbOd7o7ly645kl7OUULFct6T8ORuwVlsbwENKmsU9mx6xLdFWYgs5+yJZ/LHbe7lNwPi9DoNjV+0JYKXXyTZ20OF2fKVueofdm41c4m40X1Ny0Jdtkel3UWzlJE7Gf7a3Oq36F8nRmbaCoBaiwaU9jCNhGLveq/DVLTXBSDGQYZjVfu99qCJahWNbZJsM/otpautXsoEIiB/CVzTlDz/6L0ZkA9/aog4N+3Bjf03flKeSZ1+bJ4e1RSIXqwHODoHe9iyzP3P+CBR47dytUOOswofU6hbme9Roz4QVZC9w5qpshQwlph+zRhkdG53UL6AkFBIpPZArzhkSS/pSBFX4VRSYYXoJsBDUUGc7XDvo7XfyPoHdw/Cfkvj+JrnPQp9EFTvyeNVCu75svY8sJIKl5QJk/Qb1NLgf4FQy5TjhzrfLHllsQlH64tDnv6M8uH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hjvIewi X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b660b001-d784-46b4-ea0c-08dca07e5522 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2024 01:19:23.5752 (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: XyhLy2ke2CNADH6Xv7zkpDnyzccJhtcn5j7ZI0G5tbUzqOY2CdHMrigH04KaNXMjciOrMwFrhAIdoJ1gUjuVUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6889 X-Headers-End: 1sRLzX-0004qo-Hp Subject: [f2fs-dev] [RFC PATCH 4/5] 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 , linux-kernel@vger.kernel.org, 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 2481da74c13d..1a239f4f82e8 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1920,9 +1920,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) { @@ -1981,6 +1983,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, @@ -1998,6 +2010,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)) @@ -2011,6 +2024,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; @@ -2370,6 +2390,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; @@ -2390,6 +2412,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; @@ -2455,6 +2483,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 8c1636c1ff2f..e4f72291713f 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -68,8 +68,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 */ @@ -108,15 +106,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); @@ -794,7 +789,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; @@ -806,7 +801,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; } @@ -816,12 +812,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 Jul 10 01:33:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13728768 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 89851C3DA41 for ; Wed, 10 Jul 2024 01:19:34 +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 1sRLza-00035k-LH; Wed, 10 Jul 2024 01:19:34 +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 1sRLzZ-00035d-6k for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:32 +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=CDHRGeYMIYMR3MKuYJG5LMrqEXmMvyMMMZn0tdgP8z8=; b=DzM6l/9J9rCmVxuTM1yoDO4NUA OfLooOjDdHTRdrXCMmkogPRrcd/K+vwK+4vhxM65+Co2/tg6IpbzojGwup/creYx2dBkOK1IrPWNQ BtICuu5jURj7lWdgdpZttzVyoWKU1LIB2jMfJz8JPkhODIbN7GUt1Xz2ilMnkZ0UYc1Y=; 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=CDHRGeYMIYMR3MKuYJG5LMrqEXmMvyMMMZn0tdgP8z8=; b=APUeOg1cROkFccAidO5SEqZeqM X+H88vsfJeu3WxC6mGLZCFj4kmFCLuzt1ZobpeXT7YVSz7gxcUtsyd8mHaIN4yvzVkJXn7q+/uJLd SB0oEQRq7o9iBgmfRifniKzSA2fNHJrFCSwnrzwsSnRbPjDSb7BtjSLyVnJBBL9mlVGA=; Received: from mail-tyzapc01on2049.outbound.protection.outlook.com ([40.107.117.49] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sRLzY-0004qo-O5 for linux-f2fs-devel@lists.sourceforge.net; Wed, 10 Jul 2024 01:19:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QzPrBJwGevlhuApPbB9JrJmGUvFoSLIddRQJE83pJdXr9gKZO3jcMRVxMrMsDRlAx4yK5f3Wt6qQOmm74b+2rOLRY8KXn18oOT9ik6Xj2geHqk29xu+d4lt3Q32NHNi4bDrwN/vBiKnhngH514wP5SII2jJXc2LkFEtoDcdIcWk2obMnLNoZv5mO8Z/lGnqvZ5DJ3++++KNoVkbj5R8DloQAw57fyGCtz9XSybiVw+TGvJBQE0IUraUYLziCCl3BeHMXly+z4AEiUp+U/+D6cDcpdgDEhTwvKed4VeW8e+BO9baKXl0aoLkViC75ddYOcA1fYtRwfiSQw24wgl9bBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CDHRGeYMIYMR3MKuYJG5LMrqEXmMvyMMMZn0tdgP8z8=; b=hGa8G7GVPNSIRet7AXfcNkesHA+COwdMeyunQJis6lzZIrdjE4y/Y7hVi7P+GYEdS8BrRx8ky/FAo0/D3w9tbsJXzWApDL7BlGkL50MrKQnWgXESrLVJ6IsdNkEl9bRBwcphC7goN/mx3ahL+nBjDQRaIC/q07y3W8kdo4vI2nUNAUnkn1wgra0BvM9B0Qe82m3sirsSidtVUFgktr1zzrdIDuWL3+3EohdI7pd8KiFg07vEpRIbXz2T5T3KyyTbFKXu7bJ7WMeZUtqolaUig57FLWXby6fQlyt+rdmIOYCLsvCMMkhRhQkbcIB/RXPijIiF7/zD1XjWrwGD6bKOrA== 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=CDHRGeYMIYMR3MKuYJG5LMrqEXmMvyMMMZn0tdgP8z8=; b=NvKMFIUdQuljtOocgp8S7UO2o4Lfu/iKfDZkD5zqwTVnwzOepjwJ89IiI+FMxsMRAk/If1HY8RJtj0aoRSymhTlDDzJslcBUxTQKWEF6tkiuctX9tf/091eXHtRAdvVvMvmk3eXzsIVG10BwQLcYgCTVc9DX4CfXO/pBs+CLQW8CC3HXxg3RKMy+Dk5c6eAaS+4Y/1TEoBDAuzGtrBwxh6jes97RyrGf3fuq74G6jer+MJqBQ4S043RBE1M2KIxgZEo0+AeOgjXEQ7jz+T7dX93XZl+ktie65GZ/vrbjLyDuuQED7HfYUm2+btzNCWxx8xtyVv1JU9ukXR2ohBISBg== 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 JH0PR06MB6889.apcprd06.prod.outlook.com (2603:1096:990:46::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Wed, 10 Jul 2024 01:19:28 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%5]) with mapi id 15.20.7741.033; Wed, 10 Jul 2024 01:19:27 +0000 To: Jaegeuk Kim , Chao Yu Date: Tue, 9 Jul 2024 19:33:07 -0600 Message-Id: <3ae7c67217cfa89d6e152853071fef4adfdc4766.1720515215.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR01CA0030.apcprd01.prod.exchangelabs.com (2603:1096:4:192::15) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|JH0PR06MB6889:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d5c315c-b40f-4426-ac08-08dca07e579b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: Q0hd2Pf4yy8SJYeAyRpV8gnc32Fdst/UsKkp5JOk7pwUM39I4WZ1pzOL8NZXjNhXDUCb15A0DMVYLGB3PdduY0+fYrUo2hiEBMhgw40fYWaREdnoFk59UNlklT6/kOOtdMluj6q99UPAD3iN2LNN89+26h7oHjFXARpzEekdO/+C7EtgEx5mf7h+wousRujT+oAd/5SSEUOFMqI0nlM1hsVHlZF2+egu0my0TvUATTvlSVnApzV6/0eZLWN1o9kx0ykYNL/kNfIGrS2UDLnHirOEJeLngvpRqUUgGHD9ADLxg2YxjywmMx4ojGeztgtRUeTOnGpKpyT1Qv/AqR4zlM+5d3X1HkoNVx+Dc9uUNtExyL1+F7ERlcrmdMw1dT5V6+bjf2zKRX+DJfHaTYiwyviy8mjTmb8YNOOPJEN+7315xxqA44nRz3W2C78z5NXhKD0n9AhAXvmIAMVnPaT6ho95QCSJZGs4l02jTLaz1er4qL+WC8sLshdDTKC1vd2XdZCih/WFFDycOKWkldXn8cZqYdKCo34U8pWF0oveqVb8raQz3j/nuSJpjSLLxOrISiYaKW0h1iwYtOhBhgNAayY7jAb2FHlTJ8oye4p1y0iZRnD+aSbine5C3Lvw25T9zC6/eeUtdDeTgv7z0x3kRMIsn5FEfMjISSC++V2Ljv3VP/BaS1GI487Ez/YWq3X/rKmN02AKlFAAHVUg6RjW6bPi+jgFx1eKZdR8rWN+6CP5RNE9S3T3dm2RBRYD59wQut3MBXfv+8TziBrEYVGZm6000Ka253Vbm3/L75FUEgIvLpL0BhXUXN6sdIjniETObrMn1A8FFrUCkc++onuOc6qswPWfqZO7WAkQiCeiu5MO8Rocpg2YZZXsI24e2PCw4Z4nVLKr++ZeBj7tuv5ya/xkC8FQK+8JrHg2FAORq9gWs4I8rkM6N40NhZvlRBUUCZi+uBrTkMIPOaVlmxbHh2zRTa+RObhhAlyP5x7p8RRJsRLJXIJcdkLs0tI+3hkPapxe4jKICtUKgIL5X5eMr+LBkP7k8wh27Ye8wvueKabKaGjEEBClja8yR/JZlVREssxA/Yb9WXJ30DQy0ywd7yK9vF80vihnP9vAMypvQOYQqe6gOJ07zwNkLBn+RuqRo7E3XM4xpUnYgGO6OuR38tUzMUzzy4NCm/F63uBIZjPIsDuVzSQLnL6mEenvx6kD2XhA9a3a3niZ7f7nfLqXSUVoKqqab7ODijYKdtjV97Z1vUpKSh++00wCsupAqE94zUWmmg3E/7Hn1RG8mXsEHcqTgXZRGHNcn3098yeszKBBFE9v9uktETLziLEv2Qvp03tWeTW/yDfLR+58+fLrXu0zmzYfeO+2G5eq20922X1sDttV7y8VxVSenBl8TmTxItz7cHMe5yGuZXsXT6SNZQ== 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: jwBaedmmEJqVDHC92voV9Zr3xxVGE4mlnHvdKf0kuP362k3QVnVWuRQjQSCJmNpHLHomGimdP1mkjf10hyLpEGNnxV5LcWO3TXP8ugG3Xy0EnIpbzsbhmT+lKLYItybVy9tACYUZJnrbADIxNLaF0BUULCNqzO1nFtXWt+J/c34DP515uQ9KBkO4bdJszojhC81q85V1pkrWDNXsidAMaoBFa0LWa3RLHUD153Dty10i/QZtpkxvyjWJmURtNm4KX66y5mJSxixCqX6dWOiAiuDg9ndhf6YL2vJ8whYd+aAS0ek6jt5OfenNi8CRgXiea3/1eiBD19Wo99MTeE2HNhro8LX8LNE1XXr8Voesk6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qkPD8YMMYGt8LrKjWrQNTW6rC3BtWGRPBkEgBxvPuMSAgStTrBC10qdl7y2rXieJ9NTokAm2llACMI3KlLMB9C9u0GZ8A+++3ZBGsHBJrdU85rDQ77p7LlNAK6cCMC1yifWXIdfyYQJouWjgDSdYI1v2nvHGxAuLhfC91 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d5c315c-b40f-4426-ac08-08dca07e579b X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2024 01:19:27.7787 (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: wnw04RpFJGLko8vXsijqAyoQZgvhId+t6MpRtyiCLhvmET1xGd/MuU6MqSapHjOe2uPy/UHJnD92DplooBWpSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6889 X-Headers-End: 1sRLzY-0004qo-O5 Subject: [f2fs-dev] [RFC PATCH 5/5] 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 , linux-kernel@vger.kernel.org, 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 e54f8c08bda8..ef5111420524 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -313,6 +313,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);