From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2047.outbound.protection.outlook.com [40.107.117.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C0DE161 for ; Wed, 10 Jul 2024 01:19:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.47 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720574350; cv=fail; b=tfjRtloYmV5tIGoT4BH7vTYzhixE4i3v5rl0MyH1jF0pcz/3vw3KqZ5aFh2hbMZhPGeYcdASUNv0zFKaYLdXkvERLAsyBnAYyLC6itucMO8FJvYCCqt+hVKqXIw8R/rRb6eWCDnOIpQOH5e2uFK++Xq6QeltSPqqZ69Vcb0YyTE= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720574350; c=relaxed/simple; bh=xGrDTKQgHFsMKAsCF9dk88T6oOGCK5mbPoNbSEFvHwE=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=nVRd2le92/qY2b7RKAKH2Og8Grb/5AhL8H2HU4MiqOICQSeQE12f7kHs68Ex/dQMmoFgFecs6xpIE9xGfUlzDdRoIpvjdaVKBQmO0XspMG4XL4amkJYbbuNbphMwz0fcFL95qriL03fWalUsNmR5nxlAE1PbviYTnzcnkAstDm8= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=TH+JlTxj; arc=fail smtp.client-ip=40.107.117.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="TH+JlTxj" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cs0mQ0+9THylIQMXpaBkbnquKabGbqmdc7VHQRH/2wqeGzt75jGtEFjgNnm0EvlZKowjQAj+JJ3q6Dh36nIm8b4SFtS8uLYba2sq0r1effWSnN79lzqXcqTdvGzKuGULBkpg6jKiWI2TXgDOg0P1uNJJM1PyO5u53uUe5dhTgF7guqlY5hPAY4rdtLnK0EgMjh+DiYcnj45H1vexVjgt27P87MTwKD/3wsfcccBZu6D8eJRGyV8dZgbhhhYQyxuiK8WcIf/zjEhengO2lLJroh80JEJlP2y8BJcdHgmz4wJYIAjVMT1uUHxWm2l8PKo33wZ6X1GrwA4K/5P8p+yfiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g4QD2basy0BOPGPoM4t8O1QZNDxdgZ/jxcqW/JuibGs=; b=m1jkwwUhCR4+84EsaB0mtXmpmyAVjd02qI+e+Zi8bQTfZ58NTQC3AICPIPdogCd3s+Y6NiPmJRqHGcOmlJEiimvwa8VvMAcYDQcIK34jT5zcuTeBoCSu5yUJM9k6J8iSWa5Y6YMiKOUhreMCN/5xHgfQ2gtqsvtnfHretufyE1r36gBnQjaec+BzC9UQ4Oe6peA9D0jdD+DsS8WDXP+y4aNPTNlnO84uGlS76BgE2MEm0rzO0Sgcsxef/vhOtLMJfmyeF5I/FrXUwqZsFfGWTNzk/FtDS46fmP5beEC1Ideu8nl1oLasU5fF0mzmPzBs2Roy3AIOciBMb2b700VXKg== 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=g4QD2basy0BOPGPoM4t8O1QZNDxdgZ/jxcqW/JuibGs=; b=TH+JlTxjW7iGzLz+8HAYm0f+UUPKupCKZCKjELEt5TmORrUXW3IwosRAgsK0lX32oAHGDIxP5yWX/dQS2L5fNKQKhMEAA4e5utIjlwXo50B+IaPZz8AhJZBe+w/P2oWw7mRL1nsp8TQkKzLhs4b/YzT9FFRdLTlZ87aak3G4TAz9VgskunWuZcDbTj/rQ+ZuoRqqL6QlJDpvHnOefPSILTQuwQBbN4As8V9z+zZ82FDIiJo3PU3LTOtyZOgNNn9bi8751BcabkIAwyNHsrdWsN0DaMp6bdHMvZ0YgNQ5eIMHpLgwHNj3U5v66WvyJfvZhrEy5SDCloRqRUOzc7k7dQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) by JH0PR06MB6889.apcprd06.prod.outlook.com (2603:1096:990:46::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Wed, 10 Jul 2024 01:19: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%5]) with mapi id 15.20.7741.033; Wed, 10 Jul 2024 01:19:02 +0000 From: Wu Bo To: Jaegeuk Kim , Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Wu Bo , Wu Bo Subject: [RFC PATCH 0/5] Add inline tail support Date: Tue, 9 Jul 2024 19:33:02 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0030.apcprd01.prod.exchangelabs.com (2603:1096:4:192::15) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|JH0PR06MB6889:EE_ X-MS-Office365-Filtering-Correlation-Id: 83a8a0f3-9e6b-405a-7c38-08dca07e4859 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?HIL/2HSLyRZ1TMqDm0nAVtZ9jssSXIIBg87FCBwyn5Hsu7VBu4XBYoVvcli7?= =?us-ascii?Q?vGgLWPqJOJ4QNgQ0EHbG+a73mZjSt7+NF2rL+nzqgScYnMtePqA5RIi4QNjg?= =?us-ascii?Q?4PM3eXnUcSCSdNQ9VcQ1wyt7rdfRNOhv7mZnksZAOZDZ0PTkh6YVWFrq9NEZ?= =?us-ascii?Q?bpRxyjzxWCi3ksKe1ZL94pJYCSd22doKsThTXPcsfeCOMILnuD5osnsyYaAE?= =?us-ascii?Q?ANjUd7CpSAe6t7r9wW55EkKANUmBAcPoTolE6g3EXzINQw5mbJdDtOvlNecR?= =?us-ascii?Q?2nOOkNekkHbLAvN7do75+eeUYBmFLjHvNv/gdfxeVHdvvJGNknFvdCpcvscW?= =?us-ascii?Q?owbE4im3AU+LgfIieSwt94JyZoI4hAxGfgXA8XngIEnO+R6dQIIujqSVk3c5?= =?us-ascii?Q?ZX3ae5imAcr6CVtIuhPcoMla8SjfHN5J0z5T1VFBgWfXUMpL2neq8N6IpTVO?= =?us-ascii?Q?NTdpFJT3W3I7pb09EjEA68RxM7b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ii?Q?pyAzIXdMRG3EB+6FVj2C/UhHySiNlL+MdzPOWM3al9+xyVN9dA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PSAPR06MB4486.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ndAaIKo2IM/1l9RIkDQvE951JqqeJCrdoKh81k5HvOWi+PaR7jUCU9rkZ7NL?= =?us-ascii?Q?4KxdmNWGnSLGwtu3VTnSUkqL+dEs3RbavfHDJ4rXhBQXojydHgJJef2wU/OC?= =?us-ascii?Q?3UsXRM7TvC1KPAHPyYIdJt9sLDuYW7m4+dUbR8qSv/ysYb69lEqHj/ZP4sDw?= =?us-ascii?Q?Zfb/ddWDPKZ+8zN/VdqHot6bwqJHzwnl42cgjIinkvro4kABQ8UfPvX7Y1Mt?= =?us-ascii?Q?uXyWCq3UP5QfiAqFnRB3S3MVG+iYRKEW1QGYmjmi61gi7PGVJm8pm+Ij5P/4?= =?us-ascii?Q?1Cm47TOvj6conPnqPsoBG+jKYgJ8alfdrC6GaLl4UeimkUyn+VuXO2AfE8z8?= =?us-ascii?Q?Q+YxGXt9dzZ4XEPzb/g4f1gaII/8M6/emIkYj0Q+l9oWPH/vjkMXC++qMbhY?= =?us-ascii?Q?UrwlFbTRRdkisQ5P8qrLdWvhRGk43PYevffUGMOl8HTNtTqkZ7ErWCOqwzR8?= =?us-ascii?Q?rmje4x9MqcrSQyLL6YcqxW5erm8X5crrgBpP3tnpkkGLyQs83ts/ylI8x1s0?= =?us-ascii?Q?dbALUTU4brprkNiV065/kW+5kP+Bocf6cHOGRiUnAnFwdEVfapxF185oMT65?= =?us-ascii?Q?RTD7M5idv2c+i/5ME5/JIT9NehBKohgAj8n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us-ascii?Q?8DZBWrCn1NLAvOmAKRqxtyGMHjYeylfYh80OnM+hoOPCpEVySwcIxFUKrJaC?= =?us-ascii?Q?fiNGggLaYl2FXOWOVv4fOr8i1Xgu4nb4fOjE4Yeb?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83a8a0f3-9e6b-405a-7c38-08dca07e4859 X-MS-Exchange-CrossTenant-AuthSource: PSAPR06MB4486.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2024 01:19:02.2522 (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: 1fiVaXRvCaSZoDq8T8ljENINnoUpJwAC8KoIm+ZVsWOzk039jN4ZrnQSolnT/MhtntA+7sCLU4ATbV+6oo8ttQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6889 The inode in F2FS occupies an entire 4k block. For many small files, this means they consume much more space than their actual size. Therefore, there is significant potential to better utilize the inode block space. Currently, F2FS has two features to make use of the inode block space: inline data and inline xattr. Inline data stores file which size is smaller then 3.5k in inode block. However, for slightly larger small files, there still have much waste. For example, a 5k file requires 3 blocks, totaling 12k of space, which is more than twice the size of the file itself! Additionally, the end of a file often does not occupy an entire block. If we can store the end of the file data within the inode block, we can save an entire block for the file. This is particularly important for small files. In fact, the current inline data is a special case of inline tail, and inline tail is an extension of inline data. To verify the benefits of inline tail, I have developed these preliminary codes. To make it simple, inline tail only on small files(<64k). And the layout of an inode block is 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 | I tested inline tail by copying the source code of Linux 6.9.7. The storage space was reduced by approximately 8%. Additionally, due to the reduced IO, the copy time also reduced by around 10%. Wu Bo (5): f2fs: add inline tail mount option f2fs: add inline tail disk layout definition f2fs: implement inline tail write & truncate f2fs: implement inline tail read & fiemap f2fs: set inline tail flag when create inode fs/f2fs/data.c | 61 ++++++++++++++++++++++++++++++++++++++++++++- fs/f2fs/f2fs.h | 44 ++++++++++++++++++++++++++++++++- fs/f2fs/file.c | 10 ++++++++ fs/f2fs/inline.c | 64 ++++++++++++++++++++++++++++++++---------------- fs/f2fs/inode.c | 6 +++++ fs/f2fs/namei.c | 3 +++ fs/f2fs/node.c | 6 ++++- fs/f2fs/super.c | 15 ++++++++++++ 8 files changed, 185 insertions(+), 24 deletions(-) -- 2.35.3