From patchwork Wed Dec 21 19:19:32 2022 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: 35493 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3702624wrn; Wed, 21 Dec 2022 11:24:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXtyPgWLT0aDjsrzqCAgaMpu/0IRAhkGXUEYb8rQA5ZThIWCTasz1zqROyelEIrwR4rEFEJg X-Received: by 2002:a17:90b:38ca:b0:218:d638:1628 with SMTP id nn10-20020a17090b38ca00b00218d6381628mr2764396pjb.42.1671650685072; Wed, 21 Dec 2022 11:24:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671650685; cv=pass; d=google.com; s=arc-20160816; b=HW6NCze7fTdY+FqaVoex8mS0r3WfGPtrRu6t8gLT7KrnSv/u72LMj2O4iPu2XDvUur p/vk0crXwR1ZAiUi7Sw+FrqBAkfXOT2tkFRqTgcxvc6diIKFSxcKlsdtS/YKobSlrTw2 aLHfXwDXawglg8yUb4yhpx+adrTJstRzwWtnEMgX2amnWdxv5cnO6PmtKacnwdGZ+ly8 ddCmzMqfTPxHw7b8WtTz7FWVr120J3Q7g59z1/vZrZ88upY5wB76lPHs7C49NcVC1lfa fEngVy6tss4sG4RsJpaaV9Lj+UCtBdg9WLdHDJ53tGqj9b7L6TXzXKNesRTW7Da8mVFi 75mw== 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=1kVl1rPlYnO7eXiagYx6LXP8jB+OttrZPL1IWnz2YB0=; b=nktQyeZ1UZ2fq69apV1edh79Q+OhpnxM58p4SVdhVuLWT7AY173Sqx8K1YqtgpdJ+/ YrkCMfMMr4GvzQXfgD6fJ5rPrDmWCxFib0QRUzLNzatY61+e3k46ERq4UaZ32xuPMKkA QXfh94/q4kk6XPyQ6XqWrqGB4AtAdsreQ/sdFZArcpOEuMSEXw3li31NXhEe2F+J8Xu1 KQgRPwJYkmzcBID1J2WBWNSZOqSZTio7xb/Bn6w5F7npmMlkDt2sFJ4OU4uo3E1JjeXM HnjobbmduGu4T+tzqdroT5dePFgnmLetNspfillw9Fu28regGIA5PUIBsj2ICOL5ir2w yKRg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=UzLX1fZW; 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 w4-20020a17090abc0400b00223facc5d2csi2247255pjr.162.2022.12.21.11.24.32; Wed, 21 Dec 2022 11:24:45 -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=UzLX1fZW; 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 S234296AbiLUTT5 (ORCPT + 99 others); Wed, 21 Dec 2022 14:19:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230045AbiLUTTy (ORCPT ); Wed, 21 Dec 2022 14:19:54 -0500 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2113.outbound.protection.outlook.com [40.107.255.113]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3FDC24F39 for ; Wed, 21 Dec 2022 11:19:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jB4bVNDeZd3lFxoapPWW7HPrzGT1jf9TEr5MukDOszaTyAj7gqWtUsnckACU4k9MZS9llT1Nn6ByBkAP5Tyd8at4TMDUDlTzSBhg6WPxJAZtpJLgi7sEoxq3TsXJvryl0/cMwHs/J1hl+8271SOgkZ2s8G/FRVqfbZ2Omzwsx0cv6MoLHejEg7E18ugmrm/qY2EO0YoMsVjlZcJxt+Ucjh0WMJrwiLPllkRHL1mpviq44mesLAbWaOfxIJ3Sw6jTQ//zRobqzuOokA402rS4i5ZD+x4SSw0hAileNH4VtGB8VdAQJuR8AyGhC8INRCshuIimtn0z31qVZGIU4bubEg== 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=1kVl1rPlYnO7eXiagYx6LXP8jB+OttrZPL1IWnz2YB0=; b=OXm9FvwsQUs4zOJFK3AxTtjWyzDW79jW+ebkLWPfyrDr2NLNMJMdD5QUFKXgnOkB14z/HgtIN+gItkReHVLTHFjmIrx/AbV6BInYc6LffTLh4sHb6kOnZ80+HdrJAGFdnHapAiOqQpseyDOeVIlT/YBFjYyv/SldOvZlunJ/uoLNrVzHmhNpiM8yaypuGnUnJ99VFoMjwvft2zbwQw/oBOrfVcpVYaTSHB2LRsNJ8J4cc/aReY8Kxs5L14DEEZxRPhijQKYKwRAmhM1v5H0BimRqXwHZ32INiv0O22E8S9Yt0Q+fSmQafE2FLLiJdhUv0UqjzCfgXJ72+ZQqFZa8dw== 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=1kVl1rPlYnO7eXiagYx6LXP8jB+OttrZPL1IWnz2YB0=; b=UzLX1fZWdHFt11fYocUn9rxEFsgWMsB/anaYOJOvZtKh3jmzisCEBDC8P8c3kFBaCjo1cij3go4DjhIXhfcAhr07YqrSOnVDz31rUjx83pOszzGRtQ/tOcJ3w6sqobVtS8jyjf6SG3Xn+zGnagw9/Qz1bWgnJUvhWoOgKQa2IaAZp1Xb8bxInF14WIZ5e06R5tNInIn234Me99lxgXmAP1FW93TCgGCc+xqDbLoFe8GniLgoNgY6aFSCMdMZ0ts7WUGMZgP6jsga0OOcM3y2aiHewFkMWuivsrTNSPRII0dDgLH0yzQxZu7uC7gai69iZVagiHYzFbrPcovLiCvYNg== 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 SI2PR06MB4106.apcprd06.prod.outlook.com (2603:1096:4:f7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 19:19:47 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::ef03:cbfb:f8ef:d88b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::ef03:cbfb:f8ef:d88b%9]) with mapi id 15.20.5924.016; Wed, 21 Dec 2022 19:19:47 +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 1/2] f2fs: support accounting iostat count and avg_bytes Date: Thu, 22 Dec 2022 03:19:32 +0800 Message-Id: <20221221191932.17161-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SG2PR02CA0067.apcprd02.prod.outlook.com (2603:1096:4:54::31) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SI2PR06MB4106:EE_ X-MS-Office365-Filtering-Correlation-Id: cbd0548f-fc7b-4cfe-9143-08dae38852ef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jr9HPWW/QhvVbxKFU6zwJjYzVEGHHAzCwrCbCN2rVv8LaRNUjc2ch9e6ugeDYEvrFcSGpL1lSoHGZ7y77oge6D9L8GKLH2BJpHeL3nqh5XJ92iMWihsivt9lzZrUBsUpeTyL33e6Dx3LUGv0sNShk100gnlCNhUsThARdpM7YfqjVGkbvGx2+ZQt9UuhgqHx4kDm1hOE2P7hJWgIgYUS6cGqYN0oL3trbnqvL5rsri42tmx1/4/bN82U7J+zvdT/RNcFPIKJEkX2PN8y9tPudKoKfd7lcY9u4lPFgkRK9NN8FdFOurr9Gqx+exuoLFwrWwgtjjBOJz9qwd+6DSeB0TjeaU8rdmaD2E6exVqX2QNhhyJ8l9OLgK6Vh6FWBLGkwN7Ya4pSogyxc1MXmKefG+/IY/LcdKZ0oM2JWAzmXX3tJM6ORX5bm0meeNa0VzH+eoBmXaMNiIpXRpOWeX6UVuhsL48CB+LjsjDV/NkkASIp3hLOrPxCMS0F5oExqIO3pHItUDCfTeJBBv0ha9RRtaF7BMooT1WlLgwrpora5mHWft7EMvPuaZAPQZiQt2V4FXMnQJDKBLCdUW9/G5P3cKbmEoT6a6+MTjxpM258wx3lChI+8nyeK76UY+dIdGXnlEZGnYBZZvm45g06NofiUn/MCdjZ+Uw/IJk0HvLlaxeZg7o9c6hU0vMy9bqQE0xT 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)(39860400002)(136003)(376002)(396003)(346002)(366004)(451199015)(36756003)(26005)(186003)(6512007)(6506007)(107886003)(8936002)(6486002)(30864003)(6666004)(5660300002)(52116002)(83380400001)(316002)(2616005)(66476007)(1076003)(8676002)(4326008)(66946007)(86362001)(66556008)(41300700001)(2906002)(15650500001)(38350700002)(478600001)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XFQDBUlcSIJboc+OSgyNgqH9GDooGVHJCQ8Yrrt8WEQXWY+BC6S/kMtkSDMyQpIV1Fx6tVKYLKbUy9lArFlXqFBO2dhZzmooIgi6QUCYCTvRbEGfiszlESmu6/00hOlALab7zS8+rsZoMCoaClt+IqTnVS9coPLMx8guoC+tUOhBu3oJk6xbmS5X+iJMY0P/LQW/S0ZD9Es3F47/Lf4+UYcYCpWpbWNbn/vUM+XfmaFeyzyGmYs01jFHVsTYQCsKZa4l5kF8/Qv8l0vc8W4xl1zX+rRt8+5xrObvB9zH0Cbv8VOgHCoJX7/tPh0d1EJoeu/c/Ni8BRHumMUKmdRcP+5LPmJS4ydJ64qT+RozfoPrEgjTCgCLL5Frujz6qf1Qsm6N6pM69ekxpDp0gZeRAzWFMTomMB0C1kIsFk59KVnL1+DSXuye2FXRvEXE0IfgFjagiNDR23cHMF+bN2cUmCB1P0OXPhRMS3VfBN4QY93VXUqbWueTuo0oWcrnERRGGQXNyRCd2BnxfKHfUfs5W4XN/HmfasUdmyvxBl+el+Tql5SFQdSkg/RXvHVcOVjiVafzEHI6qOFLPOHB88EAsm3SRFQhPMvXcZ0NhcfyjjRq4yEbVykkE8DvffI1lAVWRmr/li6CA035jjr4iTv6Edh3W2F43ozjlKw8cuTNsubpr6Dlah0ARdnU0TJNpCuleJJtR+BERIYdhknxdHiW3AtCFAyCs2d89kKkXEZ4Sf5KEs69zUYozcS6Vr8tk/3NnT9PqnnPR4l5/URGIZzWM+J3qvvDuEVCJ4VusBD7sOiJExzQeyC0MnGZIEyKjS9srYpqrxAB5GW30krOn59Laj+VxVmF/J51T/vfiq7TptszdzRVAY9xJ/wpmimdPDy+qghh3B6WXI6cSGZDHKi0h3Uf/Mk+njFs2zi8I8N3cns0iUR0xPLWjslQJDDEuyw7FGp+jAgxdoJcIfqZJU+UtxqS3fT7W7wBG1uRNqBo5FxplMpdxkMarNVdsrOI2h0qAK+cBHFT1RFpF5JZlEZ8LIs6ndPIslIXa9wB2LG0NfJ/RH/1BtJ9OHT1YwoE7nOx8SHAC38MBxSXabLZPmTT+hnd4lawhAYLsWqLTh6XovvIYYnMX3xCKE0vk4NXGSvu2yvuquYglu6zi4LjIa87XfpQl80UVj3ayQn3Cg10K55kVuH9PuTZA2BKEr6dfNgZh0alsQhG1WJLdmq/lSW6zo1uBOZyv2/BvGLTeRXYGtU5HmTNvV+rxsA1BPyJCa79NWoHJvI+WZSIGlrnRYbzBy4oWGKn2beZhuI1l5byvNqcYgIJT78rRaGNOGiALrmF8naT3ONCPzKXb1eat72NlHQeu7wfSQ352SpcUzT8BG8/qT3AlB8Eae5Q3+VtOVtT1YjErJwtpF0zN2mdYBCcx+eZsOC/QZfiz5OCSPXLWK1sEtRhc6rjNy3Pf6IKigUngiUsfT42H0W55uuDbS66rC5esgG1OHQSti0Bc5y0PMasv/tzJWlMAR8owfM3NAehtzHvvhfYgsaU39AxUEyoTgH2tjHE/9cauATFXT0NOsEocQ6HXCkWVbzshcKOGklR X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: cbd0548f-fc7b-4cfe-9143-08dae38852ef X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 19:19:47.4866 (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: V08WwwWsh2quEKlnF1Fl3FZRlygBJMD+nwX9jmMrjgs39cKaAdDp4SObfpqjZeIZZty1Zs3Ju7yU82UZaQr3dQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB4106 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?1752852788995952504?= X-GMAIL-MSGID: =?utf-8?q?1752852788995952504?= Previously, we supported to account iostat io_bytes, in this patch, it adds to account iostat count and avg_bytes: time: 1671648667 io_bytes count avg_bytes [WRITE] app buffered data: 31 2 15 Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h | 1 + fs/f2fs/iostat.c | 184 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 126 insertions(+), 59 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e8953c3dc81a..b116c778fce6 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1864,6 +1864,7 @@ struct f2fs_sb_info { #ifdef CONFIG_F2FS_IOSTAT /* For app/fs IO statistics */ spinlock_t iostat_lock; + unsigned long long iostat_count[NR_IO_TYPE]; unsigned long long rw_iostat[NR_IO_TYPE]; unsigned long long prev_rw_iostat[NR_IO_TYPE]; bool iostat_enable; diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c index 3166a8939ed4..3d4503fef183 100644 --- a/fs/f2fs/iostat.c +++ b/fs/f2fs/iostat.c @@ -18,6 +18,13 @@ static struct kmem_cache *bio_iostat_ctx_cache; static mempool_t *bio_iostat_ctx_pool; +static inline unsigned long long iostat_get_avg_bytes(struct f2fs_sb_info *sbi, + enum iostat_type type) +{ + return sbi->iostat_count[type] ? div64_u64(sbi->rw_iostat[type], + sbi->iostat_count[type]) : 0; +} + int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset) { struct super_block *sb = seq->private; @@ -28,69 +35,121 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset) return 0; seq_printf(seq, "time: %-16llu\n", now); + seq_printf(seq, "\t\t\t%-16s %-16s %-16s\n", + "io_bytes", "count", "avg_bytes"); /* print app write IOs */ seq_puts(seq, "[WRITE]\n"); - seq_printf(seq, "app buffered data: %-16llu\n", - sbi->rw_iostat[APP_BUFFERED_IO]); - seq_printf(seq, "app direct data: %-16llu\n", - sbi->rw_iostat[APP_DIRECT_IO]); - seq_printf(seq, "app mapped data: %-16llu\n", - sbi->rw_iostat[APP_MAPPED_IO]); - seq_printf(seq, "app buffered cdata: %-16llu\n", - sbi->rw_iostat[APP_BUFFERED_CDATA_IO]); - seq_printf(seq, "app mapped cdata: %-16llu\n", - sbi->rw_iostat[APP_MAPPED_CDATA_IO]); + seq_printf(seq, "app buffered data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_BUFFERED_IO], + sbi->iostat_count[APP_BUFFERED_IO], + iostat_get_avg_bytes(sbi, APP_BUFFERED_IO)); + seq_printf(seq, "app direct data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_DIRECT_IO], + sbi->iostat_count[APP_DIRECT_IO], + iostat_get_avg_bytes(sbi, APP_DIRECT_IO)); + seq_printf(seq, "app mapped data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_MAPPED_IO], + sbi->iostat_count[APP_MAPPED_IO], + iostat_get_avg_bytes(sbi, APP_MAPPED_IO)); + seq_printf(seq, "app buffered cdata: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_BUFFERED_CDATA_IO], + sbi->iostat_count[APP_BUFFERED_CDATA_IO], + iostat_get_avg_bytes(sbi, APP_BUFFERED_CDATA_IO)); + seq_printf(seq, "app mapped cdata: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_MAPPED_CDATA_IO], + sbi->iostat_count[APP_MAPPED_CDATA_IO], + iostat_get_avg_bytes(sbi, APP_MAPPED_CDATA_IO)); /* print fs write IOs */ - seq_printf(seq, "fs data: %-16llu\n", - sbi->rw_iostat[FS_DATA_IO]); - seq_printf(seq, "fs cdata: %-16llu\n", - sbi->rw_iostat[FS_CDATA_IO]); - seq_printf(seq, "fs node: %-16llu\n", - sbi->rw_iostat[FS_NODE_IO]); - seq_printf(seq, "fs meta: %-16llu\n", - sbi->rw_iostat[FS_META_IO]); - seq_printf(seq, "fs gc data: %-16llu\n", - sbi->rw_iostat[FS_GC_DATA_IO]); - seq_printf(seq, "fs gc node: %-16llu\n", - sbi->rw_iostat[FS_GC_NODE_IO]); - seq_printf(seq, "fs cp data: %-16llu\n", - sbi->rw_iostat[FS_CP_DATA_IO]); - seq_printf(seq, "fs cp node: %-16llu\n", - sbi->rw_iostat[FS_CP_NODE_IO]); - seq_printf(seq, "fs cp meta: %-16llu\n", - sbi->rw_iostat[FS_CP_META_IO]); + seq_printf(seq, "fs data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_DATA_IO], + sbi->iostat_count[FS_DATA_IO], + iostat_get_avg_bytes(sbi, FS_DATA_IO)); + seq_printf(seq, "fs cdata: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_CDATA_IO], + sbi->iostat_count[FS_CDATA_IO], + iostat_get_avg_bytes(sbi, FS_CDATA_IO)); + seq_printf(seq, "fs node: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_NODE_IO], + sbi->iostat_count[FS_NODE_IO], + iostat_get_avg_bytes(sbi, FS_NODE_IO)); + seq_printf(seq, "fs meta: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_META_IO], + sbi->iostat_count[FS_META_IO], + iostat_get_avg_bytes(sbi, FS_META_IO)); + seq_printf(seq, "fs gc data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_GC_DATA_IO], + sbi->iostat_count[FS_GC_DATA_IO], + iostat_get_avg_bytes(sbi, FS_GC_DATA_IO)); + seq_printf(seq, "fs gc node: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_GC_NODE_IO], + sbi->iostat_count[FS_GC_NODE_IO], + iostat_get_avg_bytes(sbi, FS_GC_NODE_IO)); + seq_printf(seq, "fs cp data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_CP_DATA_IO], + sbi->iostat_count[FS_CP_DATA_IO], + iostat_get_avg_bytes(sbi, FS_CP_DATA_IO)); + seq_printf(seq, "fs cp node: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_CP_NODE_IO], + sbi->iostat_count[FS_CP_NODE_IO], + iostat_get_avg_bytes(sbi, FS_CP_NODE_IO)); + seq_printf(seq, "fs cp meta: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_CP_META_IO], + sbi->iostat_count[FS_CP_META_IO], + iostat_get_avg_bytes(sbi, FS_CP_META_IO)); /* print app read IOs */ seq_puts(seq, "[READ]\n"); - seq_printf(seq, "app buffered data: %-16llu\n", - sbi->rw_iostat[APP_BUFFERED_READ_IO]); - seq_printf(seq, "app direct data: %-16llu\n", - sbi->rw_iostat[APP_DIRECT_READ_IO]); - seq_printf(seq, "app mapped data: %-16llu\n", - sbi->rw_iostat[APP_MAPPED_READ_IO]); - seq_printf(seq, "app buffered cdata: %-16llu\n", - sbi->rw_iostat[APP_BUFFERED_CDATA_READ_IO]); - seq_printf(seq, "app mapped cdata: %-16llu\n", - sbi->rw_iostat[APP_MAPPED_CDATA_READ_IO]); + seq_printf(seq, "app buffered data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_BUFFERED_READ_IO], + sbi->iostat_count[APP_BUFFERED_READ_IO], + iostat_get_avg_bytes(sbi, APP_BUFFERED_READ_IO)); + seq_printf(seq, "app direct data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_DIRECT_READ_IO], + sbi->iostat_count[APP_DIRECT_READ_IO], + iostat_get_avg_bytes(sbi, APP_DIRECT_READ_IO)); + seq_printf(seq, "app mapped data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_MAPPED_READ_IO], + sbi->iostat_count[APP_MAPPED_READ_IO], + iostat_get_avg_bytes(sbi, APP_MAPPED_READ_IO)); + seq_printf(seq, "app buffered cdata: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_BUFFERED_CDATA_READ_IO], + sbi->iostat_count[APP_BUFFERED_CDATA_READ_IO], + iostat_get_avg_bytes(sbi, APP_BUFFERED_CDATA_READ_IO)); + seq_printf(seq, "app mapped cdata: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[APP_MAPPED_CDATA_READ_IO], + sbi->iostat_count[APP_MAPPED_CDATA_READ_IO], + iostat_get_avg_bytes(sbi, APP_MAPPED_CDATA_READ_IO)); /* print fs read IOs */ - seq_printf(seq, "fs data: %-16llu\n", - sbi->rw_iostat[FS_DATA_READ_IO]); - seq_printf(seq, "fs gc data: %-16llu\n", - sbi->rw_iostat[FS_GDATA_READ_IO]); - seq_printf(seq, "fs cdata: %-16llu\n", - sbi->rw_iostat[FS_CDATA_READ_IO]); - seq_printf(seq, "fs node: %-16llu\n", - sbi->rw_iostat[FS_NODE_READ_IO]); - seq_printf(seq, "fs meta: %-16llu\n", - sbi->rw_iostat[FS_META_READ_IO]); + seq_printf(seq, "fs data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_DATA_READ_IO], + sbi->iostat_count[FS_DATA_READ_IO], + iostat_get_avg_bytes(sbi, FS_DATA_READ_IO)); + seq_printf(seq, "fs gc data: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_GDATA_READ_IO], + sbi->iostat_count[FS_GDATA_READ_IO], + iostat_get_avg_bytes(sbi, FS_GDATA_READ_IO)); + seq_printf(seq, "fs cdata: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_CDATA_READ_IO], + sbi->iostat_count[FS_CDATA_READ_IO], + iostat_get_avg_bytes(sbi, FS_CDATA_READ_IO)); + seq_printf(seq, "fs node: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_NODE_READ_IO], + sbi->iostat_count[FS_NODE_READ_IO], + iostat_get_avg_bytes(sbi, FS_NODE_READ_IO)); + seq_printf(seq, "fs meta: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_META_READ_IO], + sbi->iostat_count[FS_META_READ_IO], + iostat_get_avg_bytes(sbi, FS_META_READ_IO)); /* print other IOs */ seq_puts(seq, "[OTHER]\n"); - seq_printf(seq, "fs discard: %-16llu\n", - sbi->rw_iostat[FS_DISCARD]); + seq_printf(seq, "fs discard: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_DISCARD], + sbi->iostat_count[FS_DISCARD], + iostat_get_avg_bytes(sbi, FS_DISCARD)); return 0; } @@ -169,6 +228,13 @@ void f2fs_reset_iostat(struct f2fs_sb_info *sbi) spin_unlock_irq(&sbi->iostat_lat_lock); } +static inline void __f2fs_update_iostat(struct f2fs_sb_info *sbi, + enum iostat_type type, unsigned long long io_bytes) +{ + sbi->rw_iostat[type] += io_bytes; + sbi->iostat_count[type]++; +} + void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode, enum iostat_type type, unsigned long long io_bytes) { @@ -178,33 +244,33 @@ void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode, return; spin_lock_irqsave(&sbi->iostat_lock, flags); - sbi->rw_iostat[type] += io_bytes; + __f2fs_update_iostat(sbi, type, io_bytes); if (type == APP_BUFFERED_IO || type == APP_DIRECT_IO) - sbi->rw_iostat[APP_WRITE_IO] += io_bytes; + __f2fs_update_iostat(sbi, APP_WRITE_IO, io_bytes); if (type == APP_BUFFERED_READ_IO || type == APP_DIRECT_READ_IO) - sbi->rw_iostat[APP_READ_IO] += io_bytes; + __f2fs_update_iostat(sbi, APP_READ_IO, io_bytes); #ifdef CONFIG_F2FS_FS_COMPRESSION if (inode && f2fs_compressed_file(inode)) { if (type == APP_BUFFERED_IO) - sbi->rw_iostat[APP_BUFFERED_CDATA_IO] += io_bytes; + __f2fs_update_iostat(sbi, APP_BUFFERED_CDATA_IO, io_bytes); if (type == APP_BUFFERED_READ_IO) - sbi->rw_iostat[APP_BUFFERED_CDATA_READ_IO] += io_bytes; + __f2fs_update_iostat(sbi, APP_BUFFERED_CDATA_READ_IO, io_bytes); if (type == APP_MAPPED_READ_IO) - sbi->rw_iostat[APP_MAPPED_CDATA_READ_IO] += io_bytes; + __f2fs_update_iostat(sbi, APP_MAPPED_CDATA_READ_IO, io_bytes); if (type == APP_MAPPED_IO) - sbi->rw_iostat[APP_MAPPED_CDATA_IO] += io_bytes; + __f2fs_update_iostat(sbi, APP_MAPPED_CDATA_IO, io_bytes); if (type == FS_DATA_READ_IO) - sbi->rw_iostat[FS_CDATA_READ_IO] += io_bytes; + __f2fs_update_iostat(sbi, FS_CDATA_READ_IO, io_bytes); if (type == FS_DATA_IO) - sbi->rw_iostat[FS_CDATA_IO] += io_bytes; + __f2fs_update_iostat(sbi, FS_CDATA_IO, io_bytes); } #endif From patchwork Wed Dec 21 19:20:01 2022 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: 35495 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3707334wrn; Wed, 21 Dec 2022 11:36:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXu5EbBGc1/RQhiuS5m8QB+vWIVdPCzYMzKmG0Turx4NviOAzGwxT+qzWOj34DYcUqloKJ2y X-Received: by 2002:a17:90b:3941:b0:219:b04c:db39 with SMTP id oe1-20020a17090b394100b00219b04cdb39mr3295272pjb.4.1671651416467; Wed, 21 Dec 2022 11:36:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671651416; cv=pass; d=google.com; s=arc-20160816; b=af/iibj3xBLrXoxYe7Cpp90pV5m8MTstwLK/hTmHCzI0kXIKyeJglIg21YOpXSyExl zmyNX4Ri1bq9vNGP9/FfuiZIg7R20kNeWOGMq7ld/o3ox+TZ24RjJkbqqfaYW5S9kW4S 99qkel1kfgH+6AMXvxEvFkgHsYDx69VBIc/cM/Q9KzDjkO9KxDRFxonN95QlN3m2Kcpg W/anOShJRKfdXIZkTbVVBQDr8FgFIEn2+vQrTsdo8r0RB496mv02VFmDz2vuzxgHh6T6 JujBJO1HA6EWX1bSBNs0SfhpC3YXmaq5TP5vJzXSYPCOMmufPSiU0elsiO+fJ0xr1DiA YjtA== 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=manLWJpBlusLkA5eGLaVDFvtlKx1XkR7w9uvnNCgAlk=; b=a3Pow7iEOj93gXXg3N5wdSd9O8ZuJ+5CUsOdUGmopsO/SMMMReUMWDo++7kTNTVI3U vl1N5D8bUA7S4BV6BrHr9xaDluFUQfTb4Kaa9QCTjgNrD3NYxF559URR1Cdu+P/zagUy g30j09sHTkv1CUwiX/yz54dS3awjkMWryXekgpRYrRNQG1vCvpMecrGTRKfDlInL+IWk ai2sk+Ujf6ytr8ldItd7S3yRP/qFY+mG9K/DkmLNyfANJaEqXV1uRd4BbCJ0x62IeZ2c eOUwpEVM0eFbdZcu38mt3V51jwEDPF+LZ2kHNFIssQ1Haf57/ZSlBNnnoZjDVXxNKS7Q 5xBQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=Da0Y5g78; 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 rj4-20020a17090b3e8400b002198e312fe4si2550034pjb.30.2022.12.21.11.36.43; Wed, 21 Dec 2022 11:36:56 -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=Da0Y5g78; 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 S234664AbiLUTUT (ORCPT + 99 others); Wed, 21 Dec 2022 14:20:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233664AbiLUTUR (ORCPT ); Wed, 21 Dec 2022 14:20:17 -0500 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2112.outbound.protection.outlook.com [40.107.255.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B93D627141 for ; Wed, 21 Dec 2022 11:20:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eSImNqJ9VM5LeThka0V5HF+oFr1XSFaamYGKMD0NVvYtkHqXm6wC2DHyVG8BlqFNkZTTXCYMBxKDNu2iQYJZMvgjGRVgXTvZa//zD9WSVEo7/B5HS5b0I8qghnmWAVHKUChexl7haCFeX9Hm604/R1Cfb9NMivPkOWD0YTdCtjSwSyxQGKOipDHN+zRgVPXs3tSq5PWpvqZ69nHFEhk0Y/BFVYoBA1Yj8BF5YgS21MKRAgG4ZMc16d1NCUIPJHtC8vWafKfN+Hq2XW0xi1T7wpNAdWunGpgqSewt010/LMtTcco6pCfFsU3GhDNY80yvo/SUJIs+rpCi5KQceJISPA== 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=manLWJpBlusLkA5eGLaVDFvtlKx1XkR7w9uvnNCgAlk=; b=XNSjVoA4NXvzEGZrruHULuExJimy5lahN1y/KU2jVTdgb/ZchOSSmezqkDy2A+L4/GXTR2LV7clQ88XeXOUxmjyODGXH9X/edVMGOQXUTrfEvWNYLoWDl7JFV1BMlrzj/VGZB7wHnluv5seTakXZcvI7g2NoBzSjnkU1BvApU388qa9PGPM3aDT8uRyhB5jwIj2tgGBZQKvaVrVUnYkGl5dIEKhTar694PLdhS38tACWEzydQiJYCAyx7UlANJ4+5PmDFoP8D8BSBcVPNC56ycMntkpaLVoZVELKGUUAHnumn2XcsADMuyo785HVCOZhkttnb9+UjuR/1VOh1iyLrw== 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=manLWJpBlusLkA5eGLaVDFvtlKx1XkR7w9uvnNCgAlk=; b=Da0Y5g786ZkiGyxpaqY2dlTqxR3/KkcnrF/itZjoSLcvdLws3TWhaXHJ2FZlpUpWupIVRydi9mRE355LAhyJSuL1hJWN4WckG0znwtW543C66wu5YZWy8D21IWFI6pQnMx6OcqwTTrf8Tq9pEQEHAn4kw+QrWjbVr50HHm4PBOmWaSni47AceSAGQzGzMuK/WaaJR+bbtFKE8x71ZUjQZNcw0HHWNQOFBL7zv2wFcfwDJ1YGoWb+Vx3HyE+Aa1meskWhA1l+vRTbrx15KoUGC3kXLs3bUhoEoZJiVWZX5k3c7IOH4Aa2RDy0pA7/cAJY1Tbk5NaiQfrIYv24bFbZbw== 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 SI2PR06MB4106.apcprd06.prod.outlook.com (2603:1096:4:f7::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Wed, 21 Dec 2022 19:20:11 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::ef03:cbfb:f8ef:d88b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::ef03:cbfb:f8ef:d88b%9]) with mapi id 15.20.5924.016; Wed, 21 Dec 2022 19:20:11 +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 2/2] f2fs: add iostat support for flush Date: Thu, 22 Dec 2022 03:20:01 +0800 Message-Id: <20221221192001.17290-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI2PR02CA0010.apcprd02.prod.outlook.com (2603:1096:4:194::15) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|SI2PR06MB4106:EE_ X-MS-Office365-Filtering-Correlation-Id: 621f440f-c62f-4221-1775-08dae388614f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XeiASiP38B2BjTsoinkKmsKzcuSgBjqjTfLjuJCztTL3PFqas1PgIqErzkMvCef4w8QCXWODipYv079yUz9q9tcvVB+mptN9l1MiPPz1lRQs3qEFzUWCUdIXD/lLBibA0giiTkxEk6xGGY5xklwr4w8k6hmM6bdoAu/kvWyeCYeD71fuMFolOlV0whaeguj2xXmfTG2poUE6HvQJQDYsiPTkaWb3aEyX3HU30qMWccmU5M6qofNHw4xJKm3QjbsIjy8fgnOtF47N0385WhyzFaGI94cpO9f3CLEYSmrUs90roIFwZWio0lQCxnZq1oxgORkVtzBAxkHWPaSiQrBqsAiy0c0Y3j2ffek9FX1rio1YXDvlYz2A46qlEYabRxHIhwG6fUkju84OXLqhnOqc0wReMbtixFvlGWxb2gVV/MQNsIYBszrj7rrKj0KVhFfGa5AvOz7KQeu3PMzu2EQICD/zHcXgw7WIfhPgwtJg3Sd4lfU3kbV1yDBwLpwQmeFEsut+CY3cd2KhOE646+a9Vk+LdDtQrHyVwuvwwJDfKuuKjKPuDrGwcE1I2UhgWNbpxqO8pi0kzY7TJW5CbS64s4gveXxzdHny07201TaprBq3fLZyPWZNE5qZTQNs0lz5r4pZgHkmz8Z7E2PSmKChshBSFPcW6VozckHF5uKx9NmIJtCXOW5uEAxujAVX1760 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)(39860400002)(136003)(376002)(396003)(346002)(366004)(451199015)(36756003)(26005)(186003)(6512007)(6506007)(107886003)(8936002)(6486002)(6666004)(5660300002)(52116002)(83380400001)(316002)(2616005)(66476007)(1076003)(8676002)(4326008)(66946007)(86362001)(66556008)(41300700001)(2906002)(38350700002)(478600001)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1kp1/UB9fp86FheWukMODvDeZ21UYND1f7BoxEfyjNOuJ4FHuvmovacgEk0hBynwCSbQt3PUipf6Y9wQmBjN1IpkyD/UdQ+P0gSjTu3uARYEYI2XKb3y/XgLW/+1GmFGmYlb4TkYsCEgkagTIWzRTJ/PTT0nST3Ho5s2UQeazpIzcv8/60LZ5WVTR8BNnTc+hkaDzRa1/tthka5XXdrOuVO35JHLTQTknie6f/hIp/5jQo2LxmZOKY/qxFFf/dwcc8Ug8cOI/RBsb8CbM/cDave370gyMqEQj5n6guAlmfPF3m6uQpAuswZJEbl4vNQllw3w8TY6fq10KFtpnw8pdUkOTuufkYt8RBudu0cusVgT3SmMkE4+Ogve5KQIkaDK8EugsJP699BC47hC9CcybhW76OkkdRv0aa2rUYZQcRaxRXGgwA5XdB8D1uygrKrgzfAxKPwUHVRm7JCUSwJi2Y3lXdpOeVXKPART28M5/jANrhZtjV7JnJdQeuNymuyPLaub6QAwmwOBXsmeKFUo+3d7NlitDWYzXZoYxbaBm2aOjFlvnXwWA46jAvVXfMAa9Eh991R6dteYeZ7UU5DFRcIf2fPXXldNzN/HaOxOeCiNq88F5klpwPvyz8+7FXXxF13t+JKZCEHEwecMM3k7Jct76fT8w0x5Yw6tPpejO4+kLV17NAimu5C3PLfLUrQ0YMbVTJW/jZq20HG9nFIoBC0jisxfKyqCNw2U25A35hh1cay2inU78JByYS8UaTUpF0Cu0EdB9NlPihsalNU2/muOYGYSYqBjcmejCaHhPyRl8aGpyr7+YV+JwNGxT/Kd1L13/2AdyG67GzMiSuvLXsg8+3c5ZYO2HvMLAtMtwCMt1nMt5MKxvoeWjwi9RmCW7tlJX0SKuTc8pSj/Bl9JYHmULTIPBZ+NluEDkYvTFst6MAco38DjZbMwYxAjTGfWaBvrorsBgEV7wVHtRE+avWyeZcoMn2jOPu1jbEgQjF7eLjXOQmKfu1esVjG5QSDBLGK0ipZmePT+gz23aOINYuBLN6K7sVeIGbN+5vOmXvErMSKbZh5+8GV2eYyhL+0lniIOtcfe4rZVyVVsbRMepAHZgVCmFb3mYTdvQpxgI1Laoel5tVqsE1Z39T91OuDKec3abOGRuVILVfWOYVnseyXrvuCtGBREiankcQIz6EQsUisiABbV1xNCqi8oyPWNxgOkhNdfcA9wwlwFCtswCRU51iynlzBaBzvgSgkJ4xdgA35qaNCbQYsneMD42krntlETMsf9Qv4pGt4k72Brh0B408XNAiz4IrT2MHI9DzMaWOFRQk2ZXECUVTlkQFwDyL+VwkkGm/eT1aa579arj0/6jJoWcMb3qSzGmhsNxS1s+fVXxS2YYVtCxt9ItM1PozkOZJ5/PnOHBU2gq+h9vMKsPK4taqHiLjlBlPwRvdQyusXUS5M3uQRGiqOddgrBTM9iHZl6euDytgemKhdue019D2k4gCmHkVRKfS2UIhewnSJnM4WwIQwgRNDljxodm5MqepkvCBnxBr0ah7aLTBHwCV+lUxEwOWKfLsU2ah+KKc/09ENGDqtk0Lo7qi3d X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 621f440f-c62f-4221-1775-08dae388614f X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2022 19:20:11.4915 (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: 6bgBH3IFvpzogj+oBgrBn0ArSbHI/u+JZnzOMtmJ8GvmgJG8hIbkoXyynyiUo2o/CGsukRx6oV19Bw8zawVN4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB4106 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?1752853555720276804?= X-GMAIL-MSGID: =?utf-8?q?1752853555720276804?= In this patch, it adds to account flush count. Signed-off-by: Yangtao Li --- fs/f2fs/f2fs.h | 1 + fs/f2fs/iostat.c | 4 ++++ fs/f2fs/segment.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index b116c778fce6..7d7b96d1e1d2 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1194,6 +1194,7 @@ enum iostat_type { /* other */ FS_DISCARD, /* discard */ + FS_FLUSH, /* flush */ NR_IO_TYPE, }; diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c index 3d4503fef183..721294c40399 100644 --- a/fs/f2fs/iostat.c +++ b/fs/f2fs/iostat.c @@ -150,6 +150,10 @@ int __maybe_unused iostat_info_seq_show(struct seq_file *seq, void *offset) sbi->rw_iostat[FS_DISCARD], sbi->iostat_count[FS_DISCARD], iostat_get_avg_bytes(sbi, FS_DISCARD)); + seq_printf(seq, "fs flush: %-16llu %-16llu %-16llu\n", + sbi->rw_iostat[FS_FLUSH], + sbi->iostat_count[FS_FLUSH], + iostat_get_avg_bytes(sbi, FS_FLUSH)); return 0; } diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index af2d522b1a89..ec4ed7603d1f 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -505,6 +505,8 @@ static int __submit_flush_wait(struct f2fs_sb_info *sbi, struct block_device *bdev) { int ret = blkdev_issue_flush(bdev); + if (!ret) + f2fs_update_iostat(sbi, NULL, FS_FLUSH, 0); trace_f2fs_issue_flush(bdev, test_opt(sbi, NOBARRIER), test_opt(sbi, FLUSH_MERGE), ret);