From patchwork Wed Feb 1 10:47:02 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: 51298 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp204674wrn; Wed, 1 Feb 2023 02:54:45 -0800 (PST) X-Google-Smtp-Source: AK7set8dn//hmDUK/8AILgLR4bVqpsuC/Lwo2q7PFLzLb0xEhFd7qanY+tQkm8goJSTZx+YU87Mp X-Received: by 2002:a17:903:300d:b0:194:d999:33f0 with SMTP id o13-20020a170903300d00b00194d99933f0mr1805809pla.31.1675248884964; Wed, 01 Feb 2023 02:54:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675248884; cv=pass; d=google.com; s=arc-20160816; b=XW5zAmV1Vl3F4gYwzIdJcPz36wmiGf7PvYDP7wJO264ppLHKhAmewmA8IzZi4nbxKT Bz1P6zNYcCSR7rBgirVueNJ3u6IUK+O4IVlsh6dH/yk7cftm8b1kUq7qmGwCB+WNaNpp Pyn+MNs8anunEl4l49W3D14zdZzUtvVipi/XnNpgHHfNFoJ/T68IoNDhvO3BajQe3EUk RE8m2hXiZ9yWNfOQU9c2JUu5KZigvnk8Eg/0KfsPdw4LnSAW4a+NKMVxnGznkWsIgFts F1CMmD41Ibrq1kcQmLyBv6xZzvcpr1JwA22u9fDfFBlZ1eVsmECH4TZIzXC16Wp255J+ ipWg== 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=KPyTYX9pfICMCmGZ/dAaZ6ciO8KsKYGijlvpf3fxz24=; b=wK/BdmSoVNx2ZoaloWQlP/QjIyEc8E65ALG/n2Q7zufuznn1+yndUllybLgQIfplyV jmrk/XUcQD5roz1e+SDJZcbAmqfNLOdUt3gVLEKarotQExTfmCliZuwt5++8izfmq9R7 s8GoDLDqMhgmcgw5hZDlA8HoHkopmuGZsbYHEqdrWD1C2NscNSZ+4/jIKVvFvj+d7yEO 6RnhNqq4wW3LNprAQx8r74mCHFD71DNOnX6MwcJqQFJEDTL6Uc3IXRkOTRqXYjqHYrk7 oPMpfVgnMb5dxmo+b44IBZH45u1YIRKTKNbjCnxJR9ya9xThwnSajDiPBkdQF494FqVy pjYQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=HJKJ8poz; 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 q17-20020a17090311d100b00186c5eb0d48si19378501plh.425.2023.02.01.02.54.31; Wed, 01 Feb 2023 02:54:44 -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=HJKJ8poz; 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 S232141AbjBAKr0 (ORCPT + 99 others); Wed, 1 Feb 2023 05:47:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231997AbjBAKrW (ORCPT ); Wed, 1 Feb 2023 05:47:22 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2093.outbound.protection.outlook.com [40.107.117.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32EFB40E1 for ; Wed, 1 Feb 2023 02:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cO4VO2m52/HBVeSXzp60ZueolPQ5LR+En6XcwHUfOnPv91ITaeXTJv66qTXqTPb2XZsASJZ0jVRGuHV0AhVgFoTAueofKHx5R+74yUJwIlMlGz4/cCTcipT9MkuB0mfUQKhEQeZVvDoo4Mqv8ut/5F7K1+UEKtUjWVTJC/tNB1BXl7hAMf4AoumDhwIk5DeElGsSE8EgNPIyUqNmKfx+xWTGXcTDB9z8RcOwQ+nwMYFw11Vy8bi4izxzOOPT+ryYRgFzqO3UQL/XwKBvlydFHx4Qjx5blPLVDLeViFLvM3w9pigAHYu0Omcwui1BNnun752saubM22OyL3RX8gWIjw== 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=KPyTYX9pfICMCmGZ/dAaZ6ciO8KsKYGijlvpf3fxz24=; b=DtPo7tREK3TCnvKpmOm+tb7cN+BaB8WFOJosStuQz00dZ/mJO2CFtw6HDokth2tMuaodmd2cGRlFt7OvPHVsnw993IkcJ8WisQmysIFsAmOU0mNMEeTu9ZKVk93HmnDh9fkLjTVkEyspb9LsPZSTTa2NsTAG/e5ssL9d3mywsXz1Hy8yjx1iRCd4wJkFg7X5I8Pjzy8c/03wIszv6O5nQnhdpJp+3zK0UNUDR9Q/DG45alLXK/ZM1WKISGHxDVLhkA8OsUrlmy4HUN1sc2RC8YCoWXNc1Fvgz9d/fe2VwWERvjxUWk7QrQC+voOFV3l6MEaIyqBU7WVJvhtB1P/Dvw== 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=KPyTYX9pfICMCmGZ/dAaZ6ciO8KsKYGijlvpf3fxz24=; b=HJKJ8poziEae5fk+xkJfya5xAFyaEhbd/+JnKGVuqjty+A0IRGYtLmzTHvGlhTRQxvXIqvn2AZf3vsRLR5DpH2VVo4Dtc3oe3Xi5D/Os6Iomfl4MC80MAi0TSRHoLHEkUYvS629CdsVm9Wy3BN3q1FD9mAkd7AcRH2iFLl2sTAhu65Zij821n8IqzXQtDXIeA54TB39bM+Ljwl+Hm5y5atSgXS21SOkYCjzDwCZKKbL7+GIUznlui6kms00v4LjIDXruLwgzudQeU0RnN4Az1ljAjfuuUngD2KEV5ZPZWro7FOfeC7/2m0o3gVJB7nw7mlgYG6yZg1eS3L6g0122hA== 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 TY0PR06MB5282.apcprd06.prod.outlook.com (2603:1096:400:207::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.20; Wed, 1 Feb 2023 10:47:15 +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.6064.022; Wed, 1 Feb 2023 10:47:15 +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 , kernel test robot , Dan Carpenter Subject: [PATCH v4 1/2] f2fs: use iostat_lat_type directly as a parameter in the iostat_update_and_unbind_ctx() Date: Wed, 1 Feb 2023 18:47:02 +0800 Message-Id: <20230201104703.31008-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI2PR04CA0007.apcprd04.prod.outlook.com (2603:1096:4:197::19) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TY0PR06MB5282:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c51dbb8-245e-4969-9f14-08db0441ae8c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Q50NQ6nHw7L75pjEBfmdy+94sI16uXQ28VNVPOZ4ikVenQ/DpyprNxjvg9g/U5uwF9CnsURhLPqQJT5qviuu0hbu1+mokb+ZKFa2gSs8tLl1Ctc44g1ip7N+n9qHKuzaRM7vIi8djvk8VGmm+JIw90t+7DOxGmm6sT9ffx94/F0XwxOuvCwhOc0Bk4pDDQ8JwZGtfvaUZxYSP5vgrC6QrViw5JZOUjeFe0y5Shw/F+hUM9TPEJIVId652ErQTkrSIwS+tjPi6DrXdL8FleY2ontuOJsT02HsocEdwrnoETwu6fJSi2QZBWKSLzaMhLoxi1i8ExURWyTTKPkiA31t5ShexI62quN4bhDFi1zSaHBiJhJ0x1nDknoUuNSSi5nUnoj4yzETLC5glNo4cBjpnTnfvc1Mi9bM3WNer6vmRhuMbTtwalqwWhgHN0zGKgBo8AZ9LI3W9+JcgAd43Vut9ho4VbfIsOnlI3tiQPdFeLrM7XCXpCtgTDcuQ60QOm8WOovRwFm9Nk2LXBeI74ONTJAQFCBJ+tFpWOd9pU2NFPwLYn+ThENhCzI+sDBSJVbF5zslyn7RJc3Nb6O6jWg077hBZTGnRLj+PbSVApxULsrqmVfq3Splez5wdgOfzDbYTZsw77HivUeBRERIia2MRnIrdWYBEdpHOLa8/eGHs7ib6/iHjnYHt/dZXyHfwTGon219xeppHgq+0a0CV8Dycw== 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:(13230025)(4636009)(136003)(376002)(396003)(346002)(366004)(39860400002)(451199018)(41300700001)(66476007)(4326008)(8676002)(8936002)(66946007)(316002)(66556008)(6666004)(5660300002)(6486002)(54906003)(83380400001)(36756003)(26005)(1076003)(52116002)(6512007)(478600001)(186003)(6506007)(2906002)(2616005)(86362001)(38100700002)(38350700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: x0d5tmUOXs90MdphStrT2Kr95Yg0fihG1TnT6XKvO+oXvpoFVToGkWxj+9bYBusgBblDoLFw5324fQzgLj0SGKc5vFhBc2czg2cMGWYmSgMd0DF7SFOlEUzJ9IBQ9XxDI52W89ijdH2a/9AD9H0ceMFi2pSUPI8TVw4D3XLjfYF8U3agpqFZUI3JwjoGpC+9Z1PaQt+AoWPD0NNEcmmeojlZNJsSy7QeBZbD33mOyRlqWt9MV7TjkBBzPgP5qN5r/Bjn/qPME6YnHELq+jLl1eNUZcGm3ED3RdeVwsR/o53gKrYvjZrZu3g5yaGehfH510VpkdDYZVGA0HjO6moCRFBpxyN3BB87yNncECcd9W+iWtcMYrIXZdDHkACv14GJbvqY8PZjaxxc40t6DvGnVd0fgS+/i4OcxAL3AzqXSbVcagL5RkVlFP0Osj0EtiCbbRj8SPanh0zrQSnGruenog+gxP7AfCLm6vAyJF0/CY+RvS629V6RRr4e6zMZT/2GPThqLTrorUZts3tozXwVHfu4CHftA6tCjHiy5wscxR4LVu2vQHX4lKdhnzhokf5aRlI3fVSbmGgdz9EqkH6FIpYJUcv7e/JzdGj0x6u5htPjaMDWM093WSYmZlCOfT52MzQ6o2M1zHvcYQV8E+lRiSUCcTz583FERdEtwBB6+CoQU6VXXnG05wTH3PYcjakpp9lA+zx6cI5Alcys/LX2bnOE09hW72Kck572QszVQxluGwxaOMK248toUMq3UB/rWkDHK3zJAwYPU1NmXc9722Gs1e1wHm2fp35Tgu47LL1zmWgyKxjVxdk3K2VZFO6UbCsnMjrN5vA/ljZmqVIL0mc0Gq1/yQ0/HXgIu+o5ZUkeRFO8RISQeUyaDylr0vNWLTOUL12LYOomsYfpfvwil+VyUAn2maY3hXnZe+fYqCY2c7BGE6hy5G3bjFbAuCFMxJGDcCCYVdy6X3viCByTti9/2utEyPHlsE7jdILFSowNGhf4R9syde5bNUPYCU5X4zlLavEjnbl70Iq0rEsSpwSiYi9pIORTSQU2F1DQNE5m+is5XVIz8pl86ddACUnCio1KdIUdlQskTiUobZIgRug6xfAWYAO3N3kXwWqjjAEdUzS/YRNCgWJVFuev7IqyGvnnThxkHFiNbqb5lpNa4JHjO+XPbSmtVLZg49oMcM1cPcuWs/8BCTik/Jcmsv8WIlZqGECa1tpidEj2EHir1i7PzZ8z7X9wMdMvn6DGOqAp+WNC2RO9ZO2kQTHBQO0e9bl60ijrL6HhIXhLXbbrR5tM2zuxFGrxW59UhOMEjvQ2EuGmKMPe4MTZZYU0W+stZnMEF/EpEcTFe5Um9bs3SdGBbq+COk7Vm17TgSB8CCoE+p6iUXbb7aNmxYL4FwID/UH9F7F3ye3BYru7g6zupyVG4ARN2Yddawi1366qLvRxk7bijhFvf1szofGE9k1oUSPQKlpyG8mjRVfHAs4MwNo3M45iueSLmYstIR2DXOa95tGkX9KeZJJztPLM/9QQOw8Hnja+OCiu7vPU3uH+52qr46z/TSDAOiV4iQ+BcEBptQcQ4XN02/LXOyjAPnxZ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c51dbb8-245e-4969-9f14-08db0441ae8c X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 10:47:15.3718 (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: cpYgRudgqHMJR+VcltNuVUlzFmAj1k1hvFKBzstBgHDfx3xXiaukxR1Khj/qQSPPZ7agNqmuiwtsAG+1yz2LZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5282 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?1756625774867388194?= X-GMAIL-MSGID: =?utf-8?q?1756625774867388194?= Convert to use iostat_lat_type as parameter instead of raw number. BTW, move NUM_PREALLOC_IOSTAT_CTXS to the header file, adjust iostat_lat[{0,1,2}] to iostat_lat[{READ_IO,WRITE_SYNC_IO,WRITE_ASYNC_IO}] in tracepoint function, and rename iotype to page_type to match the definition. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Yangtao Li Reviewed-by: Chao Yu --- v4: -adjust iostat_lat[] in tracepoint function fs/f2fs/data.c | 4 +-- fs/f2fs/iostat.c | 39 +++++++++++---------------- fs/f2fs/iostat.h | 19 ++++++------- include/trace/events/f2fs.h | 54 ++++++++++++++++++------------------- 4 files changed, 55 insertions(+), 61 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 754841bce389..86fc28adc970 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -292,7 +292,7 @@ static void f2fs_read_end_io(struct bio *bio) struct bio_post_read_ctx *ctx; bool intask = in_task(); - iostat_update_and_unbind_ctx(bio, 0); + iostat_update_and_unbind_ctx(bio, READ_IO); ctx = bio->bi_private; if (time_to_inject(sbi, FAULT_READ_IO)) @@ -330,7 +330,7 @@ static void f2fs_write_end_io(struct bio *bio) struct bio_vec *bvec; struct bvec_iter_all iter_all; - iostat_update_and_unbind_ctx(bio, 1); + iostat_update_and_unbind_ctx(bio, bio->bi_opf & REQ_SYNC ? WRITE_SYNC_IO : WRITE_ASYNC_IO); sbi = bio->bi_private; if (time_to_inject(sbi, FAULT_WRITE_IO)) diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c index 96637756eae8..c767a2e7d5a9 100644 --- a/fs/f2fs/iostat.c +++ b/fs/f2fs/iostat.c @@ -14,7 +14,6 @@ #include "iostat.h" #include -#define NUM_PREALLOC_IOSTAT_CTXS 128 static struct kmem_cache *bio_iostat_ctx_cache; static mempool_t *bio_iostat_ctx_pool; @@ -210,53 +209,47 @@ void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode, } static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx, - int rw, bool is_sync) + enum iostat_lat_type lat_type) { unsigned long ts_diff; - unsigned int iotype = iostat_ctx->type; + unsigned int page_type = iostat_ctx->type; struct f2fs_sb_info *sbi = iostat_ctx->sbi; struct iostat_lat_info *io_lat = sbi->iostat_io_lat; - int idx; unsigned long flags; if (!sbi->iostat_enable) return; ts_diff = jiffies - iostat_ctx->submit_ts; - if (iotype == META_FLUSH) { - iotype = META; - } else if (iotype >= NR_PAGE_TYPE) { - f2fs_warn(sbi, "%s: %d over NR_PAGE_TYPE", __func__, iotype); + if (page_type == META_FLUSH) { + page_type = META; + } else if (page_type >= NR_PAGE_TYPE) { + f2fs_warn(sbi, "%s: %d over NR_PAGE_TYPE", __func__, page_type); return; } - if (rw == 0) { - idx = READ_IO; - } else { - if (is_sync) - idx = WRITE_SYNC_IO; - else - idx = WRITE_ASYNC_IO; + if (lat_type >= MAX_IO_TYPE) { + f2fs_warn(sbi, "%s: %d over MAX_IO_TYPE", __func__, lat_type); + return; } spin_lock_irqsave(&sbi->iostat_lat_lock, flags); - io_lat->sum_lat[idx][iotype] += ts_diff; - io_lat->bio_cnt[idx][iotype]++; - if (ts_diff > io_lat->peak_lat[idx][iotype]) - io_lat->peak_lat[idx][iotype] = ts_diff; + io_lat->sum_lat[lat_type][page_type] += ts_diff; + io_lat->bio_cnt[lat_type][page_type]++; + if (ts_diff > io_lat->peak_lat[lat_type][page_type]) + io_lat->peak_lat[lat_type][page_type] = ts_diff; spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags); } -void iostat_update_and_unbind_ctx(struct bio *bio, int rw) +void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type lat_type) { struct bio_iostat_ctx *iostat_ctx = bio->bi_private; - bool is_sync = bio->bi_opf & REQ_SYNC; - if (rw == 0) + if (lat_type == READ_IO) bio->bi_private = iostat_ctx->post_read_ctx; else bio->bi_private = iostat_ctx->sbi; - __update_iostat_latency(iostat_ctx, rw, is_sync); + __update_iostat_latency(iostat_ctx, lat_type); mempool_free(iostat_ctx, bio_iostat_ctx_pool); } diff --git a/fs/f2fs/iostat.h b/fs/f2fs/iostat.h index 2c048307b6e0..1f827a2fe6b2 100644 --- a/fs/f2fs/iostat.h +++ b/fs/f2fs/iostat.h @@ -8,20 +8,21 @@ struct bio_post_read_ctx; +enum iostat_lat_type { + READ_IO = 0, + WRITE_SYNC_IO, + WRITE_ASYNC_IO, + MAX_IO_TYPE, +}; + #ifdef CONFIG_F2FS_IOSTAT +#define NUM_PREALLOC_IOSTAT_CTXS 128 #define DEFAULT_IOSTAT_PERIOD_MS 3000 #define MIN_IOSTAT_PERIOD_MS 100 /* maximum period of iostat tracing is 1 day */ #define MAX_IOSTAT_PERIOD_MS 8640000 -enum { - READ_IO, - WRITE_SYNC_IO, - WRITE_ASYNC_IO, - MAX_IO_TYPE, -}; - struct iostat_lat_info { unsigned long sum_lat[MAX_IO_TYPE][NR_PAGE_TYPE]; /* sum of io latencies */ unsigned long peak_lat[MAX_IO_TYPE][NR_PAGE_TYPE]; /* peak io latency */ @@ -57,7 +58,7 @@ static inline struct bio_post_read_ctx *get_post_read_ctx(struct bio *bio) return iostat_ctx->post_read_ctx; } -extern void iostat_update_and_unbind_ctx(struct bio *bio, int rw); +extern void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type type); extern void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi, struct bio *bio, struct bio_post_read_ctx *ctx); extern int f2fs_init_iostat_processing(void); @@ -67,7 +68,7 @@ extern void f2fs_destroy_iostat(struct f2fs_sb_info *sbi); #else static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode, enum iostat_type type, unsigned long long io_bytes) {} -static inline void iostat_update_and_unbind_ctx(struct bio *bio, int rw) {} +static inline void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type type) {} static inline void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi, struct bio *bio, struct bio_post_read_ctx *ctx) {} static inline void iostat_update_submit_ctx(struct bio *bio, diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index fe6bcf5f917d..1322d34a5dfc 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -2082,33 +2082,33 @@ TRACE_EVENT(f2fs_iostat_latency, TP_fast_assign( __entry->dev = sbi->sb->s_dev; - __entry->d_rd_peak = iostat_lat[0][DATA].peak_lat; - __entry->d_rd_avg = iostat_lat[0][DATA].avg_lat; - __entry->d_rd_cnt = iostat_lat[0][DATA].cnt; - __entry->n_rd_peak = iostat_lat[0][NODE].peak_lat; - __entry->n_rd_avg = iostat_lat[0][NODE].avg_lat; - __entry->n_rd_cnt = iostat_lat[0][NODE].cnt; - __entry->m_rd_peak = iostat_lat[0][META].peak_lat; - __entry->m_rd_avg = iostat_lat[0][META].avg_lat; - __entry->m_rd_cnt = iostat_lat[0][META].cnt; - __entry->d_wr_s_peak = iostat_lat[1][DATA].peak_lat; - __entry->d_wr_s_avg = iostat_lat[1][DATA].avg_lat; - __entry->d_wr_s_cnt = iostat_lat[1][DATA].cnt; - __entry->n_wr_s_peak = iostat_lat[1][NODE].peak_lat; - __entry->n_wr_s_avg = iostat_lat[1][NODE].avg_lat; - __entry->n_wr_s_cnt = iostat_lat[1][NODE].cnt; - __entry->m_wr_s_peak = iostat_lat[1][META].peak_lat; - __entry->m_wr_s_avg = iostat_lat[1][META].avg_lat; - __entry->m_wr_s_cnt = iostat_lat[1][META].cnt; - __entry->d_wr_as_peak = iostat_lat[2][DATA].peak_lat; - __entry->d_wr_as_avg = iostat_lat[2][DATA].avg_lat; - __entry->d_wr_as_cnt = iostat_lat[2][DATA].cnt; - __entry->n_wr_as_peak = iostat_lat[2][NODE].peak_lat; - __entry->n_wr_as_avg = iostat_lat[2][NODE].avg_lat; - __entry->n_wr_as_cnt = iostat_lat[2][NODE].cnt; - __entry->m_wr_as_peak = iostat_lat[2][META].peak_lat; - __entry->m_wr_as_avg = iostat_lat[2][META].avg_lat; - __entry->m_wr_as_cnt = iostat_lat[2][META].cnt; + __entry->d_rd_peak = iostat_lat[READ_IO][DATA].peak_lat; + __entry->d_rd_avg = iostat_lat[READ_IO][DATA].avg_lat; + __entry->d_rd_cnt = iostat_lat[READ_IO][DATA].cnt; + __entry->n_rd_peak = iostat_lat[READ_IO][NODE].peak_lat; + __entry->n_rd_avg = iostat_lat[READ_IO][NODE].avg_lat; + __entry->n_rd_cnt = iostat_lat[READ_IO][NODE].cnt; + __entry->m_rd_peak = iostat_lat[READ_IO][META].peak_lat; + __entry->m_rd_avg = iostat_lat[READ_IO][META].avg_lat; + __entry->m_rd_cnt = iostat_lat[READ_IO][META].cnt; + __entry->d_wr_s_peak = iostat_lat[WRITE_SYNC_IO][DATA].peak_lat; + __entry->d_wr_s_avg = iostat_lat[WRITE_SYNC_IO][DATA].avg_lat; + __entry->d_wr_s_cnt = iostat_lat[WRITE_SYNC_IO][DATA].cnt; + __entry->n_wr_s_peak = iostat_lat[WRITE_SYNC_IO][NODE].peak_lat; + __entry->n_wr_s_avg = iostat_lat[WRITE_SYNC_IO][NODE].avg_lat; + __entry->n_wr_s_cnt = iostat_lat[WRITE_SYNC_IO][NODE].cnt; + __entry->m_wr_s_peak = iostat_lat[WRITE_SYNC_IO][META].peak_lat; + __entry->m_wr_s_avg = iostat_lat[WRITE_SYNC_IO][META].avg_lat; + __entry->m_wr_s_cnt = iostat_lat[WRITE_SYNC_IO][META].cnt; + __entry->d_wr_as_peak = iostat_lat[WRITE_ASYNC_IO][DATA].peak_lat; + __entry->d_wr_as_avg = iostat_lat[WRITE_ASYNC_IO][DATA].avg_lat; + __entry->d_wr_as_cnt = iostat_lat[WRITE_ASYNC_IO][DATA].cnt; + __entry->n_wr_as_peak = iostat_lat[WRITE_ASYNC_IO][NODE].peak_lat; + __entry->n_wr_as_avg = iostat_lat[WRITE_ASYNC_IO][NODE].avg_lat; + __entry->n_wr_as_cnt = iostat_lat[WRITE_ASYNC_IO][NODE].cnt; + __entry->m_wr_as_peak = iostat_lat[WRITE_ASYNC_IO][META].peak_lat; + __entry->m_wr_as_avg = iostat_lat[WRITE_ASYNC_IO][META].avg_lat; + __entry->m_wr_as_cnt = iostat_lat[WRITE_ASYNC_IO][META].cnt; ), TP_printk("dev = (%d,%d), " From patchwork Wed Feb 1 10:47:03 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: 51299 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp205506wrn; Wed, 1 Feb 2023 02:57:15 -0800 (PST) X-Google-Smtp-Source: AK7set+EnSocyxaajYXrJ517vDvvQcnnjNB8RQHth12YeLdZ7Xtnwvth0YNghoRUP0e1pGF20hCd X-Received: by 2002:a05:6a20:a8a4:b0:bf:2c1:206c with SMTP id ca36-20020a056a20a8a400b000bf02c1206cmr2035967pzb.13.1675249034814; Wed, 01 Feb 2023 02:57:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675249034; cv=pass; d=google.com; s=arc-20160816; b=a3h5TQ09b7IK1ejPgGFoMT2JR1AyEpCsfIIgAKaA0simUhbS8ImxT+2stkbH5dwov3 WLJvt7ixX3hUH8F0HM6cD2vox6AA4wkLUT7GVSbRmpKjiNeAaIxeg9cu87g1KBcBimYM VWMkVpAGb+Gr6pegVY3Pmc3InxSeqEubhKw7CMd6eAKEikfaeVcCvo13pMihUtuKH4ur 4sGLfTuIM/T3W3UBDhfLAAMDNMu8QEmDyR4iQ2jhVmK2bFoHeh0jKzyIRA2RoTaCT+q9 brNQCpSREruElsTvv6xS1pjB2Jhkkfzd2pFO8l7EqdvLkPKkC7IEgu71QwKtowrNPV/p tWig== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F1+0yBg9uJ6KPm/svwEjoQC2zBw7FLVIUxl7fHlcrVA=; b=Z0t6ujWQfvk/bT+F7vyJH3ED4myHXkMoa87UX1iyTbuEbStAk54KmbKs/MFnNphpwW OmdTw8X6LctZYL703HFO3RyIev+hENGjGUfZU2OcdW0RdLWteiUpMBQj8iAa4KQjUiGo 235s+1Lr/fR9ohewfyasDNykFIWDVLrpNcs7UeB6QWai1nms81kQ3HBtU2nrUnKtUOmD hwszOPzpuxU3mJGjQ8ubuddysSW/sMGjURBrX3FbX8loKpGCJYuEnovyU6V3m828Jd/U 10+8jmiW7iBTzsOzO0EtwXMhqr2ovN8/83dytO5R8KV0/cz/nj1HGurxcz6tWCaaPI05 0Niw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=hagYmxG1; 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 k186-20020a6384c3000000b004eba7eca1a2si7165919pgd.248.2023.02.01.02.57.02; Wed, 01 Feb 2023 02:57:14 -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=hagYmxG1; 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 S231997AbjBAKr2 (ORCPT + 99 others); Wed, 1 Feb 2023 05:47:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232079AbjBAKrX (ORCPT ); Wed, 1 Feb 2023 05:47:23 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2093.outbound.protection.outlook.com [40.107.117.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D47C423C for ; Wed, 1 Feb 2023 02:47:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GyCaxmxVSf0GD9U0VOiIiksA6ewdVoQUPZGsT0vgbmgXXnUtzqXDqnYg1H8J7nP/+7GPV18xyu3uKpbGtWzaNCuBuM52TcX20YMUmpTDt2VnRNws3Csk3enCn8PCLS5txwISGeHxDvuKMeto6EwyfZlvCvT5j+r4bxw3rKO2yVZZ0wKHuSfxcqyZNw2JnOVvUt30kDrNipU75D6P+hvxvANxkPhuxMTFD4+YKLhNghRnH6BKpy0wt7JMnh3MOn61iLdwUybFdC8z7FvWUNJbdZ3Siio+Q7nUXO3iLY1hojHCEEx+XfHqwk1RP1yonulSGK0H/6x3vsG/wuMCJX+YsA== 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=F1+0yBg9uJ6KPm/svwEjoQC2zBw7FLVIUxl7fHlcrVA=; b=fOx5BP3bi1e64YE88VjfvQvt5CtOZ/72Fu7uAERLDJDPxLmOQbkNMTk1/1PWt3o1zVc5QXPdY3FYYY9nm70LDHeczzDLDU9epFE8G8bdQFiBwM7JiTXsmjvY+OD9AmnKSY2yHpp2l/kWsIb3ma5sKgCh5Zst1zWKT3u2ij23bpHLuOOwpYqxlq4JUcxkOg+UYINKJm0FU1yjyEXc0tcQrwd3/zvZ2929efLUpaVzslFYRWetK7GgNwonvyLyNx+rOhWqEb3BGv3VlgMYeIZXmWZYnqD9jBwMxk5c9nNh6xx9GoFEcUkQeP262pbT5/KFeF0CLnb+o/bR8VaRPTdRug== 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=F1+0yBg9uJ6KPm/svwEjoQC2zBw7FLVIUxl7fHlcrVA=; b=hagYmxG10sTP+X8ojg92GynXDC9GBHd4e7EvWD4YwFAcpnJoIFu3/o3fttO9LzZm/FVbcZD7CQ+lg2odaOFRTSLphcKrIF9X5W1LlQ3jSqS5VveNwp6pux2YeJxJoJSvXxox+MBEWgacag6SU6gkUWjGdRcYsTf7xNFbb5f7ORmpmOaPJX8eVwpU+A+Up2GBNRjnsDyiRJ6nmYfo/7meu/bt9YilZ7xFp0zQwjgzC1KCw5AKEr5qIFyUMOLXTtjZMDdoAtZekl6bWAV8vO2653j512bvYvo43i9dNfknIjn45weOY8WykR23Yh9f2X5LbZYYy4KiYyBC2b5mOCmcZg== 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 TY0PR06MB5282.apcprd06.prod.outlook.com (2603:1096:400:207::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.20; Wed, 1 Feb 2023 10:47:18 +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.6064.022; Wed, 1 Feb 2023 10:47:17 +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 v4 2/2] f2fs: clean up parameters of iostat_update_and_unbind_ctx() Date: Wed, 1 Feb 2023 18:47:03 +0800 Message-Id: <20230201104703.31008-2-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230201104703.31008-1-frank.li@vivo.com> References: <20230201104703.31008-1-frank.li@vivo.com> X-ClientProxiedBy: SI2PR04CA0007.apcprd04.prod.outlook.com (2603:1096:4:197::19) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TY0PR06MB5282:EE_ X-MS-Office365-Filtering-Correlation-Id: 844f63e8-e7ff-46d8-b408-08db0441afb1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tNIWhqzkniJrOIx/bOREh8rFLTJKngCOO6kUg133QLErs+zFuRiLEUx1qMUHkdH2+O8ST9JU5GU2W47YwTQ5gLfuS3eJzkI79JrubI3SgXsKCYO/bufDXNnVJqo/anEWP2jprT2aRJ6Vd3/ZXJPXJFscUplO+oZjYCSEmfG0PXtssJo1Q3sgU3Em1Y1JBzrJdx8ihbNJOXTduFsl6195ERzCSlLwIC6mErxVjIM9vA40duDHNhhaY9EYzxoYbACquWz65PUlkxjBd18x5aHb5Fnyq1LJOMG8I6rB0BhNuULNJgeE/BWPx22Sx3otrYW0MF4A5sY23B4ZrHJj1hbqmo8EF8oOZrSg5YRPS4I+hdFRoW42wT0mkTLlp6ixSMGipSjsjMCZlDBeR2T6mHkU1dpbWkOQwsCpskfN8UZSoi/zZNKX/QKXNhtcSA4srwLWbOMWlW7OboirMtj+BaUYbzOlX4DU6M1eYJfdY1jnR2/ZpS/ahvWc8JRa110KJZR4gmGp8nISC7Zujduy9MC5wZdYpUUWPWcWdhVBQWvzwF7HEtiG23k2ml5AjX48idqZg3X0hWCNszGv/HGxnG2rQe/fLVZiA3O5dxcUjI28nG7y6Spqb6+zB92D4WvomuP7JSGF5qQ5/y+sVuyFPOAQaXpdNK5BNNOsyy4oDXPm/eA6gXQQiyk4vcGJLtLr1ktIzO8FEiG3ng7AHbIbBlGpbQ== 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:(13230025)(4636009)(136003)(376002)(396003)(346002)(366004)(39860400002)(451199018)(41300700001)(66476007)(4326008)(8676002)(107886003)(8936002)(66946007)(316002)(66556008)(6666004)(5660300002)(6486002)(83380400001)(36756003)(26005)(1076003)(52116002)(6512007)(478600001)(186003)(6506007)(2906002)(2616005)(86362001)(38100700002)(38350700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: agAMKZpbaMYaP4d+r5kcVyIWnlVPUcM4VpUP4Z+31WaY6MFELg4eVymvmd8eYuO9B6gmxFOPA5bZWrqpFjXZMyTegZZNuPvRA7ONAheGAutCyirbmKASomA5wC4k8h0Ibby4SOCFmu/zs7LgLxmfyonKW/FCte4J4S1o477BDtBmkbv7/KVyVWZmqBqSxJkIzkA0AjtYERV/AIXA4ioWatA5h35I+xsJShd0L6DYO/tFMlcLtbPPx/Xy3x4yYcE4f5Ymo2SjSi/JBToi7govC9//4i3Rpt72cl3D1eKQR+u1tsBvGDBHNtVeniBD+oEXZjHUc8JZB6rIpLmUcfT+R06RNXQZNT1wwI0RG4Cqfboq3aGB7uNgGwq+K78Zx2Yg6pZIpvMnl766Sqy0QM6uMjm1EsT5QAmLWdGRzCUdErP9KVWZIGxN2YqMSC5n1wGGCz8sgg90S85WaBsnQRWHVvZD0VkpYq1auqTcspqIcVqOP7A9Sr6ZGxBSlWZrNuqPyl994sCHNFatmYM+YUDaa7Ri85BDEWYrFNCcit0jHGV2BhaUimdDXR6FFbAsJPFhmz4YXre3LdUE+lBXP64Yf7EFKZhcf83bBHQrWxIt2K/HtVPSbPDVqf4NWvls5N57b/yPgmJ6f/gfxpzfgVEPYIAJBd/yOJKcmyC+6Nv7Jdf0WLplvJzxZ9cRBk7a8edOF8CHekayhMk+hBwt5TDnAojGC6slL3wWYA2cBgzMaDjCNhDnjrkRLI6qLKDt1IQ4nFOzxT2b6yhBWmX2BiZxIwb6scA28yJ2NpO7LhtyKZZiNQL/FAtx8cTiocQKXn1eG74j4hTNKE26sxU7py/4oxiZT9NB8riF7fePx24zHtSJTdMx7XEEGhoXp7R05C0JVvjSkWy+VU8P06e8fLG7BXPb303jLg8/DkW9rjpwUo3wTjeKVMtMmwAmU/Yi6hjmFr5DnIrLsuoRh9cUm1GeETLic0rkMwZ7I+vQ+15gYKfy9hz2r08Utw4Xw/Z3JDb+oXWE7c+sSrUaX9Zu+2mjoollmkuUmi1nbFzPcSgan/+8prjBhx2OahUtORwQ3ff063j0N1AxSa4sIQ25nVQTlyu6j+gpbwdZTFBNK+0Ag4MMr89E7rjErfMnTcizTKl0ZbwZBh3qz1F4X4P+oHzoBOP+VnlpRaTQtbSUYfeMxEPmhToNTHceLG3lMQX4HEfx3OSDztgO04HWjhn/cYiu/GNBS112BueJ8CSBLstpw+HOJothcjBzikZEvCyMuf0YhvmUUxp79S3NvGjzV2DxAccoCaGi5gs3sk6RV5UBksZILVEMcm93uZ1rJ6KxGnEnQJYEiKM7TpHseOULVAveG74erZfLf4p4S+TuDDubLS5kRR0W6nbThusGOPGFdBHLnkBSKkxk85JyMnhvFEFbh5E4ffphCdx/9rr12hOEntHwYWIDd1FvaDhjfDb/pikH5xwzrbg/IVXKgnJ5D9px4nssE4Ip2W7vA7HPjHhArO/ogJ0EAD9B1tG3lwRluIwqZcof+xDCwQpuUpjRdZZCfWaEvfYfaX5zHMeYRm6cMM6fG0+tpIof3A0LIfUtYNJh X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 844f63e8-e7ff-46d8-b408-08db0441afb1 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2023 10:47:17.1663 (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: B42UXjfHKsfb0lLuVmNRzsIEcApmYBIqUs4rscBYpZpIDM2/N/bexcpLwkbF2a+LBMp6i0VeQd0m7dmsSvmdfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5282 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?1756625931994500943?= X-GMAIL-MSGID: =?utf-8?q?1756625931994500943?= From: Chao Yu Parsing sync/rw type from bio inside iostat_update_and_unbind_ctx() to avoid unnecessary parameters. Signed-off-by: Chao Yu [Yangtao: remove lat_type check] Signed-off-by: Yangtao Li --- change: -remove lat_type check fs/f2fs/data.c | 4 ++-- fs/f2fs/iostat.c | 19 ++++++++++--------- fs/f2fs/iostat.h | 4 ++-- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 86fc28adc970..82e326c0e11d 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -292,7 +292,7 @@ static void f2fs_read_end_io(struct bio *bio) struct bio_post_read_ctx *ctx; bool intask = in_task(); - iostat_update_and_unbind_ctx(bio, READ_IO); + iostat_update_and_unbind_ctx(bio); ctx = bio->bi_private; if (time_to_inject(sbi, FAULT_READ_IO)) @@ -330,7 +330,7 @@ static void f2fs_write_end_io(struct bio *bio) struct bio_vec *bvec; struct bvec_iter_all iter_all; - iostat_update_and_unbind_ctx(bio, bio->bi_opf & REQ_SYNC ? WRITE_SYNC_IO : WRITE_ASYNC_IO); + iostat_update_and_unbind_ctx(bio); sbi = bio->bi_private; if (time_to_inject(sbi, FAULT_WRITE_IO)) diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c index c767a2e7d5a9..3d5bfb1ad585 100644 --- a/fs/f2fs/iostat.c +++ b/fs/f2fs/iostat.c @@ -228,11 +228,6 @@ static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx, return; } - if (lat_type >= MAX_IO_TYPE) { - f2fs_warn(sbi, "%s: %d over MAX_IO_TYPE", __func__, lat_type); - return; - } - spin_lock_irqsave(&sbi->iostat_lat_lock, flags); io_lat->sum_lat[lat_type][page_type] += ts_diff; io_lat->bio_cnt[lat_type][page_type]++; @@ -241,14 +236,20 @@ static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx, spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags); } -void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type lat_type) +void iostat_update_and_unbind_ctx(struct bio *bio) { struct bio_iostat_ctx *iostat_ctx = bio->bi_private; + enum iostat_lat_type lat_type; - if (lat_type == READ_IO) - bio->bi_private = iostat_ctx->post_read_ctx; - else + if (op_is_write(bio_op(bio))) { + lat_type = bio->bi_opf & REQ_SYNC ? + WRITE_SYNC_IO : WRITE_ASYNC_IO; bio->bi_private = iostat_ctx->sbi; + } else { + lat_type = READ_IO; + bio->bi_private = iostat_ctx->post_read_ctx; + } + __update_iostat_latency(iostat_ctx, lat_type); mempool_free(iostat_ctx, bio_iostat_ctx_pool); } diff --git a/fs/f2fs/iostat.h b/fs/f2fs/iostat.h index 1f827a2fe6b2..eb99d05cf272 100644 --- a/fs/f2fs/iostat.h +++ b/fs/f2fs/iostat.h @@ -58,7 +58,7 @@ static inline struct bio_post_read_ctx *get_post_read_ctx(struct bio *bio) return iostat_ctx->post_read_ctx; } -extern void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type type); +extern void iostat_update_and_unbind_ctx(struct bio *bio); extern void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi, struct bio *bio, struct bio_post_read_ctx *ctx); extern int f2fs_init_iostat_processing(void); @@ -68,7 +68,7 @@ extern void f2fs_destroy_iostat(struct f2fs_sb_info *sbi); #else static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode, enum iostat_type type, unsigned long long io_bytes) {} -static inline void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type type) {} +static inline void iostat_update_and_unbind_ctx(struct bio *bio) {} static inline void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi, struct bio *bio, struct bio_post_read_ctx *ctx) {} static inline void iostat_update_submit_ctx(struct bio *bio,