From patchwork Tue Sep 3 08:54:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788310 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 09EE2CD13CF for ; Tue, 3 Sep 2024 08:56:37 +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 1slPL3-0001A9-L6; Tue, 03 Sep 2024 08:56:37 +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 1slPKv-00019Q-Rk for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:29 +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=fIr3X/X3WN82YT1uK8xSAiie8u kEBjc0ly/kF5Inxz1qs2Sdn+LNyWobxGM3Jydrr/6XDFd4zFOG02JsQAy0HbT/XBYdjVfcUdJgjh2 iGIdHORVixNjHJ0FJungYgazCw2sTYSkwjd1Gz4kTZCFzV5zS/IYrUR41Op5IGfboSXs=; 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=Z2Y1Dc811NnW4TI+vP/SQkOhBU G0H48tIFbel/04Sb4DeW1u3p/w7PMwoCd8JSDFgk4LYvFCkRKl68mQrRWTjQGwmpSooJkBbkYmGKD C/tU4uQC5w8cB0KI6HNZm2wlopDFHYfZ/ZIFo1tZ6YTX6MIJveCoJAKRSqRh8PJiO2AE=; Received: from mail-sgaapc01on2064.outbound.protection.outlook.com ([40.107.215.64] helo=APC01-SG2-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 1slPKv-0001Uz-42 for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YaTbhq5i3xtJqMgf9C8/qdTb/vC4Hn528HaMDgTFW7TtuZU1xgmNY1I7W+Fza0BelkjBlzwZvn+8qVva8O8OIQhM4otxNNrqgId7kwMhJWb6zZpsReGD7ZBgXi/Jpcs3RlmdFno62TrohBkYx6vPf4CNjSLtMQbDV7aKc3v1DmPyHcUNHOGpLHEUe1AC87rXP4YiPp5GYZjtC9FvrHQJLyiF1TBjrOY6cg8wRrUqActltdkYQ+ZGCCak32yllymXnKL1leakZmTCh4c7y8B/3sEg1OPTesGVx4HsAs1SkcopaUQGdqnz4EmKY+5bnwgzbCClc4/tEVFycVJokxD/OQ== 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=MlqQtEQ7j7MHPoDnvLD7kVdEPGWJ3QVHqAleoSmrrruMGhFSZ0gYU148AzBqz+CmQJzbKKSJ6y9clbOJ3YJd+V55ehAHL2iDb0YzESTh6e3boCkqDzVS9tfYrq7qkU2S4+Ylbb+Gm6anWJYLFJJAcHGav+ZQQBcVAdRnI+F+TWSghtcxwdGkvYsiehUxDbvBYSQrh7SfMOx5MKI76z9yFbQYo5WFRAAlzRM/05A3m1LnojYPkpbwhcz6oUgP/VNMFFy++iDVLodKAXT4fOELe9Ui/i2Xc1rfFRbLbp1Z2EYiYhZDHJnd7lhZaK+fs30i9rJ+Cogjoh35M6znEO6UCg== 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=WewX4qOdRSnb5QLSz05o1J7F/Qwjh/4M5lGrN6UjIHuDAnwvhp1odZLw1/j2WD3J2MH1FB1QchIc5bj88AKY1MLVBzf0Hv+2rCsBpyEBSw7lwaL88UvakD6SQJ+bPLbcu/f1LRqA7yFoOBM+vpzGwFP9aK9iy3OZmWiBMrczEfnaf14KOqWet9cqC7o6JdfnFCVNTg8vc1kz8qAtzZNglVySV0t/brb9bSD0GliMmle+0e1vbTzx1UniIuHQq7OR8RHe+aXinzQ5aFyV4f638gGPYoyEGA/5r1FIwHAWeDopMfcP9NTMNe0ZG80slrPGNgdn9qT9wVodWGYgNd3TXA== 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 KL1PR0601MB5536.apcprd06.prod.outlook.com (2603:1096:820:bd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24; Tue, 3 Sep 2024 08:40:46 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:40:46 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:45 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|KL1PR0601MB5536:EE_ X-MS-Office365-Filtering-Correlation-Id: c70d39a8-6e71-46b9-e93a-08dccbf41ad6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: bWBE0kUhf+9e/UevVquHW6mKy+EGI1G72ekas64zTtjE5XJIMmkTuR2hXhlxKs/UNCiXeEo0/EKJILJiSmwCvIHA9lVj3/Xo30neIzxmJRxIXUp77qD3ZdSn71ehzj3+lLSOC/cfpZCngs3qQV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1I9Q6xI/WsSHdMyZpD2kSD/5ooNKYoydC1rTWlvH3Lp6UgDXF5uRmQwhts4xCpu1r2UBdeL0Oj2ZAvdldSU/Hz2te5RI+U/Yndom4rUdzvDGWS7HDZ47+6QANWDDbqPXpGuJjdtArzzPyZsTkuct7WHHzbabsAMJ8xlie/NLhzKhQlv/JN7RaqB974xKyv0nJDE1qE6bzSoGJPaQ9mlO6mCPm3I+Vz3g== 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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vIOmbTNxLUIKDjxfM0jiJ63skSLME2TCKre5tDlCaB3LcycUcCFk+WU4I+/O1WM2eFXsVk6kQEa/fsQwWcQMGl1ElPWTBcXaG906pe9P6Hu1wnaJg/qY5U63TWHRoZhVDCV6tF4KspecYVHJ/cXmGAY4iM1o/xIBI3t0b7pXrfZfByACxLEQwsqKXCW9FIFDCxmFx4qROMgxtn4MBbdVdZxiObiyV51T18LytwGPYv0EpDjRmwQ0k6UxmovU24DppFOfizYYTTXQFvKK7j1E6bV1CMWrhIC/g64Q9VkOclaUL1S+sTq2XqEGZF3Ez+BLvyZoNRh0ZgrL9Tz2I1pkb+/UFh37qvntmxjr6rDW6aQ6DCyUJvzJycXftAqBOfSo82WCJlx/UGv2+t9dDDBKUGMIrxFrqMw8kk1xRgYy1ZtLTkKby2BkqX1Uj0enzUsCZg1svO4ySHssbxI3Y1Fx67GxObdPSUywywy5ObywXI2CXjK/L0youBlw94KF5SQP00HgE2EHfv0YlowhYByZXb18tQhhxyiM3esPsNIFsaB6Vt8gjFwkm5wQL5X50PgP3DDYNcuQFESvI91OEOWpIu7EXeAerRcKy8mDvyxImvLe6g+I7T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PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:40:46.4027 (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: 3Mo7xzBAP/KjcWAvfiTqwf3KmS88Nts0d6UC9SeThksik2TMPTPcvQPq+E4AsV+/xqV3ebU7/ttoTv+uexghCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB5536 X-Headers-End: 1slPKv-0001Uz-42 Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788309 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 5CF70CD13CF for ; Tue, 3 Sep 2024 08:56:05 +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 1slPKW-00079X-A9; Tue, 03 Sep 2024 08:56:05 +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 1slPKU-00078L-8T for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:03 +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=eNKOvf3tVtYG11rpWOO/lCeR/J swt8zKg2hzTplyC+KGYPGC6jLtt1xLR7Z9htpxN/fq5CYV6+pVKl1wByckiN2Ssu1ftgCQt+TPCQG xfcn1hUvf6bzU24yI1E3M9gq8s2GFrjR/dqAbUd2Xz9BpNRTinUO4R/CSuM2EjG/VTeY=; 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=EgvTKX+H4YKyNHPVxegA+ULtCN y1EqZUW8NLOEV/APIpQgFezqtPoVVNvcw680B//t/oCIlt1wwVDPfc6FcCPLcHRna+RQ3YeLPcoX5 KUGKplBRCZOT13V0rhG7wAogFZbWuwEbGyzXEBsXmh77nBxsMZY8YQPUbdeLzfhbXdvA=; Received: from mail-tyzapc01on2074.outbound.protection.outlook.com ([40.107.117.74] 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 1slPKR-0001Tb-S8 for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ecm3IwgMvYZaVLhRNdtClw2QsWMjbfIWje/ZKbU5EWrtp1LkU7CuLqVRsEWuqC8ZRKRK2GiA3Ng5fIP+dcSHXjEjAqD9OzGJ3J4CVJNQz3ZO0lyYdfeJErYPN2fBLLpV5AyuxseYXUg2B9OPgSTVgMyQ4qlcdrlzmN7zHxczA/AgrsTEQ1Wc19Yqlhq2m0FUxh55GaM7Ay/HBzReuR0gRJ0rmvytxSv7bmY3DLSx/qtlyWnLfYZJnoIIS8Lppxvrb+KVBZkVM3on4fFswRrqJmq+9gN08YzPTBpYYNOGkocUX2+sQOGmVDROeyhKhUB3MuXuYSY3GV4tDLqDnwpeRQ== 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=lR81mV6LrddMap61CbynAEF0GxgL/n826Ov6g96R5AS+DTG6GiAzsgqNVvjbBjdCuyNWuvGiuVL8iwuZNdk3SaW+v6UdEwOR/+mLw9qIMvaTwgF8qQMXN0VLIOtp3fBsWwI14tmTuecAxdww1Gh6mFleOCkEIBhUZKbj6TxRysZ/+MOnsRrQoe/Ih0+hmNGqtMd0v70N7w/lPLlgmGb16q5NrS16r4WMFNsVp48PbGSLmr+Kr168VZRaizFnbR2Zv6RlnfrDvqFSIo96mCJZMOiHnyIZUV7p0/Tcp2B6V1qddA91LVJ/Dcy4U7sL/aoiIzPn5hcV3/St8Jlu40BIOw== 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=j/bN0Uq1us9bBj/ZjmGhiYQGyq8teeBG63xW1H8oApBAqsm8TuRtSoh81uD9vsMP3eQHBFOIj9Dczz1DyjC+JFVHy+F0IPviVNLGGCM9AiS5PFA740KU58plz5aiVj2BVmJlhRs1ItwJZ3oxcwcX6oKuTGUe6Vlfvr3MRGvy2dJa323y5u9UxhjjKU4PHlOftq+MHtgydFxjvacxyRbPEFkzD1IC9eYUxaMXER4dYDwBFjyq3fmfHER3i5pS90UkXvMktpm+La+aQDiyh+lf5iJzDP3r/oPM21fC4lB/GDVXfqmVWgTgtl2mFJjjFgNkHP+Bxrr3iFqIazODhT+i2g== 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 KL1PR0601MB5536.apcprd06.prod.outlook.com (2603:1096:820:bd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24; Tue, 3 Sep 2024 08:40: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%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:40:47 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:46 -0600 Message-Id: <8532545a0f982fe320105ee61cb7ac32319781d9.1725334811.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|KL1PR0601MB5536:EE_ X-MS-Office365-Filtering-Correlation-Id: 8f67a4f5-ff9c-4492-c36c-08dccbf41bb1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: mMFUyC/YL2tfBBm6bOlsNkhZgIJlK3RcckA9BoDdEH/Vmius45jVKwk/+rLjA8qYeN/HPeYJu2lBB4Toh1LH2Ify/PzF/tDyUB7t0Ky8qEAQgM5TqyHNHgO1/hjqWe+N6IE1/gulZi55BImjOU9iFoPP6bBf8+2XEViF5fhTyBjP7mLeFzD5StF6J/uI4nIoJD2hoQKs5oeX6BBEtRbriGDNMwcssTMbHs3n4zEAM9+03eyUrOFgoTIUHvdx/9O3Nye6oRTTl8FOeJbkgnAoag5+Hb9sErPGJ5UPPVQFvg5yRm611cBonb65HfNWozbUr7vOJYRTmwnpbC5SozKkA1ZwC3pDoiHCvwyvLof+TAP4crZZU7tDTFNE2lWXs+ZCSw1wkdvMMh88CSjeGv7cWLXr3ueJTJpNxc2mqFsmoFSpPPk6Bt063EIaEu5QX2i1rFYhnWzPO8Y//uhQegD75u5w7d+Z4p2T1BYHcFrD0ivoc0Ki8iY2EHtXM6UIshbuuZYrmhKVUvrfjaVU2VukZClKmRZ5+e22LpKeii60zS1HATh6viEwKShJS3N/0n4LcQbFy6ZbYnoXPtL1GUK5c7ZCrmamDTeQUFJTQEk7yxNeGOcp70lg/WTU7KdaUZf+Yazsk4v9QGMGwxlKYW9WGVDFPNnUL8DP8OJvAiIKbEncn5z7k/2rCTyk/2C93qYSt7nA++fcovwqwOz54n4IktiQkk59RVDgAdq4S26HOoXhJHnJei9iqSYYknvgdaNEXUXDNifWZnpTQ3UJ54tiXYv4Hzv8uxnzQdhce+zku961wVG8MB+LkuUZ4wdgcgormlWtFt/sc9xuu1f2d6hToSUWotrCPwtuNsOo71qYqz/faKLKL28E4AsnBvb+ujevu3y+nsiSLCMTYCu2V20lRXqASPhZN8Ork+Isbe2NtDBhYknBz1uHSmiku2iLL6+Ao9B7jFG3kTI3Xo39qvt2offd/aXnXbK4Z+a+KU1E0HW+D/qUOkGDpgqVJrjrxru/mWeFIP9b+DuxcMAePb+TC6swRNL2DdrNcAIvm7gzCgBxhmywzedJuMafOX+E/S7PPfjoM+pQFJzEEMveSIN6iP0PpmS9VOmJ4I2Te1zkqutPvBQfaRcOUHWpJAQj1unoOXhBpU5qWTRiyiN+v2wLhCRx+xL9b+M+HAyREO9bMrPgRFtinOLYCrxSrynu3Bz+4X3m1QGPT46PKJhDe1SletpOUleg/q1KaB+A1vRDfBENPNsDcYe73uR61BzWM5xVjsEGCRRM/RHTVdgKbRJvKHwKmHszQ65mPGm2jNBvA0N3jj4O+zsoNQMhsXhssnuJx7CM7D9yGwDo109yjfkFf9KZXAv6ot6R3Km5Gq/23GITo9Duj9At9nOFqAnZrxTpdBrfYjzTTI6cu3J0RhcqfQ== 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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sh646lUbRfujZmXtTvHmp2dKKdT1hPuhpeeiMMcFhpEIfvTIg66Mnq+VPJO/b5d1xLcg7A9Li790luE912cgfwLTLyGqRGW4otZOV9zYS7FakGKFvd6cQmv+xbxy09wnYP2caOMDU/iHhFEqFr+wBrx+JMJo5UgXKYs8/paK0yxkhmqEgg+qt9ayXR/NFoXD/xpZhwln7/X8BVDBGTYhmsFReo8hTOn7NC3Gf0X+gZ4b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qk3malPU1yjnPRco08w3Wn8worYyS+TYxtDr2MhH6Uzau/8v+pqnxu/pMCUI9xJeo7QXpEq/316ZdP9K4CIL5JfvCAIvpn6UoiwTrgGDUlasDg+eP1qS1t3EpUNB3p+/BwoKxspLpQs0EiSW/vpohcM3vjMgeeudNqVlW8Ky+kRX1pkEaTmpQxUXbfidWvIeM74pE6uj9V/drk5HD7XH0dBx6SJSwbWujl3sxjZEGJH0GvF4l3S3rVEElSST9vbq1ICorMfEarOYHKHomSP76J X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8f67a4f5-ff9c-4492-c36c-08dccbf41bb1 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:40:47.8495 (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: duoZgJC24oROR0nSBnlPl7mv9KLrIj0M7YGZTZWEVeleu0mFzF2R6pe58Y3mCCUFpMhkXUvFRSIPikcuMOWFQw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB5536 X-Headers-End: 1slPKR-0001Tb-S8 Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788305 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 B2403CD3420 for ; Tue, 3 Sep 2024 08:55:22 +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 1slPJp-00011h-W4; Tue, 03 Sep 2024 08:55: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 1slPJk-00011C-6X for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:55:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=MIME-Version:Content-Type:Content-Transfer-Encoding :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=YcDQewBSFoUWeVFXNNvjnGCykB G22Dg3ZvEUvp/XTVh1b8r74+nuzHjhRgBVvjjF+fGeNMZb4criJwFORMb5Y9nRsgdmkFrZg2ZdFeb +ZsUzmzb4xTsXPOlVZ5OU75oVmCmewV6O4d5CY11h5ObweH8Tr7kCJWkzFbDBOaAZqoU=; 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=iytMo5eiQQtojH3jj+Au1m1BQa bgEYZSKe/U7+cw2PrsS1B8r5J/yAUSVLnjPR2g75j3/3gso4aE7ugcf2Py1YD4GYZffurjHFUOWph WFh02TFaaIQBVP3Wm/27xV5ybiGzUeriW+r9GuTX+5zfJ6mpiisXIvNYrm7L32KZhap8=; Received: from mail-sgaapc01on2052.outbound.protection.outlook.com ([40.107.215.52] helo=APC01-SG2-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 1slPJj-0001R4-0E for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:55:16 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eXxZ9o+EJWPK7oQ+YJIpQymhwq/fjP2epwg+Icp/f/HZAw6T71CHsnQuO4T303Y/hB22bo7vdmj9vm/ytRKZpn38O3oBmydVHpCrI1FdARoBcZ1MtEdBCns0Dbgo+UzeH7xZ3hpOtieqoq4HHt8RwSx7CRAiAob0hOUcX1ljemEjL/ecUmNv8IP2R/kdmaQ3wRL1ZdeTWzU7zUkr+VobV0zARWK4nz+yytNTlXXXbVIVm3/mD+cEivcvXN83ru5fCTJVIxfPOSqNPOiIarr4lQG0wGre5Qq/lJs6K9Ra6b3Blb4OerC24BbxPtH+jud4X/x/ROrzBay/IdhKJJvAYg== 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=HfKoMX1jaigEPyiCDyRCn0j6vBvdYKzK7PUczSZFRsoLYEPRG/jV80Y/y1KjXrtBDL85NtfJk7NItBqErY7vL1luDVf5CEJ2TLk92izlX2YdSRgg4ytGOeeLl89rJ4JnM5NsZmsLQ2vZKf+wvtRqaVI4P/uEnOThrfq6Hagr50C+q2dNwzTsWem5tGjrD3pVOZR2CUtYk1+Ipfh3NA6/zRj/r5SrH8W1hqR3l3f45SfFU8QlDvXdhv0nEFQCr6MbWvIFxeScdJSft8VSuXGbrMetWHVdJhow7mJy+37ISJlhULPm8FbMtstC/5CS33+vBRPrvd6l4Z8mwnwU3hArOg== 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=Rr3jGNy2rxhmeqva3k0yr4pwtPi0+2senbJgiRtHOI/tjuGI+9xQzcv9SZk46210baoJvS4PoHogvEXNY+aQa0Tr1ZY1eV06YJrdJ5G1yb6Nu77RwVb1VUILalUP2IBAA74JlIyjSU8AaeYVkCsx+caf7Odatx4zIbQ4ugUAJeMhMNZX5SEGSrnKrEL+ohn/b7Fzm80HdTFGrjGgLxcDFAjUzERUeaqloyweBfY/0S1KV1m0h8dG4K14E070o8FvLNLWK77HfQ8ER6G1t9YyjtUtkzDgtXhkZdBl28vGKP9JlWIxr6uvMTDpi7nD7urYcWtjM/B6PvUAtHoJkvUbSQ== 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 KL1PR0601MB5536.apcprd06.prod.outlook.com (2603:1096:820:bd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24; Tue, 3 Sep 2024 08:40: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%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:40:49 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:47 -0600 Message-Id: <395c6a887a35a5e3d396cf002914d236a288b235.1725334811.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|KL1PR0601MB5536:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ead4d76-14ec-48ab-2783-08dccbf41c8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: IDqs7k9p7qWkg82VOi3yWha2PauXCmTe6U1BAnpdfq6uRkdzYQSOuMOLc+WpjLIrqsF/bYrSyYfk0pjvcMbePXoT1pD7TTrj/QbwANQfyenGsQfft5voDh8Ga2usqo6CkFfiJqdzPjwsAib6FOyvY853b+yQ01dQtyrgxKpHMe9NCqVPfxdLFcI2nMX54PkZWxP/cnO90v0K0dBxe1tm0KvlnndcDqfXxZqPM4e7vvRwBKpvX73nN5d8af+bvtDeFalITgdWgRZECwMCf2uxvaXhD4BSai9lJr5U9JUh6KW9C83bEWvdsP9cfQmUrKs+ogU+bxemhVFdhf1I1Otihf6upME+yzTJGKPQVyntujRDakEK0Q36JZC9JB2yOmvUIlfK+R/ZCcYQjuqk2AZa4Z5tXahpMyD0Th5o8iY64jmgbWua/IuU5g5tt2Iru+fcww8xydICjdTfpr1Ug+Hx6PsJmYdAwSi8eFhrI0f5M4F0L+YhOUqFZf6W623jawRNCM+LQ4x+fk6IodeZ/Wom+Pz6dVM1+d7HwxqW8mEi3vLV88Ifu8C8+h9wxM9aSkf8Vn/+hn4jXTdBMlt7UcLncU7gFbSsSLqr65S87zjFtvu7a0hhJSFZTKzdY2och1KMG4A982LsKEmvR5Aw/a5rzaCK2fh1N1tI+oyH9lfZv7Fn28ztNf/fibB8YJGP3PBtHNmqFNwfb9EGARZB31yCOwBrpbUU2M4iic5HClmYApCNJ3uSWBM8XFIBtm9fZCfTs+Q++wlS7HfmTONtJl8GKvDGXkw8sEI6tS7+i4sw9kQGNoUtyB45I4B9Dz7zjePtazF2eqT1Bdk/HrzzKSCZ94OFxewfhg5zYZMrGZnP2F+GER/gkDbMQUkX0MejgwE2vuaRMYfl/66ZgYab01i5hwT1tdotdMUN5kMWrKHU6IqZFWbrlFyB/IkWmRCCOB9p+bCj0y9cFBaiBcuo5vu11p3vtm9wATgxCxcrBdqjHeoRQyX58+hpKyHP2ZqbjYZKVCgpdOSQImxTL1h+lD27238mxtED1Fsl+klwsX42saw3o88G/+WDSz+ThTo6HVh0wDifRQI/xsulkaIS04h0h2S4o9FCilcTyX9ENu2PcN2fOC2r+eOopQPfUZsGg3xLdveWdHPfJBjYyk82xkqY8Y1vFaKhvNnnynIcgfw/Lah3jzkbWRVj/hjNyY+kKYgMzq+60TWBvE0aE3/QxnpYJ4DH2sNJHBNBNGB9OsE3K7+oAobyihnvaf797M1xE+TXkEoIbkDGKaaF9USkRfWiEr2G+Tf9J4/Hzu+BnADox11TKBOHpWoxwOrM9Y2F7rIDKN4XToOWNdvuwM51yPY/yTRm2r1zhYQ2yg77OU6mc1XRAjPHRXo5R4I+M8ilVePghKIrrAAfvs14isUCM+txJw== 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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zReNn32ph/2UO7QHVWw9ATNMIpb4wFT8sH1evRfWenxJE3ST9FvnyQ6uzlYqX8wEqB1aiQynAJuEw0YkwoUtWeMyhDAEPBMsmm2lH9/gX8lRO/9AC52KBGD5udV6HyRzejHUAYH81mEFw3u289XxZRq+pcZb/Mfg6ExD7kwNsXuI/q2c2hBBEesYX2bH2y0jYEvoO6vK3H2fuzpfaFdwJSQiVByW41vy5LFemSDDrDLuqI+8mqvk0GDq44wbaPN9NhWqdxAktyT1bk50uijIyPEHsWNYa4j4VwrLGejVugk1M4npPqWATKrQeApqeIbt4JRCxQsKPscX71zwf+U9b+Bd32kmj0ZqPyRebHoRYN3f2+TtDMWrbjVDp08ouopVvOptuORp3m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Jee8MdH2/asxdOXBvawbhcUgNxtPz5+ukh4NnfirGkc0/cVx76+b6heXeqttxWupx08LLTpEGFByx3WC7sXa2GelohONm39RiYz/EO4yyQ1SEn+j3aI9BFtIpxuq5BSTCiUq/C X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ead4d76-14ec-48ab-2783-08dccbf41c8d X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:40:49.2515 (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: aC+AfFVNNqpEcEZAEHXppB49ePs7e1CW168XCrUZlSlT6cBS2TH2qZUlnmvsnfNdmvD7jMerepjf7Tl95aPqKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB5536 X-Headers-End: 1slPJj-0001R4-0E Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788315 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 0549CCD3420 for ; Tue, 3 Sep 2024 08:57:03 +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 1slPLT-0007LN-78; Tue, 03 Sep 2024 08:57:02 +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 1slPLO-0007L1-Ip for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:58 +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=DQ4g9mkR3rLmnM7gsPNeZSvgld 0YHCoT3muBE0S5y/6p6ZWVaK32eh+CCug2a1gUPntjvmLipE+thYJmR8EOlviVlNyGvANaC9dBw/A I8bd4kDtx/i1tkk/jkMeH1CaF/B3rDqKuSBUz4oAxRXCD4Sfx47BhwJ1LbI2SP5xvjKc=; 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=bvroiQY+CTgIE7B9sVVqi3iU85 G25ZRV9vyY2ePRrQEGMM1uz2cRjW/BnWNQrQYiqCe6EMB+ZOVo4LXr/NJdVgeoA76n2SpZkZzcv1y o2XNdA/InUraNUs3iJjn8LHS/X4xFdZ+tCP9JfUcfzOLS292sIiiDaF5xXfVk2V8mmPE=; Received: from mail-psaapc01on2067.outbound.protection.outlook.com ([40.107.255.67] 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 1slPLK-0001ZA-VZ for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S3WLT1WbSB/ornFLzvioDvc4bwxx6GZdhYRl5EolU3likt/jogFLJswM8k28XSQJR/1BOsBO07OgAgzPtk5o21WKJJ7gwGqHsHvwREahvsF7UHjpKzo3Li/pQB2pjqRIg7RsZwYVaaybbIZno4yhw3lZsXPxGw1mHPIx4lskWi9azBNW6+M1Ks4wKOavs9spL3i0TlC2lNv/xEiyX10doVmpTvLKoWKOfSUwiT5FauEDk9bB/EPt17bd16LXp4XVApTD+I3rWLO1OJ/C5qgMYqzH/fUVEdPyfB/LwJfBi1XG68ewDOcNmb4w78j/KM7ayHHq9obRLLSpZaNQ3xP/Ng== 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=bd9liCJh6cjMOsRuh9W+DINAYboeG2eyCUIgBA0DLNqr2l6lNhIU5vLK82R3ickBm0SEDG6TeYlpo7DJp6BDAPb1tx3lhJfRlzYlovTRX0XejQUjZQrkWknnp4P8ofkg1FxDEmh5OQ/JFM/FC6tN3Jolt5rzFmu9HGt0z3o/RCAUY+TMD7pKcjJXXXm+L3WksBvmUR1Ocp/AhxSxR7f9ircABOlC53Y29XNz1Piny6dh6WnhMncGFbuFvskWbKWRpoB9F5cyROIFzEJyTc52/7iyrR+qOVSTE1vVBbbc3FoZwBCHLDedZSDDUZgQHFovHFfnwOippNPzZVG4u60u1A== 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=W1003AVsPhq4g8w7i+uqAmWXft+n5QFZEzMCSucozxtQhVujdBPn6kc1qvInDl8gm710Y3ptx6IzL4nao8xTxiVG6RJApN4ZuAn/M3WqBPfArz/OUI5kmULla/WbibDWfdz93uKL0Y5eoniuLn3vrdwuBvvJxlLE+fNAbzv0Uhikh4OM+bMDYXMNJP2n88BRU0TavIFAjPuHUUd/ZZirsVtQ65WuV3nVyp3g2G2Y9viPOvOADsi2E2/NSpvVuny0+Nr5a7PNkg8IRRrYBJQy4bm6BFQTvodkLkkXw6HflEeCkd+fZNB5na499t++WVfEiDh3sC17zrUVG57teic8Uw== 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 KL1PR0601MB5536.apcprd06.prod.outlook.com (2603:1096:820:bd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24; Tue, 3 Sep 2024 08:40:50 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:40:50 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:48 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|KL1PR0601MB5536:EE_ X-MS-Office365-Filtering-Correlation-Id: 5aa681ee-5f54-4db0-eadf-08dccbf41d63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: jxtvMRSi3/2ZflBTNdlD3Vy6wqYGk04y5dFusvwau2evd1dvrQgNc1uuFoAz+W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7DMYbSyan2R4vk3v88RjM21Ez7i3dONkiFDu9Zvw0cHxGbAZhGk0snJmC5sMuyeMnz6gBhKFrlFe6Y0UmXKsEvGLE9XYhq4m5wLQhMO8HrJlcUNSOWIuqg2ryGCV1qQo9uGfI2MxzeRyX/rvfMf596W+whnON2dkss6YiuE35xwf9ZP9M/swHuRa8Wk6RILYwK4PZt5QIST19eSInQUT8Q7LtE6fWeQbxSO3dsNHxUR0Jc42FfJPVJMFLUrz66mdaJdSaC/lQwLjizYNjs/5kqKMxvM/EKGowkpDpJTMqhaDJmg== 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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kuolJJfL+zlLFetG9L5amaCKVk3LgMm6C+KIFYeh2bgyaOLMx480YNVeAXxcDb5pNEk8h+cGM4T4VnJySmkhTBQIFEehQmsXeJ2DGF4CiLpO1VDAn912bFbfm9MWljJArytIFPSjc9ups6igUry4luRQc18aD88fmOtyVY1nEuv33dBrXiKrUH8C4Dg4ZeXJuIN2RUxf2Wwphd6D0rXKlhSuPR3r7XPorhTBEhRipKZvQ0HszoQlUTK+bkfsA1P0sqa2hFCt1g0mg5ZJ7dM+4zjPVIPh5sOe8cnnY/XDc7jNTBhOOO1J/DddsgN3mxMqoDn0cZzLsvnuXRMpI0gXB3NYU47561zr9FmoeT+Dh6o+dXvieJ5/b9Nn3N79nK1ajFKWR53mP17lLMNagNB4MzD+heHnk4PSC30/P/mnUwgqIV4H5NT39tbHTFLW7Imazgs4WhRdO4r7mz85ziAeHJN2BmOy6LMsrUFEVwTZI72ioyYA2RsQz2hVvaP7b1rs10gxiF2nn57rkRKd/TfykemEE6CNairIsVsEyvSJQc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-MS-Exchange-CrossTenant-Network-Message-Id: 5aa681ee-5f54-4db0-eadf-08dccbf41d63 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:40:50.6561 (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: +z9U/wHB3saOYY+znAw42x3ITst/+riE/lFsifYUxyuNpAnGRcPffuuVfo+bxF+XVAJl9T3VqGMFDvCkPTsLZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB5536 X-Headers-End: 1slPLK-0001ZA-VZ Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788313 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 45D8FCD13CF for ; Tue, 3 Sep 2024 08:56:54 +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 1slPLI-0007N2-VK; Tue, 03 Sep 2024 08:56:53 +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 1slPLC-0007Kq-1Z for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:46 +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=R6ScJudTPDnZXv/w9qn61QRFOk 1+nqBOaI0bdi7znLYDDFR463hSuVNQWC1AuOTQtsW7wpleOObUoH+QTkeKUoKjBLY6Lk3LVRwwkmI G4KQu2niSfLtZGEXzzEADsb8Mp44tlIaLCFu6e/9YSKKrgzwxBw4VEktUkgVnV0txOzY=; 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=WugM7dhJfPP9iKV1hB5QC06zhM CgC7k75AfTgfFXEMKh2FuHyEyzvqYHZIxqF61ieq0Yle/VF+dHk/AdIUwiLSjCDvMKa6atCX6GGVD v2XVyZzdvjviiP+ZV5pTvdRkyUSiLCWxV1uaNYOwHr3vYv66RMv25m2x2Fxwgcu5tJco=; Received: from mail-sgaapc01on2047.outbound.protection.outlook.com ([40.107.215.47] helo=APC01-SG2-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 1slPLC-0001Xc-5W for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cDfiHzGfqCLnnHvhCRPzglGBxNV9YFdtLLkK0wrIgiF5FfcPByaa3NcCcxPlEYuqoE1SAUhJP+cRIC6A1rL5LP1behD7eZ7nIrwx17AXMLSEV/deL/jsOzLwrHncUC/p22s1a1RqP4TO6TM3IJUqgzUlw2tv3WhNSvYMSAJRYy0aia+QZpA03V9vphtOVHmKb++2EbvQIGWVDz462a8CCv7zKCxXfOs8h0+G6XWk/5/J1wZ6YGuXgK7TlKMy02N99mZbs6uuyZRRrz1Xk0F+LyhMmANduUZg1d6FoIrj2Y0EGnsA+wmvIvj2ZJTOXYCgh5m8rFoZqRZ8DHLN38Nc8g== 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=kZNAuPooEO2Klba9tmUFz9z0MoJv9CxECv++IxlDM7CCwKr/2X3SnR7MxjUOecfCe9w9iBL+2Dv3mL/W9S2tYs6BihtgYfF+Fi8oUWEVoZqAJr3gioE5YYETp11Gr0RMe1Lin7UlnCCq0f0//tgti4bacpq1TL5vtKHbC16ghTeobL07meP0f+gM4lvEFOhFAcdY0Jfrig/tVf4yFyGwAfHM1TX5YIs1X1mNKLnlc/uK+G44VOoN3x1t+tVLHEOeAnycwPHdBsSsMcw7n2bYNzlRWEIWTy9mABFRsEX+oWT2bf8VU1h4d7/TVDG45n7lzLWFFbX4PP1Z6KWM+FduqQ== 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=fd7TandFSqoo/IRbvHS/BzRSiK6Uj4bSaAA3cuBsqBeuGP4vtH0F2Zek1uf1mJnofzUphbDSXtrUsl/xJmfLlVSrCV2PdqEPCQ7gyVhtnxaAZ3B+EozTN/1Ns+08/lk3qSQj+oxzH8NwSgEWbq81vjAvMBNAZUYzdczC4V03E24aJrcDqvgOqXd6rMNVTBC/nSsS5er3WZvsyyUxRvkIw3S5EbhItmFaxD/gBaDEAHK0GP8n2EKvrRDwLPkzYOv/CDi0ms66h0345AkPSzok4GjCb3jshYhQEIA2M8OP4i63F29ScquAY9gUBG0J9WgrhopnkD2bZ5O4d+94yH4tBw== 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 KL1PR0601MB5536.apcprd06.prod.outlook.com (2603:1096:820:bd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24; Tue, 3 Sep 2024 08:40:52 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:40:52 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:49 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|KL1PR0601MB5536:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b541b73-fe17-4479-2c3d-08dccbf41e39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: u2iRQPivX7in1Z3nFW7yE6kzmdfUsTbr7Xabq1OMY/cOSy2334RZX3S6yJQh2acwPT2EYdfbdUocRkXezUii6/B2TO2J/En6VCGtG+ObA7gvP9AfB2fVF9GyX8P1sK4dRLD3H+6NufJ7KTV/EZV5CDyW5rRDd5otMuCmnsf+sW6d6ajxZEcwpUCaVDwi3Pw+/MZTL9OMDDY/WLd6cgUZ7mehdbG3hZngcrXyd4ouQXoS6xl78pfJzJct3RRiO4nLXT+J9jojdZidqLyejW7juGXtjl1LSRxRr2N6bRBZHf4U6xaLkwYvXkix5RA5blHyAG5HdpTEMTzRCWVJYLkXZfQlx0M0ZB9FLgcO+oeSP8anYjz+2O0qhWWlubJwK7Ne35iLZ9X2Lx9H8bg/1sz177Bm0VVCkEehUOXR/W+3J9IH+DRI1WAwVCvTFcHFE6UeKhkbN1+SA76s/tsJ/GaTzT/fKKir9DjTQMeeiz5MzJOy9OzqQN7uKfbhVmWW7S5WmEXBx4yMR5WQh30YurD/Yytujnz1x6sEIZ42xJGWPaoXFMGBTQpYz8UAtK9rhS3+JlFT6DJ86AAolFZ2r3fO79iyfOWSz3397e4RM8+zcLBAMk/RRUp/EGnxAuMEhXdLSZ5Gob3XfLdgUhrLvMRdSiD8/FG6lG1JNaD0LpheV0mLlPlYJJJyxFAQaCRvhRLggxBPREMfCJfHUzp7LjIVY/g9RM5/mdU8HU1YooaKL2VeLqvUU3tHSSCVLYIzEga5NrSBIij8RPvwlTK1kHFuPu+gHnBO4J+6TJyUgWyXW3JsygwP/DGWp5sAy+V3qBKUwOroret5mglyUj/yYsgDbelS0rU5eJvODRe287S8ltrhphug0LHkm1/SEcJUkmupz3HGcbM6Zoo+Vkpm6MdA/90aFgXtv1lfQbmG7X6QGUozpX75Pr+hMJuAUFSNw+2ccjqWgNnMTWXzhteiga93aOf0JMpL6wE8m/XYufaXTOPFsvW0BZY7X8YwWG7htzAgLXPkUzDX7CBumEttJkxAVVoPBLJTKdjedpz9KytXhxuL7jhiQIw6NNw0gi3co6S3MBQzhA8wp2HcMxbtHA8mQSpvgYnyLj6t0CHOzr3KXxDH20vTIQFcXQKlj/we3Bh0NwNXxHQpukw2m0ncy+xtV/uBmlqp0zlhrb9xmSdR27JazZ8WSHzGZZKNehuMdU7q6sXtWeneDgaUXY1iotq4662Rm0T5DPqjIcN5G9RbkC/bgLGKTXohJ7TXgLdZibKzZ56D8P29shvzryem+Mrv/hew8CVVEI8XAGGFwHU/LdswSN1ruFLgpSYlCNkHVRDqxnuVUalOYmbFNaEEgcRRylam3sHqsIPWJDWm4pywME2ZF6oCQljK0An8dgMJeuWKC/w1sevG6csBQYXOvpN2sg== 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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b9wVUQNqbf5moh5xg7oiQFX4MsE/tyk1jut5oDJopJDQr+TkMthQ0G/bGjfZnpwypYDZDWCqZjlWwuh15cykCmEoBZESbzkSryXctnZGN3OUVOJUKGUeXj89AYuwuNB8w/gDBSxlnyRPjrTik6v32FtLdzaC1Zd6kOvuoOYlhNmidQuMBaSOxapFrgy8cvUDXeEeREbEF+r5N7q+6JdoSv1UDq+bvWRzN52ySxFEfI5NE84/HqJ5me+l2iaaSuUVct+lrfMPLvltCJQByu+Jlsz4h3hdqIhlFLEc9HBB/DTU6aS/VIaNOeCiopzaOvhwOBZMeHX9luitkdSIzpHEHovE2igRJaNTYJCnTcwqLz9bum3SP2TqJMUTzX5OocSq6mQblkQNOH0Gqj2zhif9F4yd/J459emwCKycLQEEBnvcpD+SonrU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IIod0Cvwwp4VlfDqfFFU+L9SCMkwxZTy0tp05d7na4kb2gulwSxLhZqhkjGzKdx81luiFZ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b541b73-fe17-4479-2c3d-08dccbf41e39 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:40:52.1733 (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: BawhQMySAvaJZFuuC5ci7Z35OIOrKY5o2g6wC6U2X4mdmHcmbeMBizN2aOx4WTLCCqAiQM2CoGAZX0gd5V4cPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB5536 X-Headers-End: 1slPLC-0001Xc-5W Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788316 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 767FFCD3427 for ; Tue, 3 Sep 2024 08:57:05 +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 1slPLU-0007Ri-Dk; Tue, 03 Sep 2024 08:57:05 +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 1slPLJ-0007NZ-Rb for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56: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=cbAYiYW42KdJTqSuWfOstLknlNwHmM+iHowcLx3rDog=; b=gfguWTKa6AvSjmFkAZw30ApDt0 l5uuhK2GAAoWDJmP8r67iBwMea+4fMo2ifZodNxcy9UJ7bfy1uCYb0mWoqV/ep9moz5TgE2eC/f4p 3rdK7XeEJkwH8WiGj0sh3lQud0PsJvgJeO+/0OiEunFy1EVH/TZ6bpCo7XEqu7+EuZZ0=; 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=PmLTi03Hlk1uc6j/WAcUYnEe1t xgpubP+GvB5lg6ussxNBq7f+/6MhIlIDipitLiO6V6bGdWItlQTdFfyc8j748o4MQxa9RkDfIh2y+ BTs1FJi0bZT6s11rNLAP207TNRPJ5XrN7G1mynyWPghKfiFobF9qJALFWFidLx4cOKMQ=; Received: from mail-psaapc01on2067.outbound.protection.outlook.com ([40.107.255.67] 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 1slPLK-0001ZA-0F for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SLNYvWdzs5Q9i/xkS2R6KL4f4ZPwBWYqyuCp2Ut6VElbpovE6+07xYFr9okAC+DzamZ7xnIepbiTDKe1q0AGxqvsuDsHH4xPqwMQfoM0/EkwaL33tLZ+sDJT3UoMZFA9f1pz3vC4wtmsbizJHbMbuuSdO6DD07FCUoimS4s136ga2kMOX30GmB4YliR4ihGtt5/oeW+Me8JdZd4xiLW134k1A/hw75kTZKL6Z9A7oGXk74FFK+5qEETEm5ydHER8bdB9MPzJUpgXqC4FXWyvlOXiMGrUUdegPgxwSmPkqKHpIaB+gFRMgf2YbSM838KnR/H5y/DqY16M1hjkgg2fkQ== 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=LyJE3qIExjDnFPKiilSDAF84485s8Nk9bIL6RdPBKjisqo54qcmClyfE8uebHMuaFa5KR4FGA4pOd4aXj75uiVmp4eJMTdHlRBLxnJx4n7biI//H3aZ7pB8Lrk0NufO6LExQC8OrNyPVpPWPKF6EPBGFAr8OiVnb+y1naWKyRh6q5RE+FnBdHhGXkIv7eSgeq+oHjhoZczuZagh9xeQBjuOejQeTfYJoAssIX6d+tohKYtalRTqvVRXr7HwjPn2Awwh/3/sHFkL5CExXAtyi27t7UKyg5HJMHVSiIgo2Fr2HuN9pPeFOdb1pkzpgu70GdE4KFAi9AQVNhRaDz8QOoA== 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=mHUkp5t0ccoDnhW5I+lllFVU5ucuzKrdynPU90FgdxvqFonBaJ3FfLBnCBWBltC/6DgASY/em9w6C/N6AFajC8UnmocYIaJy2Ga6GfMHApNVXhWkFkVQ5zYPWF/OqdJzDuumdT7lqkVch4nkzbRui+guMykeFrFlV3i8tuP8RzcDCYpXjsj90Rcz1T0CWuWeX1hVSZAEN7WAbSfS2g6sgQrA3qGS42Mx4FDN8loYfbWg4Ms4DqFE+F2IrV2yJDBnb2rf4vqdchGbubFEzWuWCfxmg7MdpxfB4J/exXIpOiCEXOWNsWTfjnJewPTZTYLcrVbWofmgBFwCzLV8AedM1A== 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 KL1PR0601MB5536.apcprd06.prod.outlook.com (2603:1096:820:bd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24; Tue, 3 Sep 2024 08:40:53 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:40:53 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:50 -0600 Message-Id: <99802996a3f4a0c2d89c79ec17be94e9c62ff8b6.1725334811.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|KL1PR0601MB5536:EE_ X-MS-Office365-Filtering-Correlation-Id: c8a036e1-d5e5-4348-ee76-08dccbf41f24 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: kPE636QvGLMjWMxvJ88pIlDX3uR1YzQdPJfjYhp41DzUdmbsvL1Y5/hCLKHLSi4DJA+/5AASyxHGyl9pks0zzms9CQhDH2eNqEjLmFfswWECxtop8e/K+2boolwfWJmIfGkeNMnQ8XyTI/OiPz9tLb88P/J/bu7tjUx+Rfs+ofrspFjT/Ll5ZDAoedo9kDfVNTDIRKRnIo2zsd5nlnYpKWMu1JRkpxvjiKOeki9tj0ItqUlzQZhn0goZtUfgqRneHzzMjcivzR03GW/MGmVUmTJ9trXfM8Nrt3FjY71S0T1E4dCoV+0mjWRjrKitUP24mYZII0m7Qz6qzrbdDotOnZc1ZzGru/UEuy97LOnRh5H/XwNzHNzqgLgpbnDHuQlHNVpbdocjqiUnPwT3XN+iVVIJYw+drsalP1mEsvalUIWhUehYGl3ACwCYrBb1Lyo/q7z8Hc8z5L7lk9Y70sc3uVVtOX5pMe1Cmx/CZyfvZuNw3y6T6vwKmVaPDBj41oXA7FTIQQvsNWS1OWp3kaa2UT6sliZDDZmjWRJoxaVS1wWNet2PH3fZTDGiGGK6VjBUicie+vLGMD2ko7j0bAB7/qJ3461/ADg9HDF3nSO7VWErx7Su0Ce8a5bhh7Ngata2Ztt4D2H+8VAc9IfvLrtFNJKDojGTFXak7uRrACu9uRTCSZmA7x9lSRtnEP4/MWCIDIcOcDPHPaPhaa4idHSPRpNxsmOyNEj8/+ZvGkKiUz++ZnAndsd0SSP+Eq0ALu52pwfG+z3PpkPhdYDecUKOM0dH4lhLqQVmAKDt9TLi10ODPKTXozn6psFvUSWCpf/Z6afu8WR8LY0pPDG9vfbXfoe+jp3QhDJE53e5jH8w0IZw80oaaWWZV3eabqxGYY8+6FnhKwiF5/PmtHiUj1cUy+GBa7z8PPDGg7b5vvx0WN1QmmYFHNYdeOpxAbqPIDuby/DLe+SIXswGzMXzXEnvkGg9arPzLyPoc4fERQJek3CQ0Cvr1y8AJgCi5V9mId80gXo6JbXHYDYo9KXHvBmZuc3krkkZYbFh9ugJzz+HIsYEHeq1cflPDHzw8qa9Op2M96+FJRG2tAZvLs/akOEpdBeV9DIAnSphBdmtC5fOXkWfJWNfO80heNJjjSIGRxNxEhtK8NgjCzHwTE1DUqHQCnFWczlVJFZZAWwfBTPeqsk48O7FBZNjTK2RRtSTTYXjx/gAFdCMsvQO0L20ItfGohM19dJBSgI4vSvoy+rmVy16qU2Ocy1YXXLj5JBQoxKpHJW8fdfIcrhlimvOYJs6s1lumsfAvhuuRdiQPxX4YO5XbUVDLq/3XjpoApuiEJgdV/+h/uh526mCz1CLZdj6SO/RJQ8cj4QemNiobu/j8CidcYNVzyafVTLzeIRKuHcFCWbbiYejmBwT2VzTNt9q/A== 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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YBAQveSXN1QuUhs23v3+7NNGpiNiPFrcOKW6OVKAhiQAcRNDqPzMJuZmzJUUDwJ+jsTJtWliS8n8Yt4tx1ACAJ4jIKKXZdWJ6x5TG5U/xwsSwn/G22NrD25MKUMmQNXJmCoKupxG1GcItu+XB5ioT4Gdsrqz7LL4XW4MZdXDEhk0NP76ErvV1O+lYtjqBLIYfmmpxgn/0s98mxOL8nSONvjk2PNpzPhWSEZdiDTJ+qSFTVX6ypBjvofkWrK9D1ad0cRaocrJLG+CO0/sw2F40zIlJQ34sDJ0W4vVQ70gp5rwY6ovxExzVUFptmM3/9TDPhEvHAfre+0kh/VrBkyGkFFU9KDKVAqRqyj9g8jyKYOzXVATrZLBxJ4zU4LSoY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vIoECF+ldJyFZibEHvJSWEFJsbj9E4T8Nlidiq47NsB7qBet4VxoFXL9q3L6mN+JVSJ4oLxWKu0mLCYOozZ7qNMSZiVYEWtWVvIXQhvktZqpJ57IU+wTSvh6Cp215Dlqo4pgfgAYGjsjMbn8+y X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8a036e1-d5e5-4348-ee76-08dccbf41f24 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:40:53.6740 (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: 2R+OGMIPFY3hd6NYOTZ2HPdGhEqBnoriz/fkF7xzPrigj0yif4GRa0I7XkLANc//DfqUJaVzVvRbuGA0xYRpsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB5536 X-Headers-End: 1slPLK-0001ZA-0F Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788287 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 66B84CD3420 for ; Tue, 3 Sep 2024 08:41:18 +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 1slP6D-00085r-UV; Tue, 03 Sep 2024 08:41:17 +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 1slP6A-00085R-G3 for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:41:14 +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=anesnj0fS9pNQURDLHgX+VAS/y a3SWxdsrtTO59EPOT10PBI+yM35tiysPrptkH5CCWCDOs0850TEGGWmiRDX8DBJlkD4NFRvbnTUDY BsHXYRz0F9QBL0sTZCaD8CNeu1Ewj8RwzMmxtazIAgDcunmLzexkQ39PxOnCQqcu7sdQ=; 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=fGPSzwfihj6EJAlGjhQeq1DKE7 tMpgFrngLvppYBwiYNC47zhBF3sjDrfLMu81DZx90F3SYzO5ygqtFCUrJeZsmq7tXChwipmxIyMUp 4BTuRgCpzf/GiZvgrY3JQTMmQ1DwHCLjSJoTonnzJ0l2rUQyxgKv+f456ZI3sQd4Q4ZQ=; Received: from mail-sgaapc01on2060.outbound.protection.outlook.com ([40.107.215.60] helo=APC01-SG2-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 1slP69-0008VM-RH for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:41:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rNMy98Ur5ztuKYbYkrCeQImUel6oCOLQUaCnTpGnUaLJTkFy5pQjUFGu/C/a+nC6kYpCGZNTM7Jeb0h9Emnh8ACMJrk0I54DhjE9k0dP0TZZCXsyTm/EfarxypaSn+KZuF1GM5uUd64htog1cH1uJU5lFoW8Puis638V+IympCZNgvpA0FhKlCBslX+l43+CGWzxNKitlVe20jY91yDaUj9Ho0R1VMkWI7zznoYT5pEM49Kl4Vo1Cu6b22zQBrJd/ji4YmGj3o98korx7yVT7iArFI9xn64qtGCP2cv5OQbMytOdqFVPU1jCpaVlycAWPXA9+aHJedC6A9el1hJQXw== 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=YSSdYg9FH7znusin7Afi3+R7wwSHlQF4j0zR9shp5bbKgp7wwZkpAAI5MHahvqc0wex7b4MHt03FUyreUBUMoXzbOoBmQtfwGcAI8sl1TqAMgqNkUtyYJ33/IOXRIXNQ842R4imU4SuisFGqnTpoak3BzR7ole6/v/7v+4sTNSi/GofHU0vFFHJP5pjCtswY6oLSKMfH1BSvVE2aTCLOrOkLkrQ34hyfU4MP9Tf8MGYHtHM6ViN9uDvfDpA22GAOYlRjqOH4o0dcW9cInNEIf7dp6V0uuoKQ6VTXYSFDkZCGGYN/ODo+qrUNGUUBQ1ieg7s6ZxABSzUpz/7jiPjaEA== 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=aWz2IRDnstSRiQfC3DLq3mapBl577CvIPNUEeuZQOdtBXQ2/PDM4RvI0ean25T063eJ6RueOXPofPZUjabTAhqcgGSw+N+PT9VE/kAwu5wedEYtaX+ho+arpO2qe9bzBB5FkJSs0fsYDpxIwciSKY6Y4UySpV85V51fwi01khoNuG5m+XR3DbHTQGqqCnvcMVWMZ25XAeqB3jwJQcP/5PG/RIVtvhFLdsSljCsgF00UkdpurHgrjSaasRZoGMwQwU+C0IxI2mImZVkI73hWkvn4g2Fi2e5TrgAVmxeD+FSGXduNon1/ocwJo2sPyJulSRua2A4ygGUv3kNbAJh2DoA== 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 KL1PR0601MB5536.apcprd06.prod.outlook.com (2603:1096:820:bd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24; Tue, 3 Sep 2024 08:40:55 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:40:55 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:51 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|KL1PR0601MB5536:EE_ X-MS-Office365-Filtering-Correlation-Id: da211acf-c9a6-44cd-e705-08dccbf42023 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA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Al3IovJr6uDh6IZQBrNj6mozOYGMjsX7IXQ+oo4AylWN0CgHk/ggnayCdvGpizxt0LWTJgNfskB92g7fuuLPihzx6zh73ph2dr2uqWtDSOO0LZwa0uWslaIgIiqSjANHjLb1QhGI85lsqlrWcIpxCqdm2ZkW1NumD4FWpvIXNCLS1MBirA0KutkaVM4603Ud9YsygqoyQHNPRRCfUdS35hamdgnqMuCZiJifXN5vKsjMvNBOO/PaUkFO6D6GhtiINJJahrEO0a6ZMx4xEMg8pBOXFcRgqnWSBa17JpqrieW17keVKt6nuEUfoQ6wNn4cKbl3WeDTCQtkBfQILlJZc8RsUuRV3WCeQct0h8Jswb8f6j5DPINV6ZrEsa2tlC2/MlYXYmWiO9AvwwHLvovuYuj83o58G0NGqvKA== 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)(366016)(52116014)(376014)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: loSpHskOmpHJ7fUJaPxK0xIC/PnFrzHxRwUjbWThWnkn7bPQxpaMf0XgRTlvo38N3GsUO78IeyzXCCyuF7IxKhEqAbnyESwxW95ICE9XWW//CI7eugGoV4D9JndzRMFfXMMBtzflCL1lO9jGoV0YCBbIlwaiQ82oW2IY0GLz2UBFmifbbIB4DBZ6QFqBp1g7TJFoYffYSVSxsQzBAOOIgvnLVMJs4ezol9lmpCVSITOFEFoFa/cEdNbYJQYGO7X07RsT4h6FYGoUkBLQXdC3T48sCIljUfWR5lxTvdWPGB4u7Z1TFbY4G/2cPR8xF6evDcOA2lx4M7+vj08truM7zk7DizgStc8SYulZRtvyfrmJmYl8Wj0ALgThUhE8X68i9OOCWbAt3GSSeSIIWoMmPzffhq7C2Ppp9fHnnnV6YvMJmRqdsFUFX3r2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fJBvJD3v9CZMNgzjiIs0W5hLCWbXbCkxRN8hp89mQPAT/uP8hBOuD+OjYrXywdPDc9 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: da211acf-c9a6-44cd-e705-08dccbf42023 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:40:55.2816 (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: 78JUgF+9SK8W+VPdr7Np0qGcRC6hwomxyB805/iEtcRix/5wrGnaenQ9HJoLQgMvEpP9dTAM/gcMkIQyltCx3g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB5536 X-Headers-End: 1slP69-0008VM-RH Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788286 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 D826BCD13CF for ; Tue, 3 Sep 2024 08:41:15 +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 1slP6A-0002rq-0r; Tue, 03 Sep 2024 08:41:14 +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 1slP68-0002rL-OT for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:41:13 +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=dCffUFzPevvU5L6+kEo9qLBQ4W JMkM+onE9XxGzgiCpDG0F2MqKgeGLW+Uk7FWLTlg9giEWXW51ha8ukFPQkAgy+69tqcB3VXvRepPQ 6owH8s1iBUqBlYkDpBMmUg9auPXsqMbD5xxmyapkvw375GzqrRxV4Rb1cJbCazfLlTfQ=; 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=nFk629xcguBDWFYD6R+2azq34t HmowRas+02T0xXkp58ubBXh4Dphjcqtz/7yZQN01i/krb6yTlM4eudayB9NOAjOs35rPTuihXnwy8 k5n9qHQQ0zya+JLwE40Y8NegqM6D7cvJjEiyRDgVr9Xp+I1ri9HLBwaGWw/1VDTA3oMo=; Received: from mail-sgaapc01on2060.outbound.protection.outlook.com ([40.107.215.60] helo=APC01-SG2-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 1slP68-0008VM-Of for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:41:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DxfQzvCZ6ZqDsiGvcRDRZiQ51b9gN2JFrJthjDXFin8I4TlAQOfD99pAumi4i1K3miJZiEbX3pvy8ICS8CQAfLGeZYKnuVs9V5GjK399wtxd3cXvvA/MwBwfGyZ/dOaGipQnzdphG/KRBZdyg4kYEV9/uKSf8ZruvNmrAr7oAFMitOtvEPlry41YPS+TNxuLAocDaGnX9R4Q10lickyTXpqjybMZ8dXOXQ/xHUTCIMQEjgB39Sgo4JPX6nGxjRlU3iGGUUMOBwFlx5vWNW/eDxbETI0Kh6TQO8n+2uQAcBSGbnGtvwN9vJyzrmmHvzktuAss9a9MeSlzCz014OHr8Q== 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=M95K7KZT3a/J2gEdaAkTdYz0UGonya10LRRjufYJubOGHIsDtNx5zUQ1HVm0pMteoZRoyrwizUP9UZm1kA07G+vtQxMg+jiluXXtMxVySVOHa4n8dhpt0C5npu43HXe769Ldb4/83vnpnu3F6gqmrq+sBc3b5XgTVhKZzghSGJmyZpa1L3lRAnOZizGh3G5Aj9IlGoCqbUaYsghbyYkLSlADOuk/yjKsc08ST03W/hgpcGt1LQRk79LkEIGYMvaZKmjQjFC/s0RL8PvRs7RtaP1nOLolCT4PyBy1pzCKqebujZw/Hd/0+0G3vkDf8MkATTsqqDTO9Zt/AbndlvGeKw== 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=iD95AKprc8NZH7tytyhY0EaF67NpD4vKroLNtX/aoEjJcIBuuGM+1icU97q9YOHPh2kTED9teqaHUYEK+NzXLWN56I+ftF9M0EDmkaDrTpM0Q8ZtnLfAXajfQvZFDX1O3PerfF2XN/mYJl1XHcSQOJk77V7LdK4aygXoUGOzJiSID8f9/LK09GsX4S2TP/4DJMpl2nXFF8yu6EDo5MT613Uy1aP4aGgV+kRvpOzXqy9cNXaa8OUlWGgJhdAnBmZiScdAF0MRxv7EEZGmkKyHsmmVWx9YB04zIU4cKn1ukygs1ZY/K5ZYZsqIHBluY7L+ftQUHUTZIRh3XZThKr+Qfw== 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 KL1PR0601MB5536.apcprd06.prod.outlook.com (2603:1096:820:bd::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.24; Tue, 3 Sep 2024 08:40:57 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:40:56 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:52 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|KL1PR0601MB5536:EE_ X-MS-Office365-Filtering-Correlation-Id: 524ed027-c50f-436d-b851-08dccbf4211d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 9VkuVtWegon8/CyUMWQYUYgXkouCocz5F8JIsZ44vTmLewjsqGvMC6FoLExiPUbFy8s2g6lGF3Dd7teaAhiwas9EDIbiFmObhwsf3D/1VwHCXsW03i5tKDym6o9T/0XqMnwaNjWuMMFDDKxhhPhE5lOicuatwRG6qLFGd/5D+Xb/X1ev9GOILz1N8Ko4GEO48QWyppmObOSYrKoD7PPbfCvIi1z9zV8gVW8Vx+UOuSmcfMFuuNpSmd2IhexRNlvg3GGMzEpA8l6WgCiQ0Hx+fnTcLj2CdUR7tIxSGh27kOHSHWXe1s0jMZZWmuxsuJeeTzY1AnZK2pvjDa+SGmNX7TmsvQJoAmwv5yIHWr2ooKX5+aBjWok/YwLRhuJwD4y1UNk9f8/syqRXJe2Mzb5tQ8/cCH8ptMt86kvHo17Tv+zgzOtCZAVl4YhwyrHhuymY7u3ivdO6imwr+nvm6KEsftOVCD0VPP/Zv+eiRM9cxGNED1UeoqpthzbJq0IH08gebjqQ5uqsYCHCWiWUPZr+VykFyahsLKZ/QTWiCsC2aK6QttaR/+vKT7YT1W7sbXrRo46hm7UJemuro0oUGBYLC+VY/2qU/agHbo06BmhNDdRoTmZLapwAeW9uhGBaxaby7gwk0wipO+81hMLzmInZhIWswZrDPKuyBqCMlvODPq8Mcj89glDqKYwGkQB3z8Giz91Mw2zS9drYFgjweGtItFl9obE6ow9j/y7DXgZgGAVU4OnIXetenTimKaxI0fdWg8cM2oi7Aqaz8zzijLWOiT1Sfxz5GzoRRyOYPBbA/xg2I8Vsc3AgJQg5ORA/bq3PTARpDEEjDDiDim/svt3sy/BNZFV2JXKlPsp4cf4tl7/b+/BHF+GoZPnYHhTROEY/3Qud2wFif0y8hErrFugGLBWIyQo6qPIioIPHrrAjySrsYrrOQk91M2wY6uhHBVV3/u/YKjbqHFd2N08kPM9Xi+oGBs1E1vg0svyx4Epoq4rr41q+lYVqXL3OVwNlccFa60kPLaEaZGMNXKy5ZuIvP3EZQ7WkeM1xckiR/cB2DgEpz+/7QS7HTdcSSCj5UMOWSw7jFAIuwlbBPswCrfgGhGc0Xc/fue76w2WVFwk16KsRG/RHUV1BEmSel4ntUz2rLPIz+2FZFEjEdftbpL/wlMVEs1C3bsk3i48DfFNdiNygXRVW/+TzU5fW0z60qXVdhS6EYUFtWvewC//NEjD0Olo5WCmIGc494eZhIqa2aessrb2qGyBycP49Syc2abKIyBcIhRs9kiK6xeKjr8nB6PKhcvslhJVUuIiYGXWocRx2D8RmLpi4PJ0unXwmEr02EA64YqeBWHOfJ3uDYbt2uylMV+tF/XyWZqW3joMCOtxLguD3mdAt44D3NJ97U3/VbWgtjWk5Zcl0UVVGS4iTpw== 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)(366016)(52116014)(376014)(1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idvsMzoanj4UQaejpABfm3tgjiiOaAeV0aU1Juvo8qMCBirhiU4Cnhbw1G5N4zfSNQHqPzZgWdm3wdWkMDeDy8Sw1evi1aSN3Izvt3vQYdhkkCTpoDFGhydEOYRl8+B7iSnSC9jFMFnKwvccMST0ks13Xlu2ua5yon1esj+fE/pySP7H/xapoFWCyRHo5eT26lppomFL9aX9IAyq90BjrhtdAN5d9gGnHO8/Jb36J0lGdtCZHXfXmi7JolMyzQgI17gDLSPjuYt8Sr2veiqKPYDAuVoHAhTolofS1Qbfz80OKYCJ+FdOcHApo4cvSUAdhMPm27sTfpcw0Xn2SXexZpwFXTLajxHs/NjyBrSkywSEcD+Z0vXHlvvxZMkBLQrSKWSGt0gWqrkMZhyPxqbytbWa5u3QCXgbJsJixmVxJxJIr6uYuLEFZF07fjgrslQljIMUlSXYoGlhsuETv4h607J2YxG8edU3Blie+Rh+gfpXwnbAXgl4VLlVbJlXn9Pin1m8roZIG8ZhYZJm0m4xy/GxnKHqbqE9PYE30TFlm4djeRtbTK8OgOJ9tF/3iF8IoQpIHLiKPfuli87Ig/UwjIah2ES0wvcRRDbTHb1PViVkr7 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 524ed027-c50f-436d-b851-08dccbf4211d X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:40:56.9243 (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: 7dlJE7qLI1wXH5n2mR86zSz+BEHCZwqvlKU+B1zGzatkcDJzd+tkw2cEDHiG31fhmc0/0NUA5gjtzKyr5neTeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB5536 X-Headers-End: 1slP68-0008VM-Of Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788311 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 91F83CD3427 for ; Tue, 3 Sep 2024 08:56:39 +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 1slPL5-0001Ak-8Y; Tue, 03 Sep 2024 08:56:39 +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 1slPL3-0001AB-MV for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:37 +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=aCLVWVAzJV/WzPWLkSWWhVCPlc Y99gheL2tEZmqR47J98Bzrc1r0JFmfRh9Kuvia1Vv3L5rU6DJFhx94NIDCqHPzA1IT+LOaDvi9zsh gL4pAln2u+kRDFCsG/v28sF02bcJM1Pki9zN/K0wfiDWmIGTI95cx0NS0HTQz9jo8xEg=; 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=LYFfuOsPi8Ho2Kq/p0aqn7Y9P1 3lD3JcM3FjlOzKrhsDYJpYH0kWpb4OOHY7LmQwg7+zsFK7ZcBAueaf4iIeXK6aH65DuCxaqDgBPxu ZeofdljsyOSDpHU65UPBEepDyga1vw8uRioj90k7pSnIbkIUdk6a0j7gPrmjJHtMQVeg=; Received: from mail-tyzapc01on2050.outbound.protection.outlook.com ([40.107.117.50] 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 1slPL3-0001WW-1j for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=j7wjkLHc1aKn6edQE5ZG1P+jjEr9eThCTqiDopNuByXXwmSuWAwczGdJ39Pmw2Ua65/GWWjx9qiQueUqPIezQEaAgM6AmNg4nv2azG9hAxXKwbjGlH6tPhwI6DdxwA3x7AzG51r2X6tm6+NWI2hh0A3HwvWA497ubjGqsr2cWPyz3jON5IbhZk5vwuy+q9dDmxwWN9zg6ffsZ7m/ULSJfBRNciqX0HQLXuCwYCsb/ztL3cz/6jtU8TicML1ZwsTzP41Gj7grLiDHwQ15SLFUgQyC5vGTLjIeqXdU9GBVjeUtjUdnnVcbr8K7ZPflWkHDmoYQGdtxESTX2BL4y1EPqw== 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=Iq4vrfRifcf4y/5VTn5CzgaO5k19fCJMcL0fNNzX89hc5X5vCy1WGxWlyNfSS4f3fkbEaWCG+nXYWYya4737pCWj92Y7QHD5xd2NjxU9a8vwHuOkOImkJ2gar8BDWlzEFoW0HM1SAySyb8tq9cG/3jLuOdiH30J309lJKl+jtHKZ/0tXqAuUy+6ZxBp6C/kOavJhtGPfUiUSfK7zKQ/zvQ8T0fTJLGSaUydiYJrTpoQO2YoD/9bzPJIazN0TE/SB5rPvKS5/GF8LmrsebkoGogX1I0CIS+MbaIU+oRo38j89ftxpAn4nQNmk4Prrlq/RwC76c3BgPxI45wmBkkPkBQ== 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=aV446yRhhmeAj81mTeNykWE/i7BkTdDHjQdJOvmQwMcjMe7HW/6HJcCOkK+Xr6yBB2dl5r/uU9hqbEjiC19HCTXYEB1T+aPliinWMNosBwpFsPMuZjKYqw7UH9pqDKsGHESbBEVSf3CJu2ptHaS5dOfEIZ98yzSMZ0zy0D4HMhXj8BOXgOqrriWZCu8+EpcpcxEH2sibUeCzH100eQ3zVfj7EFRmDAVmhp6DPwnrvS5y7LX2CzjwEZBH8RwbnIADQZ6ZfIEH57cP2Cxm8d3C7QxQw7+Sg7QX+ZGtL7ntXPLySXIcy/rMXPWWoy0aPjIHR5E0uImey+aIWynWmo18hg== 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 SEZPR06MB6253.apcprd06.prod.outlook.com (2603:1096:101:e6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Tue, 3 Sep 2024 08:40:58 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:40:58 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:53 -0600 Message-Id: <067f905e4f3b71727cfada291b090896463ef796.1725334811.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|SEZPR06MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: fd5161b9-479e-45e7-c17e-08dccbf4222c 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: zDd2VlFYivjzkn4QOPiAecorxoETuuze5V46JB0Wu5PADoVW8tp3rNzUYNGT7a/vpvtqDXBDVzM4GtQmXdaB3KMS0VRdXznvsMbkhWTB8dDEc9RjgHzqvni4dgNDUMOHfAPBYualm0Eezslc5+RM7xv/FTAoOO3HCCUNVpPGu0cGovOF+XEi6NbJuuvCRMP5Rc7S2QdrdIXW6kOAWBvB6ENE3RPTgyhJWYTQ5iisctMtAXk2ZeL7Na3sG642BQhJjWjwiWZ558rl+qhfAfltqUCeoP3ODPqY50TCq7hjfkx7OZp3XKe/YUUKMAmP72W8e+ANNisVTri74zU06Yq1QKa6rDZ8gQ8JLj6M3q11X0SO35ApOn1+h/lWF8wSuSOYsw5sLCoPRTDvWb/cbpAyW7M6KOW1LdAe+l0N9uqVlFvOSZA9D3gUmZwIKtl3mOSHz9mWwNHgduEZEeaWZevMPVy8HLPQd4bj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FS:(13230040)(1800799024)(366016)(52116014)(376014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lh6kRz9wo060ovgpmKCG8eeJWed2xTXNVyHso3gwyJcsHeemEmA4wNXleBvTZRWmtm2LikePwpxNZ7RYDacvfuf65hgqe+LVJwJFYrDMcK923Z+9xpphboGJPihzaEpjG2CCO7hjL7fKUpK/N7pPco+XRfwOQqbYYbdqXisvTWVhmbxpZ+SwegExZa0fLxLZ4gGy8YiaD5WALpAkNLN3DEz+rNgNErXG9UQiG8S9hXqAdDb9DBKBWht+F+6tiRN2jMJ+XCrTeLBn9Px5LuLaGKdNssb03wL3QLHhXN3HkxZthfPFZKrdjVUNPYxPIhZKOGdvi0ENNv37ZQA5cRdky1IkLGo4UlQ35nnu/3dza8Dfi1oTRqgxsbLy6QcPpFaJwkg3J8eDca1hbw8VGuj9vq2HDiVvqkho38GRvt70PZ+Gxph+pr7l9NUU0nT2nMylAuw86iz/gIemL+sy03WQK7MjpgdTX8fKF0+PtW54AKQ5AoHT1CHrMoSxJJk3oDlq3Np7ruvyyGGXFwSjDSaeS2fX5YtjzhPY2dPfhQRG8BHiJd4m4/eXfOmTkpJ+KtzlQ6cV3Y9TKiyXTTo1KPZvDizwRs9+oDVqHG0cv8dsiaseXZpyRmRJTjN5x2RfBuJu9ISXZDjPEJ3BZ9OudxZydO4H97xnI7NQB+owwRYQZbqC9DjF9nDyyE8ZWd7Fo5F8Gt7Wv+Mw800i3XL0u4y2vnFJ1ufJOQ56kNuBdLhOz/dcx2E44tSyvedOZB8x6IgcUfnOOI1fu68iOXwR2M4T5YRAdWEG8Jek+u67oDMPX2SRY94joprOuw2/Pm+HPg+A+fPSjZDUe5K07BQnNYmglhLN+ObFTai7rzRvyk3QBmhGg9kO2hfBRBonEATUeJXISbu9L2UvNoi3AMoT2zD3z0Sy8fnzHovrbbvOqS1RHBDOWy+wXom46x5OhPYRcmyZ4+L3/0nZVUJGqO7V87RiuHbv3FhwjLrBuzH/jzmRrEsPlg2+tihkaLmrnWfhvOVunGrPtPMf4PGnn7T4MB7HAh4A+o1zp6GJOcp9zIU1msqtdYJFJvUBj+bLLrFGdgy6jVb7pL3Aup1SF5y14kCo+x7Su8+V+uyg+FU1h72P5wuxtaAXnR9j2fiqwJ3FPgrL9JdHbjQgKWsa0PmYhH1FmbyNxhOAq+I3ObcQgQTgCf5pk4AK2xER8H43niAPZ+GYUtQwqI62iPIFFw2PNvtpcJ0Rle0v1Of24EeCCYMLnuwRwKV0YVDZD50NoO8LH3W+jTgxf6nsaw62Rxm4fgYQJ4LNM6zKqwYNO+rdFBSEFomOU3EKywaVjymqIrh789RsHI8y6WQ0/m0BoRQTy7rsRyJK+G/ndPFnSWjR7TMKc1EtctjZEh9ExpPy/u4BJslirINgxPqyfYbZj7xB5ZP/YzjVqE9KXk78S2UOXTUrZxq9bSmeFjyGLWoZ8zZBzfWbO3JJtCqjzAPhcLpn5dcC66YXA5aDHYqnipYrHcwr9/KJmmul3iPzkLbmPzPNKsfbimWTN35Qho1YWMFgL++syZmsfGUsQVlVK/BHg1HN5ZQ27lw9Pgl96R47X9I06EPw X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd5161b9-479e-45e7-c17e-08dccbf4222c X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:40:58.7522 (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: co18DbyZwpk0B//8mkCqpOm3DwHUVk8S5L9/JJvnru5UIbsC94qg+mp5JQy1/E8ad3uX03Fj/rgQSgb6xfA5PQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6253 X-Headers-End: 1slPL3-0001WW-1j Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788318 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 EC4DFCD3420 for ; Tue, 3 Sep 2024 08:57:19 +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 1slPLj-0001HU-Kj; Tue, 03 Sep 2024 08:57:19 +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 1slPLi-0001H7-4F for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:57:18 +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=NRKCBop8rtZ3+RcK9fgHxR4PBi Qq3RCq6DwQRLm/bzRxFytxNTRMxM6pQ3TdzObSdi4wnC5zwrcQyiYjEeVbN5jBxen0lHTkkI2O7u0 i8E4plJ+ek2qqO1TvmAFkcdvS6T5epItlTjS4HGpa9FejdwQeLDfAgs+U0qal9m3iVaU=; 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=QnpNDl6D5Fx+XUc+PKtge49VgZ 4sq6Oj+lRvw/Y/jJj1D3OB7CkpHo1/sxAemzZNHEPu1BcHp/8Q4UptH255GsuVfuPDb0NFHRWzk8G nmfnv7xsEdCVWY/MHWqLpc5NCPaQGsc46bVHe8qXyrud+djM2KvkTLZIxhc7QCNuJLUU=; Received: from mail-tyzapc01on2080.outbound.protection.outlook.com ([40.107.117.80] 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 1slPLh-0001dm-Fq for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:57:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OvRzFdBvcthkvjg/Hqhq4q9mjuCjZTD6pNUF+orxPGhTX1buweJZReBAJsF5zpMAzOY7WXancBmfIXrk0kwadZyxHIkjYa+Lo925sOMrWe90+KtPLfEgdwgmJfIdgwKzhnjk6ujt0+PDGwNpi7XnrGmeAvDkOLNiT5eSzDjERp0j19Uf7Wh/39kxwk/rkg/pNndQbf90pkpLgeHTOxc3bGiEy4QYNB7v+yWZJiaCRtP0RuhBcMYK3UntljJ+MilNgNHc2q/6kPFadfIKWekrMu7nToSO7IjhSCMD/FZtVJtyVDwJHtJYLjBvA1pGFdVSs464MB+WPEnI0Zw4UOgwQg== 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=pDEM08qsEcjtmLyMIh+MOlj8XIGuXBgXiKTRarJUg5fsbeEoph5+MZXh/lm8KuW/OxKAWKbQrz25XeggVVcLFWjU4WD/S5wkrVJCNb2HN3hLdEo19A0AEt7wjSu8tgUYTWI8ECcxojRVoaJsFVNcEi/VTeUCQ9h7NZaXOQ3jdMC2wXIsFCo+FHMlUf/3zD5QDEVSv+1eOG3J9578JILnp2sIM6XPxex/sroHxlr4XWmTagweQdscIRdGntvIhwDv4kY2He2NSJ8/DGFJiwdBSV7c3dRMnAEkG0dnuTzykQx09zXd73tgLyIseeSmksiPZm7dlLQPEfVJ0xTwAg5pWg== 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=SD2tgbvBKOcZo4RPbFuvCwXBF0DKcr9Sh5QjPjXzmA/yvTPzMui2HkLRsA/6rnAt7oP7NqdhHclt43gysHz3kQy1fCjbKkklkTmCUX7kT0cExaTbGyvqb5r5XzVOdqsK+kptz1q+0wOo9huimR9X1lg8IBKCkmZj9ZV+ZCvCPIaW95hJIoI+syUTOXufnjYsct/VuYtOYlqtKxxHBHrknK9FvECIQLstF8pvcnVQO59OBzsi0cQlDqln8xhq40JDT4pJCVgfbwwi/mm2erJ4sXu9IMF6VfnujwT/ksLAPkHyWXBAN8zHLlDqw3oIGC/c3Yff38hN69RIVETkVTQ53g== 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 SEZPR06MB6253.apcprd06.prod.outlook.com (2603:1096:101:e6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Tue, 3 Sep 2024 08:41:00 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:41:00 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:54 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|SEZPR06MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: e72af517-adfc-47a5-54ce-08dccbf42326 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: yKDhJe7wlVra0y0x8MpSwEJ7jhUgJM+af0soqdHpformwCj//xwJiCs1aJO9nIAxMRO3wv9LRNsZeTlT1aowU0w6OuwWdW7okqUoUlNk60KclAqQhPvCNFwskfchNT88DHFGdaYJHwj7FjccuFkn0xagNnI5fDqzu/kXN937NdtRClzOf+9HMi6UScR3qYSXmv+S58FKNdssfmf1myELdcP3zveV7jtLfK97QeUJPEAz/XzS0xp21YcC9n4zV7uwQr7MKYSjHapdM0c8KHQksemvDikQEenr+ieyBJs5pFvIbYIgP1OaCJpbAHLkXMlYyzyypQJKXRy0yHvnjdidEchF3/qfocdq+R4nd7U+MhtNWiozLReMrGKaod1MITros9aqFQ6dhWCbPMLHi8uV+5NypJuPADeDNwiCijwB0GMtxvemAjqpx+PqQw954fJQyBMRveVQw5TKgAtSn5R6Lc85FzaNdf53OyXYBzUYVG/yDVTT+Zn9tAc/ZAodnYAZRtesW79Nn18hrI8mcx1+Xet62j0YI/4jlm7zY02ZTLt3/wOUfhWh1XLBdoAsA6HgHvMjugG/+jeSDx0wlq+e7UlVKnM5K7Zyrue+/qvWRdyOV+hB72xbetKkk3CmSywHqC+Iv7Ob4GYaZ5VMqHhmieoyspguepSiLH9LJ4pJXHinLTcghO8KW3/eUjKbJj982g9sjvnWzgPjaV4CBAunJzHhU77jXcf1/3Wc4eIEH4xPrF4yaoeRgbvvTPof0e8iYHMftTg5Z/DdOWmbQg3hzHhvog5tLecebvhUTiwjGYqAkL6aEe7JaY1BoaTaDVcT0Oh3k28moRX7PvxzoOHAe563HtsohWdBHyNLXIwG7uyUxb6ljkkKZ6KeIVYs+c/WM2ecQm4ru/29pXYMZ1GX4dUGYcGUSsM+R1WOO9J9wkKshjGiKa5CawbT359K6tlNO+sb6fq5hVFk/5SGlQgZ4wIUmb3OXdCRXsjgwrXPoVCVlRUwz5nx5skIQtzi4spbM/knS5Ieu6RbnWYRBgv+HhL2z6mH/4nUbpXDzWou+rC2msa/yRLVDYRdsw8rhorBaQrx5WS2B4x61G8Wt117r1Xc4i/XmXJhwm93HVeX3eYP6H0QtPe/gA7PlIjT8z/dfsCG5qdcqATm0+xPOEvKdNhzrU5kosdoO5SyHNMMcTk7i0vp4Jgh+g57buuYcgoucmIBFBuYnz5c8MNO6nkg9oOC4wWUivner+e4UfoiYfetSWPt9KEcRWG1wp12PAb8t6UGGgMSSx/TfwjSOkCWp3ChDBO+DRBcnA/diEN+5PNMU45oU65olTM97W8CUVZnmQBvzAgU13ZovGEliRBN468EBIf5fXu2qW7K/IjPtpql4OvuZL7RE0fpDTkOTshMN30vUI8fKwkzccDK0yQDXA== 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: yvTUa/Ry+Ya4i97Sufo6OcTgN9cGnMEY3ivH1d41CAU7V0kGWSNfTWu1wcgoyPdrOYF8NI0YifmQX2/sJ/N2PLzK3eiHqo2khDfrlw14aMGxwsgLCpV4cZVqQnUTxzO52/zb9xmXHicHW3wrqkRnbWQJ+OXfagMOXg9Vo9PJ2JbZckl4h7R4XlQMdgUEmrO4cUA7lQI8vx4B67SkYODTJZlOvSLRYhEKe3b2jlv32AsgMY91kD9rrLgAiSskzG1OEOwPcr5dED5mQRDG0+7+ylQE1Wo1AsX1IEOOlbnlnYC1kHbqgBGGl2HDbm5GoKyBrgLdy907bAw3xwKtPaDNzwepxTrxCKL1rPDta3OJf21wSjWc96DJnqUmUwEsgzGMPqD3wKyMnysi27eGlk+iChkx1fXCdqdzquXAJjpQD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lXtHS4aA9OpSiM0byh0xqEAdNYgkB6yhEt7HsXrSGd3amJsTXe1Z7ksTKMD94OXHPrVfjS5TVP6TZ7IYdijjCcsumlR2RsNvoK X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e72af517-adfc-47a5-54ce-08dccbf42326 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:41:00.3225 (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: N3NnmjS+7yHCfCdIdtBt2RIyazDKeHEsTU6weDPgvBbd8qeoYF79R7kO25Nb2NKQ5QEi9vx5R8BcG2nDY6UMzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6253 X-Headers-End: 1slPLh-0001dm-Fq Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788314 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 5DEC1CD13CF for ; Tue, 3 Sep 2024 08:56:58 +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 1slPLO-0002UK-1S; Tue, 03 Sep 2024 08:56:58 +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 1slPLK-0002U7-BW for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56: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=6YkUHWkSyaZim2/FraKiN+n8vb8EDsmqhJ3U8NImOxA=; b=G4a18MLXMXDrxk8Rw/OYCNL6m/ Z2yIo/57xJ0oB3Swtj/aijAqCSoPOnYPt3Hj92RSa3ZFRfWSLTUxpTWHLJIZaZ/AJYbdAsA20FMQd 420NMl62ZGBzvUJvBJyM/9JCxbWtEYsNww/7m6O/AEI7raq2V8Ad6EhkR743So3c1fB8=; 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=AYYGcVlXB6LERded5F8S8RuyTC 0HiZ3+KY353JX5gRcpCzR4WGICca6aMbxRdNz0iA2xjhK5Rc+GE/Pr56AN+ZadT7ID6/9ZsZJ7jC1 74pacbEoxTpBt5AwMyrqP1jtmtsbK+puY5lEsT4sDyL8NSqVczyllKFdMNen/FQ0kpWQ=; Received: from mail-psaapc01on2076.outbound.protection.outlook.com ([40.107.255.76] 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 1slPLJ-0001Z9-MI for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rbFheJlEDdFnDlnwf8a19hADcu3pB7mJ1WNAff48ChAjTyGDaLtLy2mKLoYtlXCOzPxV8Fw/4qB1t4gaMJEEQOvcQQajmyKbRBQ//B44XMv+hVsjEEmHIYHfSq279bcYhMpF/7WQTHnV+5DE52Ngpj/CXGoeJ7uC0jRGWhJH55jIzle/ixj43SfBGmdbfG8zyl8lA+hEJCxyIAMuI5LJYIq+C2Yr43/sUWLOBkq7oxkFpiQ6zuU70vCE7C2AR5zR0U+jlfm1IScJHFsu/e65m4e/+5qcH3E6UTQEbEaKgKw02Cii5eIr+u0J/tpqIZu89JVPsu8geJ9vpuBLjrju2w== 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=sLfKd9fBbl4mbK0B5mHH+Ch/uzvKZZ6FVwG2yZHXIe6pxVMNhxpqU77sSkez1HPfCdb2VDXkBRBwrtvsvsFXTFUJ8Hlkp4dwpvC06baEf8uyMXbVlr0h76SUg4Y13g7u5xu9xFVREmSywl+Hmy+up3OTdKMR6IlwsQ/RvBu1AqnSopRQb90ahLJUlwdn5SCNs8Tr+0RdHqrHt97zZK4JVdrtkXp3jHkQlsSWeYZGbwEWVuqfGrSli9uoFbWG0ERCz9tIyOXONtV3P9HLR4LXQOWhuK1/dwr73HbwY7CLr2oWotAJkoH4Nlhtf8414Hj6EavSxVI5X0dlQx1T8haFAg== 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=VjYup4e9dI6RuPcbU0kyiWBHTzPnlfVfTxpIBiMQu/E+lPhV3SZVX86HDE5RSGi8EiJN6Vuxi+1KNohdUdV3fKN4wA5HjxrOK2Uozdp1wQkfHIPe7ZwTucAtJilzjJCRd8a6saw8u7D/lZJUeTkNhcFU1i5rIGV2DAXpnzfcFtJ0LucM7rltTCdaif3N+b7AhY7fFJSjog6vTQXi6TQDobGIwWQBvsSEB31sHecW5rWnLfxKwfPw9kwo1FTFOeC8E8g9WZ+6quraKZaWgAcqYBJRo3CBiO0oBpHC+f3QiXEtIhQzoiW5UUXWHyQqeucPYVxp6eOfYLnCtGAuIYQdHQ== 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 SEZPR06MB6253.apcprd06.prod.outlook.com (2603:1096:101:e6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Tue, 3 Sep 2024 08:41:02 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:41:02 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:55 -0600 Message-Id: <64857ac35515abdb00cfad877094131b471a8776.1725334811.git.bo.wu@vivo.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|SEZPR06MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: b05251c6-8a05-4229-6a71-08dccbf42420 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: 9HLbtpGoWatf0EAjJJAbKtiUPN964yabSqYXeD07Q+/ejkPmAzG5u9SApPytRMFwjEk6iL5uvqMxjriAbMcehVCaOlwSp9dFUvc/Okh/IXkkscDf8eY/dU3govS8rquN+njijAHQWDm/YdpMVEiMrGKSKPnwECyK9zsVrgBm4eTJ1aXrUnow/8Rpo+nQ82qmke1Ixdq9WG30R+doTq2lHWcAdncZikBnPtJPnzBYmzlUO7P6lx3gT2smAVSCG9Wlg9Zi5yK/Xb9A2utZULLQKHJ+3G+Ea71NOa+Zsw/Qkzzx3p4U+GfCcTNPTybxeFTjbVFDnnDktUDEYzh97t6KQvRhEmKY+rQcQDMciO6TJqIdMDw81u10BHeqpVZVZzJ+sl0lvXDHvSB0tO83wqyxW/4WeIUP9UliBdeaUtyAy6fm+oV7zmiOsLdXljWM/lbG8lISk50JKku+j08F9O/k77+RXii6rlQYJOpDhqcB1vNFjVuOSpk/7lv29B7xljabJRnIyJYZ6dRVRjzlvwzwIJLJM70NrqOgHI7A7yzgSBgPQC0YjjXNlbpmhXuYumEqSTVrwkMOWU73rBYMAnwtHQFEUvTeE+g9nXaxMt72slycJPxL+/f7MxA8VK+JxfSwJKlDOD8VF6yCkpR6Pyg59/RCZOlFhJ2VcsS8LI38ica+kvojfqaySj39wEBQCivxWasAV3fw/cSXcaw6ZEHrGMvBDzW4MSPaP0rzcOE9FVKIp+IZ96Ifjrcw0tjygnS9qur32q34JT4G7S/8k9QCepcBvB9WRanHYu9fruwL8JXoTFYKqxPbuLW+bim24QhUbhME4WBKLYPZJac6O3KdQsQqUozElMdN0jWnbh1b+TJi1MaV9gpaKVbpF9jSyYqAVuTjnASyQOc4yfFbJ/x/KYKOAuVxsFuNXRIgzwKgUMh/9SbC+Fc+tw5P1XktIjCUXDlrV6ItCVF/yDpkD1meqsIyetkKIIWFmmwTaymIW/R3p2ctbIypnmQWpdHeKg1J8mCNi9ic4GTVKTvie5RZ9xXniCbagxGX9qK8yug77VE+B645oC9IswG52eGyjTVkaZ+NgXawUDq+qz8CKbowHq0dXSuWFU0y7xhkT0oI0irM6yZ8TdOCiKiS2B8ZcFEXwR7cXEH3asvbxTfvZXzjsaG1gTfAfLEsmNTvcKtqPMS1bbSy4aFzlyb+G5aNc1vsUYA4Qqm2jFwv+dCkDdZ8Zr2YuR3eQ4mbJpIrx7KF8aSFTKXO+QSmdcwUPRi24YZcBEk+xK3E9oM2ez0+qK5dron3Fd1ViRdm+8oMeZ7NZT/ObWZbX16YueCmTmbJ2eSo/WDsaKJLTAspbNrilemnb/SCCztp/Iec26v/UFxg2YRoaoa0KyeDNV5gG0XIpmR+0J6SB5g75g9PHwsz5ICthg== 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-Exch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stZn8a0SGXkKwrHGd478fGfnZkfVeIqJUNOVDPIazoVmdLqi2u0SuXpeL5eTL1Pw0zRvVxmRjTL9V21gMt8FposQfIxbyPKw/QacamZJ86SNsuJz+gQCfgsAujAf5djC1+n/MQMnLymuYcBkGuW3snFKObccnpeei3Hu+fxq2m5fKSIr27jauw26fMdHLe27vxbYifnW5REvHt02nfLUtIb/2v1LieAYQQYYHHtIdKMe28f+VXxGE49Tifbmofa8w5i9xeQ5NG8NqhNDlnMZ5DgqfNsE8eVtRHve5hhMfjxczavoAPWtvK/PBoI0c5Sa0oylFIAHnILUOA5CBjxV3DV35BYcmVgXSnMEBHRXVuJHOeZzrDVQnhEHKxczL8S1n9Ol1Ld8Uc5SC8veOU5C8/eb6hAmzysYZWb4Opxg2zBQCEvrcErmZ3cz7jzfVh/sgPRo4LbCUou7xmEA6B9ONV+7lPdsNCPtAyvEG2wKL5w1UEJ4UyQHeRlQL/kkZ+uMNYBSz0M3ZN2T8rVi9HgKE460 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b05251c6-8a05-4229-6a71-08dccbf42420 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:41:01.9840 (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: HO2CqehOjqQJwIVvlMS4X4uxOCCe8oR5V8nxoejEtCIqk5C5tRPBH81XtvpEx248dDTQfzuykZD3uE1NmGl93g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6253 X-Headers-End: 1slPLJ-0001Z9-MI Subject: [f2fs-dev] [PATCH 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 Tue Sep 3 08:54:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788312 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 78C62CD3420 for ; Tue, 3 Sep 2024 08:56:41 +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 1slPL7-0002Sv-4l; Tue, 03 Sep 2024 08:56:41 +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 1slPL4-0002So-Vk for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:39 +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=nbZeop3h776mT1amATsUdqwxv5obSgOzz80FLIbq/FI=; b=MHjHYHXOiYKAWXaOErFUP1Vash Bs80aNZvkwSTlBXpHxgoKDEM6EZX09mfEAc4RCgaLwM16XXJ91RuvkNJiYCvhn1Vh/CY4uZpkdSJ7 kfII/nw6FfSNB+9N3C1hq9D9TpvoLUZTV4wx/jvFzu8IqimREDOPoTPs4Ju9UfqKhQO8=; 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=nbZeop3h776mT1amATsUdqwxv5obSgOzz80FLIbq/FI=; b=dmUR6pg/j5elwTFT15fPr3xSHV MOrLSUEZHxcUTcOQe1bzA7OohneA0ZLndQtHxL9ztYxV9meh8hr2iLaf0/lL6PgMSXp6Y3uieT87t 1O1PAojI8QmiZu8SDeXufj0eF6ia5r13TtZmvcbhLwp5lWCbfBpUkkS65dhYKLUULo8s=; Received: from mail-tyzapc01on2050.outbound.protection.outlook.com ([40.107.117.50] 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 1slPL4-0001WW-0x for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:56:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=REsjmizbeSXBMC9sVVAQ+qB7mk5uC6SHonmLFkFtUFYs91XGVqUGQ0J0ReOAV5T6zQ9q0KfJdVUC0R6qpn7e8m7oeeEyYIXzg7c3mrVG30x/x0o5jK0EUZNF/K7v8wyRtrbQijWPZbPksLUnWhTI7GcCASg4+7xW7NwT4oaOHT+0ZcF7xf4wYVaBSWKnuVAUkruJ3JmFACQr9hWIfhiFR4zmmMZdM2QLoZ2erpM235Zojv8NjAUUN+bpE3lmc3hzo/WRjv4POU3n2Z6fmPJAqoMtQffsK4YV0+dT7jdY9cPangVat1F/N2uh3UTPdeOBialUEehUrfgZdr6BKNqqBg== 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=nbZeop3h776mT1amATsUdqwxv5obSgOzz80FLIbq/FI=; b=q6RBB8LBm7yh1IX+kBUYCXr+s3+N0knfMjK6e99epmstEiUEvW9bZcOkAOshyrrdK+T5sqDDz1381gPAZhr6jd9mwHz40Dm1noJnf4+JiDAX1nLA95Bi3ylqCuoLfcrxWb1Wef8lSSqwD/lyfAtzjJW1WB623bkaqkKZNiWfsqJnQh6rkPmBscB41e5pK8eRxxjLSTt27kGEY2Iry6Ff9PaQ4IT4eQqtc4jhSUsPYKYfXj84No6he/7cfzgSiUTS6Pzh9+1iUor5qAUGqbVgi3jfbHrcnt9SjjaNJozrGsZyHx3bTQWv5VIryWNKVj/RvLBE9wFFAKQqVF2e0juPWw== 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=nbZeop3h776mT1amATsUdqwxv5obSgOzz80FLIbq/FI=; b=CHDQtgT1ZTFCIm6XiIHWXBwlYUfzwAFdnew13v5TEh1Cd+J/YPZ1ybHkzXwWHYEiL8Ap+TTeBBsYj9U1Z8agbjzoNEOwrFns8wWJlJ9ST1Z1AKifVFqFhoBDr+P89M9WQYwVOkeGMqAtj2TBOBLobkvGQwQkrF56RoNS5BfPL2462RypxctSz8prkDky9+8U9oTlaG61nVwPi7TS/sNxD/RhxGT3DN3rDrieokcIBhC9tAJVUsAmt6XHXa0O0zkt9aYJZKizwbhBHQVbVag2UGdYy/DrWA6cP083R3XWdyP3iCW6vhkMfjcoOwinBBO9XVSHjYMcZMyr18wVQxS6oA== 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 SEZPR06MB6253.apcprd06.prod.outlook.com (2603:1096:101:e6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Tue, 3 Sep 2024 08:41:03 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:41:03 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:56 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|SEZPR06MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: 49833a68-1e81-4d83-f6bc-08dccbf424fa 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: t7j4V+3K88KOWzhuvSEMC8q261iwGCNVzNwS3cp5d19F40ZCjIhJ1t57g1py26m2wh61EQxUwzlqEUGsEmybsI2Dd8DPHXEccUqAL/+WeplXRRSvnqSl1qR4IVq1XPlVPyn3Esr2V/7xlYHoRnBr/SY7VNIRPwBE5Sr7Sfrrs8HuveofbFdYifFGUTlV5MPAw4/4vAvPhhy8zZiq2EOSVMUJEOxX6Ejxvcc6lNs7tYCbPWLJbEegfxn1qUmsNSc7fJZHL+tRb1iVOs23RjDlugUmj2qbTgf1X/a2KwT45V3kYQmPNKHhxyOsAzgtnUMVjYkUsodbqQlER0icwYT/Yy0m17FJr7YbYMLuHQL+zj3J9qP8IwTIyZ5oEuBck0HzSSS7DgwEa86vQX+bzhspXTzgr5TYohAzMpqfmcxNnMjTdY9MZCkbaMDMkuL9AtR9MQr0YAqw5CSP0dqr/8YVxou2ppLFjRpPwBKQeFqrpgcfyNR+pc4Y4gTDtm2Dd20znmS7PuavOX23oN3mJsms6OoNTzHQhd1atgBPavmfQi+HYTiEg/eIvG4+1bG5x0vMt1rNUzA9gVtcwfJO5KbYCdnhrc0uX0ghvXqZOFWbSvVBBC8hr9uDTVkQ9IeEj29msFCMo2PICe3QzSfjbWhMgNvSdEjppSgye/sWLuo6nSQUMikJBjvcROa80t3Mt9XTjktDrliIZ5piFeS/L8osrZ8N+En9vYdcRODmeVQ+MxvTuHZdiLJP2F2UTw1xz0XyWwMsW+UbH90WVmRaAQ09aptxtcoe+Q86D9lJ74GSeO/26XJNPP5Ai8IGtvvdAcTV3bHwkkXFSF4b3QP0NkhecC5DQgdVodb2mcx+BOu4pQkkU0QlwuNw28akXnJNu70VITDjFifSzlxYvzGBszdt/kQf2NdUqGP34aERc9pGRTu4ELBRishHnJsTZVWZNzUvewHIkZ8afaMuLrlgxMdIXuJPekZSwPtYTwMDJumQcOlFgjAL3n7bdfxIBaF4IH1C7BjztZiTvXOifJtNMTGvuNCSlHyKAvPaB5jHFBvlRdyty9YYSB3mMMUFij3X7g12oKRd755wS1cJH7448ctcCoVrm5pjVgXY3RQGMyq9G+AgMG6xmz1fl1sEvqz85ai9PHBx0yRONuWCMscjiYm2V+iRkse8GmQ8Gmjoiair7jAG/iM0gTFFbQbJC6gcjdxj7urlsuhgu9SzAzvYLdqCLVoJbotWejZW0Vnn4pgM3l/bvs0TFQ5BuNHRZaKE2+xWh+MX4RyAMzCdkeuoXA8OVJhlx9ORkm/6+ooYQsZ1zzQf1Wrsey6XUVu8M1NM+uuzHD/49CJcFv6kqV/TT394ZVyVp5IFvfFn+NWCMrPGcVXgji1iSIfGM57ZRkRfvxOmQgU77aanyCVSCzjKmYobMw== 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: WGLXuIQ2zEf+ykGxgCcZ1/5Ph+3NJLSMjfsFwyRFifyRyBE672wNPDjV38g5n0yRPEuVzXVIBWU/4BtP+87oi75o1Ji06w12aUUl/bl4Gkg+aK2PUFZKzt5fq8U65koraKAgXn4xynwwr47lOwhUPqjSRTtSzgo4GhmO3+rfBYwQQ6XFv25tfXFlM4zuuklYNewmXYAV0aISDIqpKvhqr71TuIoQoDFpHxqjbUWGOc9sTeAOSzPL42wdFhl1PyrLk215NfChhOVEbU/EoKy4CVESZnQPPegPP3hRoztAEI2EV67+oFcxezOOga6eZ/FbuKw+ug6GbCtJvfktTPphhHD9TmXFsNmDQk5GpxzsotWHucdLn0Ffh0peMkKVuSuEq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KgxayIf5b9AD3TKi5RZiOQ4JGWQEbzQT6rm9odtJ4w40ijPJ7CHgc1XTpMlXADwg9G96BnVElPdMIf0vuS+XNRSK5cCFsoZujggrs33dFi1YSfWG2M8qZw6ipoN X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 49833a68-1e81-4d83-f6bc-08dccbf424fa X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:41:03.4227 (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: Ry/W6KbMnFgdNG4ImpBVwxVCrG5Wu0HorMV63RsxEmvllifG4G9pxmKvBCbq5ryZla9Iv08PgKDtFX05h9CtoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6253 X-Headers-End: 1slPL4-0001WW-0x Subject: [f2fs-dev] [PATCH 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: 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 Tue Sep 3 08:54:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13788317 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 2EFFDCD13CF for ; Tue, 3 Sep 2024 08:57:18 +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 1slPLh-0002WN-SN; Tue, 03 Sep 2024 08:57:17 +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 1slPLh-0002WF-7L for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:57:17 +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=97TuGgQIJ8tnYExNPNiZlqOaqsccwOGENwEzsLHQqDQ=; b=KUCkg4snlcWTrV6jMzL5KCthsj E/fFlxKdNnZAyVm0xVfDJYrEf0Iypehjrj7IGeFUbr71mEDJSLKBdwWkdJgsL0+TCRobkka9WbrAZ 7zu4HICMdRJaxsCnXZH83ftDxM2t3f8PKNwRpXz9pAMZLvJHUM/Wjq38a7DzXmIA5f5Y=; 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=97TuGgQIJ8tnYExNPNiZlqOaqsccwOGENwEzsLHQqDQ=; b=bBxrXZ46sgtxKO16xeDfmFLBkf CBhjeDUm3Eody7K6UrEMSKqVbkbC6JeNBw9Dc/HHH2OmDU3Nnh9yjYBozzXc1blHj2s3YsAPrmXcB uTP9E5Mwg+bPzGfQIutUGL0kvQfom6QP/Xg2CONokn48dtHn8FRLvW1Tnj7O3OcnceIc=; Received: from mail-tyzapc01on2080.outbound.protection.outlook.com ([40.107.117.80] 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 1slPLg-0001dm-FA for linux-f2fs-devel@lists.sourceforge.net; Tue, 03 Sep 2024 08:57:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qUci4+wLAzbLMF+HpMIw/48nHHJ31Vkdnzw0A6RUjx17512+BftFDQAGwyyGnJmswHitDjY/eZaa0mVeUT9mz3ixSyReOBxn+ggrvBTPls2IPx13BHC/VE2Pq8zImyUD0xMsg6XKLAKiEASGg7/MshF6XmYGP4wQd6YPw45rM/cZf3kTnijT7f95WT1AAexpXb2x2f6Oy1puxgCdtk9+OhXg+LLO5KLx2vlKqHmYZOWerXSAsFXA3GiSCA/rtNpQvgHuvxAEDZ6VZfoKuM61mN5qi5A6HGRjlixoCu46zkd51ax3jQ4xtily2iVy8OEI5oqH8pkbXINPOjSNba+Kyg== 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=97TuGgQIJ8tnYExNPNiZlqOaqsccwOGENwEzsLHQqDQ=; b=K7wqLxcOd4WZW5BRhpzZco9VJavIqkVhB+92DhuU1Ls/Fs8dOXe/m/NLeWtW2E+AFfs/7+RYmWyU/lTQbt+uUkBcsgwVTzSsV/YZVfCWbO1w40Z2w7yxJumoefNL4sYcJWBos5iarpc0iXS4h23gtdmvPM5779hr2FNIV1DrqijaP23DMD5NC3rsVI6ae1VtPEkOcDQp/pZC5tPcLN8xVu/QjDxZ9PXq5VZJ43r7/5OPTa8zMHryHfdJ7Myb/thhpiih6adnfquMbPu7STD7q0nJwwEAnyE0mxgsDpAP76KqIU42YPnLjCnLZ+ITj8XybcwlihPqdT2X0Xw2r4RbKw== 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=97TuGgQIJ8tnYExNPNiZlqOaqsccwOGENwEzsLHQqDQ=; b=heyv9Sb+MjdVXJDLU80upWlErZbvGAVEzItzkWsyAE6QEam6NsuBH9n3BCiFZGMjOZp2P5YXnP24CbwCzU9VDR6CyxqV9TMV1j805o3u+Q1V3OR9yBJKzmj8+7nlPi3qV2Ikx75aWpPR0xfP6CVMVyKnWSo5ZLXg5cT58DfRehuS0Nv1gqwLUEvmomNKAn/KJSmDrX6FW2YuDS+nBRD4dyxnDreHJu+rijJJ031PBP676h7KijQsc/nRBL65km/1XctzOtEQlsFGiLpBHSeSq++SoGfJ1XvPHg6gUBo5PeZ0l9QqFSiE+LyOBGRvQ7fWYCDRiEpvPNQB4DFDCxciXA== 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 SEZPR06MB6253.apcprd06.prod.outlook.com (2603:1096:101:e6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Tue, 3 Sep 2024 08:41:04 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%6]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 08:41:04 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 3 Sep 2024 02:54:57 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:194::12) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|SEZPR06MB6253:EE_ X-MS-Office365-Filtering-Correlation-Id: af97c900-72dd-49cd-81a5-08dccbf425d5 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: iiCY55HO6OWKFaFv23f4Jamrm/aeUWGDa58FNf8WlM7lIAFRsZ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8XmHASb3BxtNzrLZBIBEbWkMdFhHKr1oMhqcDP4BxGNpWNtXg8zhl6JiFp6OJvMqX5/8Q4QPmkEbRuCUOyHH8a70EQ/F9HbSFShWRukhhATCk7QUwUDeRitJibPLHRugdRJAgSZbOlUuImjKI7sGniqami+Lcs49w5mwUz7UijVE5krdkpOeVFKqNv0uS7bezPSGjnoiXWx4MUkt7/NDU9AFbxMjqUXLB1WxRWB1XNPXYbSyzchwuA3uyA8b8XQAWeMCy0DKEDvRr1EcHt2W3NfQL3U1k86g== 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: yBAsvQaWHtNQnr4KBdpA1vGKbOsZQhlkZNgbWoGIpfA46b4yQUA7tZ2xSR6+D9l+yiXMv/OKdzebaK7Yttzlw3AXPIpxC9jejQB/rzQTHmF6PL5LDGFFjGBVXt1KUN2bh8dUKEyKmMUBEGU5qHa9gS217OrQPV1a/lJ65vRCNRyVZ8ELD9sw8KitufDYTeOl/SyMDdpQnToS+sm7vYPteRzb5gXfh6bCZXkLCGeh4xNwM0XZD5T6PnJJVHNe2RrD+trwIiHAUXsYllzMxJufSD4CkcDa7h0+N3lnPeso/Ts5RN39wU29jyX983rIiqYJ8HgOnYmGglv5MGdo7zAFlUGJoqztqGs35UR5vSX7BXcXQCumi/9fs7kQ6gE4gW3AxzA+qdWiYE1QPa83B4paFEIdcend8TbPVF90KYTsvgrI13vyPgYUDnuvrU5DupxnBxCHp5Dj1z2dlT/H7GZK4CEOCbfXkGKnxs8tQfcNUVCxAzY0mP7bgoWW0b+3LoStOYBPptm6IBkm2YDCgq2C1vAQWnSNgfczYg0De/qkovI42eYOteNlIe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: af97c900-72dd-49cd-81a5-08dccbf425d5 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 08:41:04.8521 (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: U/6rLlN8JJbsBej5p1tmvrCzzOAGldxT3NtrKFSWu5HulQvWrX2QUCyfVn76h1T/XVqY9kFu5dzAE7WsiKZiqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6253 X-Headers-End: 1slPLg-0001dm-FA Subject: [f2fs-dev] [PATCH 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..003367c4cc2e 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 && (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 && (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: