From patchwork Tue Jan 17 10:30:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 44637 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1679320wrn; Tue, 17 Jan 2023 02:35:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXspuVmPL6+nwVZOT24oFKyl0uEjVLPM4QT3VUQEN25ITvjYLdSgS01XAvFKQDlqin6qxSmd X-Received: by 2002:a05:6402:2937:b0:49e:2499:da0c with SMTP id ee55-20020a056402293700b0049e2499da0cmr2615491edb.17.1673951718003; Tue, 17 Jan 2023 02:35:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673951717; cv=pass; d=google.com; s=arc-20160816; b=iCoVrRolqrOAEqaQZoSd/T0tkUI85Eg0RDiHswgZflUBpOTfyJhJn7gTpOkjY8BwAf wqoumUe68wpdTNEkFNS/zeq3h9lQ3geZ5hDugXFkq4JveGLdTXguSb/9ecdx1+J44BJo eY6lsxpt/g5zBLOrleTLiPwlIGNbq3pV7n+E02LJsQMBGFUYK/LqU6M3UoUvuVXPHRHZ ixyL+rwkF9fYfRcbk6aTyiCxqFsc3wb5w3lOEja+dWF3zzMUgHLX3tInYr++7FvrNVuN NbNlnr67B+COeVr2Q2p0AlIR4HFtZ0avvhfE853LVAlDP2NHvxknVAnLfFrVVOcTnSrk 0lVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=4Xl2A1hT7mb5Bj9AkO9Ap/vQVKaTsu2J2jzKIX7YnJQ=; b=G3vQ+/+jPCnw3I6fF9WcUCF6I8CasesDz6P9ySGBYI9eHd+1XAG8WXDMsdleh30Pef IyW6teIkl5v3lMsHDJYS5qYQz6OHIRgm6HcrAa20Z3UEky8A1bS6ZDii5MmKbPVVTd+u USVz+L0BtAaqsFR4G/ue2dOZDH2Sb9TIWp1DZYfeiCbaWFVZOvOjMz7t9wZsHSy/sSSn EpIl751O28eRFx+s1v+7M/TqnZDclvk+djeNQyxX7cUOOumBqDiEeypMjgEnOphaXDuM EVucczCI/XJeYnfp0r2TrF6WoF/uovovHAGJzWuR2ycoOCEncLN4pBP6PePKuTqUM4jw sDoA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=mBjw5KEK; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r16-20020a05640251d000b004676034f552si14429807edd.45.2023.01.17.02.34.54; Tue, 17 Jan 2023 02:35:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=mBjw5KEK; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236355AbjAQKcu (ORCPT + 99 others); Tue, 17 Jan 2023 05:32:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236292AbjAQKbD (ORCPT ); Tue, 17 Jan 2023 05:31:03 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2133.outbound.protection.outlook.com [40.107.117.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31C957298 for ; Tue, 17 Jan 2023 02:30:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GzTDMHtcGqG1eVZBoidOVKHoiNvwSfZnfb2/sQp93Rq+0uQhjKZJ49VdwDxGL4EGrO/VkG7N2kzQca+aNyWAqoWiHGg1fQmKP3izPKyvVNjhjjS2Zt1+SPZgt3W3kOLm3oKpBoDhLvh1Qrca2UctYc9TIzz8FpinqVY6seFAFzwGBZOXd5qp6y8ShytF+0wkxMxezH+8n9X9xtWXUdjHNn3jurfU9vURShKivDMfEZqhboutzsJzUiSwaVE09kQAx4EdHDap0kYBFibK7XwpyhDOT1dAHqJYJqY/fMANta/xL3cOJ4S/UYyS/W+oV+DRgwURG5kAgJpzN5Q2cURTHw== 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=4Xl2A1hT7mb5Bj9AkO9Ap/vQVKaTsu2J2jzKIX7YnJQ=; b=FJ3Hw0/5tZXx3NRLSYiv2THsMnuybJdbD+hmNmVSIGhhNvEFew7GypcM/XncadfTo3cnRvuKZZOnDU4Hq2Y+aD2vQXNeYGxY9waoQxKTkOmmmrLY3+I/6ifmq9fyRAshcZqxVdSzf5PYF+S8IaAo2UxHTh5Du+2FkNWE/6PPGTvXdoVBLAY+19dr/4qCSi8MSidNjvnHKagV8RbWBeEB30bKCjN9edhaKPFp4DdmwKgF27ig2ozD6HLFZFh++x4IBhXLhpVl6xzYP76SJ9Gh5t//KUSjP6hD8F7WzTCT4v6B/ttULh4+f9sLq7GQ88WDpkOvtAPbRpESBkdUoeWtSg== 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=4Xl2A1hT7mb5Bj9AkO9Ap/vQVKaTsu2J2jzKIX7YnJQ=; b=mBjw5KEK3qT0M+5H5ymkyiXOdGK81cfavK28QOupicBWU9ZtuKog0jAMhy21dNRSF474QVHmbModBTtCr2N5zeG9l4g6z1ceRKrmOBiFe5eHjMTEla4uuOBnT1PUTItHey5xpgPYNGDdl9TpmN/u6pcsusdDy1i5XnfqUmdzet6iGOu/2J7NEzQLK1pdE3VWJkhyNWRkqLTLE0jVhxkfjZV3gS+3BC0hBQnHIjCldAEQTMGdDvCBoTN6OUd5nXmSljikDl4CByCgTO67UVoIV1wKMXlmjyD3DP/h6USt8TZpzbzCusL1Gl9ExPS5kZdexAYSRvBd3X1GAN8wLHW6Ag== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by KL1PR06MB6070.apcprd06.prod.outlook.com (2603:1096:820:c9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.9; Tue, 17 Jan 2023 10:30:52 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::3e52:d08c:ecf4:d572%5]) with mapi id 15.20.6002.012; Tue, 17 Jan 2023 10:30:52 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] f2fs: set *_data_age_threshold according to user_block_count Date: Tue, 17 Jan 2023 18:30:42 +0800 Message-Id: <20230117103042.2509-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI2P153CA0003.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::20) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR06MB6070:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a534d76-4c36-4170-f19a-08daf875e853 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GzsGntapHpXAq4FBJn8yEb6/kbJ59E6LYr4QGu5xnGGGi3F6V584WTFJSTlE+EChcMEmGnI6n4lNLbJLqzWALMETw+TSkLB6LW7RpxHby2X6fjUGtGSavJe9Azw7ymcCr32rg36EKu+QAUF2Ms8oK++K0WflQCBDYyAOA+vGUd2J9cigxbqRqVKsnVMMa+ApZDB5Xbbncavj84jw4i3db5xyihZFUI5+gg3RD7fUEhhK3wssLvjVOFwdDM5iOMOuraK5qqOnp6SrMqMQ10Y5Rcuj9RQ5KChnjq76qxqPpO/Dtpc0gckCG+eXNG336g8u9t4TfCMwx/SaHNxu98E+KXg0+2N2EhHtYUTffnrP3/H+Xrnl1MKHQ0U9vlcNW4heNM8+dFte4Bm2d9ImNF1VrXWiIoFWVlHsTgjHRpiiCBsPIBjeJTmUZj8ffmsFOiYC/acXF58ewYT2JcR2iEEinv6fbLyALqRkWmP5Bx/dVre7iaCf6t6eWmS55f1m5UgEArm2DU2Cs6NVokLop87bArQTozXPzRjq1fecQJr19rVBltimwcEI6Ypv7mtQf7pwSmtI6vo3q4o7khJ7ZwsLKZs1JmZkpv6IUkdoRGYiTjuTXn0yY16Z1ZKALuZZILeP9XTtY5LEP3PjVYSUzAuSMl4zXAuudkAoGBWOC703oGBX77/qBdBOm64EN8lYUwN9VNSTi64g9BsbEDnetQkXRg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39860400002)(376002)(136003)(366004)(346002)(451199015)(83380400001)(6486002)(6512007)(52116002)(36756003)(478600001)(186003)(38100700002)(38350700002)(2616005)(1076003)(86362001)(41300700001)(2906002)(107886003)(26005)(6506007)(6666004)(66556008)(8936002)(8676002)(66946007)(66476007)(4326008)(316002)(5660300002)(19627235002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: i+Vx+eOjZDA3X7P1mmrb+o9VSpx0plETpPvrDpxThOKVJOhortJiRb/CYyvhCMuJy1HIp2naqMRW//i13WMu3IfNa6BN8nzt4C12dV7WGIvIlrjvp3u3yJ++F11MthBO0oPURJv+mLSeZOyUC6VRydaFfx23cKLlE8rCv5fypk3wNpQHujr+rk3kg/nrwdELo+YvTKRH/1p891OHWa8Ai7ZV5nlpL3X3qu51IXgp+CJdtK+osJgqVfp2gAkqslV6+QL9nzZUVD5Dl0YUWPCOajWQxdA3Mj5wpTNnDP8/KELY8gJZn+mciVjpfQ1ZDEpW4SEHcEz62WmWPVJ1uqE5fFcvw8bjl2CZOmtGCsB/s5bfOnS4nP16Z41AtirqBq7taIYDgT9I/1No2zYj3KXX+xNvCzwUYQ3wCkU5FLWfW1nff7JIk2cCIpSjVBse3dxUpg/h4iYyVx9NY420A1oX2F+lGSgT/k1DOjG8YpNie+J1/Z/XI+h7fXbDNnFbHID5pZgHD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OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a534d76-4c36-4170-f19a-08daf875e853 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 10:30:52.0430 (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: LZZ/DjQYavl/r3ZlDyG3y0aaM4GqhmNrRUSnd4KzOaqSb3Dt4OksS1Hm/x4C4E/oiFbiY1BC4hCWZrhBRWrmwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6070 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755265596981284749?= X-GMAIL-MSGID: =?utf-8?q?1755265596981284749?= Commit 71644dff4811 ("f2fs: add block_age-based extent cache") introduce age extent cache, which experimental data is based on a 128G storage device, and hot and warm data age threshold are set to 1G and 10G respectively. But it is unreasonable to set this value to 1G or 10G by default, which varies depending on the environment. For small storage devices, some storage devices do not even have 10G. Let's change hot and warm data age threshold to 1% and 10% of user_block_count respectively. Signed-off-by: Yangtao Li --- Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++---- fs/f2fs/extent_cache.c | 2 -- fs/f2fs/f2fs.h | 9 +++++---- fs/f2fs/super.c | 2 ++ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs index 75420c242cc4..c7952f1baf59 100644 --- a/Documentation/ABI/testing/sysfs-fs-f2fs +++ b/Documentation/ABI/testing/sysfs-fs-f2fs @@ -660,15 +660,13 @@ What: /sys/fs/f2fs//hot_data_age_threshold Date: November 2022 Contact: "Ping Xiong" Description: When DATA SEPARATION is on, it controls the age threshold to indicate - the data blocks as hot. By default it was initialized as 262144 blocks - (equals to 1GB). + the data blocks as hot. By default it was initialized as 1% of user_block_count. What: /sys/fs/f2fs//warm_data_age_threshold Date: November 2022 Contact: "Ping Xiong" Description: When DATA SEPARATION is on, it controls the age threshold to indicate - the data blocks as warm. By default it was initialized as 2621440 blocks - (equals to 10GB). + the data blocks as warm. By default it was initialized as 10% of user_block_count. What: /sys/fs/f2fs//fault_rate Date: May 2016 diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c index 1daf8c88c09b..9c7e304d5660 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -1235,8 +1235,6 @@ void f2fs_init_extent_cache_info(struct f2fs_sb_info *sbi) /* initialize for block age extents */ atomic64_set(&sbi->allocated_data_blocks, 0); - sbi->hot_data_age_threshold = DEF_HOT_DATA_AGE_THRESHOLD; - sbi->warm_data_age_threshold = DEF_WARM_DATA_AGE_THRESHOLD; } int __init f2fs_create_extent_cache(void) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index f3c5f7740c1a..3b853c302a43 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -615,11 +615,12 @@ enum { #define SAME_AGE_REGION 1024 /* - * Define data block with age less than 1GB as hot data - * define data block with age less than 10GB but more than 1GB as warm data + * Define data block with age less than 1% of user_block_count as hot data + * Define data block with age less than 10% of user_block_count but more + * than 1% of user_block_count as warm data */ -#define DEF_HOT_DATA_AGE_THRESHOLD 262144 -#define DEF_WARM_DATA_AGE_THRESHOLD 2621440 +#define DEF_HOT_DATA_AGE_THRESHOLD 1 +#define DEF_WARM_DATA_AGE_THRESHOLD 10 /* extent cache type */ enum extent_type { diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 5fc83771042d..8333ea5b8ffd 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -4088,6 +4088,8 @@ static void f2fs_tuning_parameters(struct f2fs_sb_info *sbi) BIT(F2FS_IPU_HONOR_OPU_WRITE); } + sbi->hot_data_age_threshold = sbi->user_block_count * DEF_HOT_DATA_AGE_THRESHOLD / 100; + sbi->warm_data_age_threshold = sbi->user_block_count * DEF_WARM_DATA_AGE_THRESHOLD / 100; sbi->readdir_ra = true; }