From patchwork Wed Sep 11 03:57:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Bo X-Patchwork-Id: 13799646 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 20242EDE997 for ; Wed, 11 Sep 2024 03:43:39 +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 1soEGY-0005iM-5y; Wed, 11 Sep 2024 03:43:38 +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 1soEGU-0005iD-73 for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:34 +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 :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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Iawt2//ESGXq45KJYLKbV05HdYnfgHs31un0npuP4rM=; b=NvGy7DdCDNli/2chwTyq7y1x68 PVI5iURhV28gNwJ8P1+7hlOwFqV5ZAHG9Xp7YhxI5DDTka0bGaa6QGOB1O34cWEnf5zxQ9LfOeHdw 1QfItZ9389ZRF2CxWztZ5l6rzESVyJrMiZjzWOHqGucdFKTjf9QtidxGHp5tTfPdDjes=; 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: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=Iawt2//ESGXq45KJYLKbV05HdYnfgHs31un0npuP4rM=; b=l EaRW0vzQBeErESMGtxPX0tqb76VYnVtS9e03hCkdwM0aYCkShybE7SrE3Av5kzPC28wl41jsLY8hS GMpx9q0Nk+rsCpLVdHuVtmdbQW1gBWqsv/tS8XkZDvqXVt9rH24iPN68tUc3Gq068wiL02Pw7tfbC J5MWykQ/3iUKdThY=; Received: from mail-tyzapc01on2058.outbound.protection.outlook.com ([40.107.117.58] 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 1soEGS-0000Nd-9p for linux-f2fs-devel@lists.sourceforge.net; Wed, 11 Sep 2024 03:43:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hzgwJQwpgyPtjIg3ZPNXE/Ur7W+beb7hN/1UpREGqFsfVQ0MEVLCdRhwhS8DO0+g40ZaRS/nfIn6dVbsTQorxaYUyAeJL2uTKWe498MZeB+fdVuTqGglKYDGOR98Efo3UtsjmwExNw5LYrBxXSnMHa+Rk0V9gCNH/yGPyPlF/xoQ9u8wPwFcFGG2FaLhmeODWfL1W6Fu4tV/rHpPzbEN8BbovblZeg/q6NOJZX6rAWXaAQ14ThC0jcz+U7ZtREFs5WRtwuwO1YvWhc5k9a1ppmdv5FUmeJJ7lhYLonG6bs+CTEuUIJ1+BUGan8qz56es0OYw+v++l2ELkp74gXTgrg== 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=Iawt2//ESGXq45KJYLKbV05HdYnfgHs31un0npuP4rM=; b=iwRIdxHLJR1wF+X7va20T4V5W9y5d2VftpjOnlTt6uZ/v2nGLiGFSzVFrNwmHO/eeiJRaQWsSmP8yDrbo1sDqG3VCQKeGnSXwEKv7q2am8HV7w6TtFNNH8hrb8W/Br24nYB5h4kd+MZ37tWkK3e5ji+J52djSFoVTUVpVQdOaOVxlxChltYLr/oPAkwkksWZAPdnOC52K7LQWYLrVf6PXwPGo2ILVEJes/Gp7rL6tRTeDO6Q7NW2UvmatbmADVdSJwsiV67JaY4wq/vLmH6ORiXjaZ4T9nktQk7RaN1uKkQ8f5hzHkKNDc7dLL4TsPK0KfC6WdWuWh3SzsuZZ4i1RA== 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=Iawt2//ESGXq45KJYLKbV05HdYnfgHs31un0npuP4rM=; b=CMY+o2vpGJTVuf/RjZHBSHoxpGyp1ldWzYo3BL1i3Md8/KOTPHspX+Fcb+3KjzYaFMSQgLMXrbVqgJ99X1Aj2xiki43ZxNLiAyY+nPCPfdnVjFdsrrxlcFo+spXEz6uqdJiUg7UOf1sGfE6SxNvG1Um1P6rmW2c0V8gyUDoiTXlzMD4FOBm6NZPdmUENeHRf0dF5NJbFxqWso8Y3PNm19d+7HkZuSw5H6ByoQ8GZvMEXq+jMHlaOLRK5TBjqPxpUUpjIpoSo56AoaUl0HpzpVcRoUwDYqyrLDuUosmSixE17oiq4+CBpEuWfVHw84cFh0wN5icWI+ccvvPK9rUZfmg== 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 JH0PR06MB6478.apcprd06.prod.outlook.com (2603:1096:990:38::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.23; Wed, 11 Sep 2024 03:43:19 +0000 Received: from PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5]) by PSAPR06MB4486.apcprd06.prod.outlook.com ([fe80::43cb:1332:afef:81e5%4]) with mapi id 15.20.7962.016; Wed, 11 Sep 2024 03:43:18 +0000 To: linux-kernel@vger.kernel.org Date: Tue, 10 Sep 2024 21:57:13 -0600 Message-Id: X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: SI2PR02CA0049.apcprd02.prod.outlook.com (2603:1096:4:196::7) To PSAPR06MB4486.apcprd06.prod.outlook.com (2603:1096:301:89::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PSAPR06MB4486:EE_|JH0PR06MB6478:EE_ X-MS-Office365-Filtering-Correlation-Id: 00b4e2fb-076b-4f1a-90b4-08dcd213dfe3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|1800799024|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 7bIaytHj7fXliI4+fU9SxrICSWpDoxzV3Bz58SXiH5Zwm7P9hC2Jk11vr/x6mt9L+bnONX3tkDAQJUsyjDyHgpsgQ1LjA5COqDigrR2B2YzzubfVqx1siA8/pKBNx3VO2D/8t1yFoce7hXbF4TXA7IynyBOWPV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TfX+nZxbUW6tGlnvysmEKevI+hzKHtlaV6KUnwvfgyUk4qnSc0WXmbfGJwxqVcP3rUnCkNMVYchV1l5nlWOeXbWbyXF1TxSh7LPY8HQh82pO3unnGb1MU9tEUN3gQMN+0XSZ6EH6TOqlq14hSgIQo4Qv+dzRWcRxjKUcgLDmNvqRf6qmg7ji95WLMpAIBrOA== 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)(376014)(1800799024)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +zY71GQIKEpwCi77oOQjq2sxjhctuuOSWdfPahM0i5Oe51IPICiHIgWXZH4R3ohkZ1Gyq4Ues8tXxc4gCg/g3wg7boB0g03oTJXHfin/yEXx0sefC498MaqchhWqurg1Sf2IGkTf3j5+8W4uIJQWKfgNsrJmW1HN9ySOyatWg1lc4o5hd/okkPiYgWKL1JaDwRMpHxlPJTV/pBjeaK2ckeRrMkB37hXCnMqyxQV4ryBKbcEcHTSPYn8gWiwYHmCXUZHufiMsRZ7Zqfh/EWePQcdQ1urlCYRGDZoYsghfx9J4KDvpCSP/r1Z7Emqqom62tfIE3X+TVve+WnK5iCC3iamruEhoZdEJiZS1AvlrY8jH4LTBimkZhtjZCk6ZfEyq1H3GGjmYlBI/E32XdNBdcDZjb1mgLcIxp7xSkQ1ZgTGjQjhcDjHP07GTKAlwC3eLyzGDymeLAhOynXE6GDQ2LeIQBmK4tPw6cwBpNucjpe+wHw1RfiVHpJzNvB81JNQ5BsELdAzfC5ZKapcvlbpEwM6703HJASMu+o0cz5epekCHbJ7ix3RGCr6olc4cNs/hOZQ0Ml3XC2fcB1OBT3jNu+bDfCOgsXlam4hewyjbxYbvWpI/y6dwrFrM9IYkvzmBVZp+RVpOo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prd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2024 03:43:18.4361 (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: 4koAWgF2SSDieZmVqlRIUu2FwfYaQRxoQIdbxWmZPfN6xPnN332x1WKV1XbOB2JrFgiOW2bUiH1bYHhnA/65tA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6478 X-Headers-End: 1soEGS-0000Nd-9p Subject: [f2fs-dev] [PATCH v2 00/13] f2fs: introduce 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 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 make it simple, inline tail only on small files(<64k). And for larger files, inline tails don't provide any significant benefits. The layout of an inline tail 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 | F2fs-tools to support inline tail: https://lore.kernel.org/linux-f2fs-devel/20240903075931.3339584-1-bo.wu@vivo.com 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%. This patch series has been tested with xfstests by running 'kvm-xfstests -c f2fs -g quick' both with and without the patch; no regressions were observed. The test result is: f2fs/default: 583 tests, 6 failures, 213 skipped, 650 seconds Failures: generic/050 generic/064 generic/250 generic/252 generic/563 generic/735 Totals: 607 tests, 213 skipped, 30 failures, 0 errors, 579s --- v2: - fix ARCH=arc build warning --- Wu Bo (13): 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 f2fs: fix address info has been truncated f2fs: support seek for inline tail f2fs: convert inline tail when inode expand f2fs: fix data loss during inline tail writing f2fs: avoid inlining quota files f2fs: fix inline tail data lost f2fs: convert inline tails to avoid potential issues f2fs: implement inline tail forward recovery fs/f2fs/data.c | 93 +++++++++++++++++++++++++- fs/f2fs/f2fs.h | 46 ++++++++++++- fs/f2fs/file.c | 85 +++++++++++++++++++++++- fs/f2fs/inline.c | 159 +++++++++++++++++++++++++++++++++++++++------ fs/f2fs/inode.c | 6 ++ fs/f2fs/namei.c | 3 + fs/f2fs/node.c | 6 +- fs/f2fs/recovery.c | 9 ++- fs/f2fs/super.c | 25 +++++++ fs/f2fs/verity.c | 4 ++ 10 files changed, 409 insertions(+), 27 deletions(-) base-commit: 67784a74e258a467225f0e68335df77acd67b7ab