From patchwork Wed Apr 19 16:31:31 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: 85501 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp524945vqo; Wed, 19 Apr 2023 09:44:34 -0700 (PDT) X-Google-Smtp-Source: AKy350aO1y7YQEV54ZP9sTNhvqBHZYtCfVXMdh94aPqu9pbOHP7rTgh5HKDp8dBV3qFQ/NWLw5bu X-Received: by 2002:a05:6a20:8e17:b0:ef:c4f6:9122 with SMTP id y23-20020a056a208e1700b000efc4f69122mr5577325pzj.24.1681922674053; Wed, 19 Apr 2023 09:44:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681922674; cv=pass; d=google.com; s=arc-20160816; b=ct2ACEIUg9bY6oF2qukhqos+TCTJ91IgxD9QSDV5QKEhKqWPNk6bP8IwNOFea7BSQl FLCLEeZAcnB07hP2E6WG3+aqtWGAbMhs58AUwmJgKv/EB8J0V0ufuM3CHWhfnyIBeEV4 iTEAZymPSUIlWAf0ufpKwbIsrYAp4g4ooCgMpvYAJBLPO00f1sanBQ2HKUoxDrVrxD0v 9qLwKBu8F8kPM3sNhyzfcWg8q9MgX7/QRXBJhl3gdnTcM8SzzR2+yAJyD0X9VwUAWG9b 8ELANRZOobpSktJBhorHaVx29vpOCAB48CStp++yO8kpygikhDx6wlwK2jtsRkEzk92A f6vw== 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=hsDVv1QyUDWIKAkxYo0tiCKgpgQh5t22baLlA02c5Ek=; b=ePe1Ol15cymdukbgmJtC3mRWQmKIO7D2J0DTO9JNh2twdH0sb4DJN2doDGV4MTkd7g 51nWCPws+XhqhP41ABhQGGAWxtGcwQSrTWpcTvcztO/sh7oF2mlEIFFzRC+1SOeaRO+v R68oFeP0dE6hgpAKbLPueBeDzKErVVL3OJAU9Mm1MPj0p6QuXKBkNWcOYx6a1+5UKEdd 2tV+9aM6ozwYiGi/nC4ryRUCNBO080i4ZP7wyqfiIiXd1BDU4fv3nDuQSRnQVjvXMMhQ rra/1cOzVYgM5SqsGaOSfVIFwXckV7ACWVIn+zEmSQF3NfqncUrnRuKUNHYPzM4iTKaf clSQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=qrik65sw; 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 c130-20020a621c88000000b0063354a65327si16154051pfc.395.2023.04.19.09.44.22; Wed, 19 Apr 2023 09:44:34 -0700 (PDT) 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=qrik65sw; 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 S233442AbjDSQb4 (ORCPT + 99 others); Wed, 19 Apr 2023 12:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233639AbjDSQbw (ORCPT ); Wed, 19 Apr 2023 12:31:52 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2120.outbound.protection.outlook.com [40.107.117.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B84072A4 for ; Wed, 19 Apr 2023 09:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lYVEzbng1D5dYKc5pRIdMSfstMmD2TqYZm01Uo8Yn+ip09bZ/3k9tcU4XoHiIZbFdTxDnJisunAVjSdKRiss2mXpWsDsrQpQSFHio/fbBuBGFCjc/aGV/OiC5FYKfLNiUPlI5kMGAE98kLWLEawQJsBUXyMuVc+q3+ZQyGxPBbu3bgTxqxgWMqnwUNRKxTQ9rHcNqewh9mrgxLKJgkWvv8OTlwCX3gpwILULTvF6wBwKLEgXlIhYsLyAdkuwUbfYfBIAby+emnTX/eyH4RHIKvjNoWm7zDi7JasW4LsmuS6rQU/HSo0ZiX+5NGuMB93Q/7uH+EdBwYFgexLHZTJmHA== 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=hsDVv1QyUDWIKAkxYo0tiCKgpgQh5t22baLlA02c5Ek=; b=jYed7I36vADq/OkWdLvD5nBTCHpWg1PqkCUL8i9UAjMhgEk0SXsywwT9/vpX0rvgxUEsJLhoXsaoTtVItzhCG16RAPisxBROP2YS+rdVRvumpq5lmPr+NrYnRPLtjLmQYF1MWEb+7asu6rVCHc3gjn4CXWu5PxIjrk8f4WEO+LcCmuVzfALBPgvrwbGnDLB9HOwzJSWJjoWl/+x/3cv/cdA+Si4UReJGEwZW70DQy8rS1cMiIfsQzXsT8BqzmWBFsisKUHwstC2jQVdq0oELH0M9vrpiEHfgyCuJFpmlTNJCS71F2q7uHvHQydh6qludIfxg2wzF+hEOs2q0HzRXIQ== 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=hsDVv1QyUDWIKAkxYo0tiCKgpgQh5t22baLlA02c5Ek=; b=qrik65swx+p2LB76QOjkQAkak5mktzGqIQDXPZ7/DAcJBiaL/cIZvjIv7EOe4RdcJi4+QOUF1JS/dbiwO5jsUelBj58Q73fLepv3/NyIlaOxjfk32thP5hJeFfsH37p9vF7UvNXICOOHvfiQ7l1OMefueDizr1ddIZ4QpouJhXNJCZgeOLjbhoQ2qZiRhzAf9p194tJHnmzZ3cJ+dWKwOb1okYWRvmA3FPsgaloJ7WPNS6PRiUVUPp2hqzeLWQnJfdgt87ju2LVDP56OQedzdCxbqrKPtc+YwseME1bP6fhQiQolK5ZyhZaXmIIACvHe9HY+37RVwa+MIoRuyXdAYA== 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 TY0PR06MB5188.apcprd06.prod.outlook.com (2603:1096:400:21c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.20; Wed, 19 Apr 2023 16:31:41 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::76d6:4828:7e80:2965]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::76d6:4828:7e80:2965%6]) with mapi id 15.20.6298.045; Wed, 19 Apr 2023 16:31:41 +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: add a tracepoint for discard thread Date: Thu, 20 Apr 2023 00:31:31 +0800 Message-Id: <20230419163131.7682-1-frank.li@vivo.com> X-Mailer: git-send-email 2.39.0 X-ClientProxiedBy: SI1PR02CA0013.apcprd02.prod.outlook.com (2603:1096:4:1f7::7) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TY0PR06MB5188:EE_ X-MS-Office365-Filtering-Correlation-Id: 3054f174-e770-4df2-d5c3-08db40f38e07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nwJhV38ilMsZrbujMQeWvqvb5ZK1cePimToR7hQsRMI9XgomvloMrzUd2WoTgzSodgwJsFm/TY7opnH7eLpKcmtuE8mATNiUMVEnOmkjwCjEp+eyYFjBF3LAPf32/FXq4/V7oXok+usnuGL7vqRsvxf3Hn4QhJLC3osujHsDqIxh6fZKIjSs3qRunReqtmu/icuobY6s92aMPaXTO4rNS506ZiYBRieMDPHgBgTx0eliLOmh+imGPV3AYMGauMhKAhsr4ZD4O3RJMbpYS2XDjOwmHA2gXjcWUa4ppF6StWE+PqyrWdhzL7zcRCSOERXU2TtJj3FiFh2FSEVm1dWGpeQtxcyVcD2ntk8+eBEPrhYeMeNcwR8Xtp/G7mjK0L/Y3f+HXgUK9DQVopOkMU55arml0kMuL6bGam7S65FTeZNGIktIw5YQjmW8s/gpjEn52S80/HH5gL/w0beAai1sOPPBJ4FjyJkNnVLKxB/m/y9TTGOFDM2dMMM3kCNsMU8sPmPuDgtDq6tlgb/vmQioVkM9uzL1CevySppkhlwmfVYFQWy0NGd/3lbYg4KJaZ0Md5Tt54AaKNr5CW1mhuPUfmzRGZ+cupvWC6A01Zltu2aP1eAFLQqVLlOmOTMcMTab 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:(13230028)(4636009)(396003)(376002)(39860400002)(366004)(346002)(136003)(451199021)(6666004)(6486002)(478600001)(86362001)(36756003)(2616005)(83380400001)(107886003)(6512007)(186003)(6506007)(38350700002)(26005)(38100700002)(52116002)(1076003)(316002)(66946007)(66476007)(66556008)(2906002)(8676002)(5660300002)(8936002)(41300700001)(4326008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Wa+NrcAVUSZBp4HX82p+It/esj8CPspfdadc+s8DDBdsLvEX3B1R6PyRhC9QVhogllHX2kfjlYUV70P0VA+ILKoCfbabD0YTwcsGZuxy5lcJnOYYJOS5KO338tqWQmEcUpzxaRYUm2AR/OjLp95H9Lln30Y5ttJ0UTST/RJl+0V8YK3JtdR95AGYAnC74UuuhsWRe/SwxA9foZubCxsz5LrE7BxEhoSouOZLt2OY1tMBIM8QMSfM+t62DZunGZP07EFlkNBFPuuYK4feOKlM5p9L1lZoL2wbLdopRqlaHmkNLl4Nx9EByIG4oS1zXpduhB4rsgxcAY82swEsC8uuGSMOWzGtJ3GhNy+Q+64we+nVhD5f4IcywAbBMucF8DtjyBy2XPMFlxLcYDA3aFhkNZMU6Jx561bz6l7Hf0mRATQxFngdx0J40REHXTlBD8jD4Mrzw+Hmpjz78o5JL7Ty/7M3VDCK++rNS/XT3JAsHXk6fer6CbeGXxQkgfnL83qv3YXQhyDWhNOTv/g3OMZTktRGUoaCjSygFNTJQxy+es59SVtyhpqFVA7Vn7x9sa6hKNu9hwpVSxnr6mD1BqKyu6ADjEKf0F+vWZViT+hPXgIfebWCrrIY0BekmvXZtB5db7mYJr9fbd4N8a89euQkODKkQ/KopNaJQ55Ja3+zEl9TIpJCG4g9bJsJJUvVGUJ4zLG6O/gszEq2KOwEiSd4xYYRHdt2pNY9WIJs51SW3dxTsq1t4fcPCLXVGAYap46KWVVvtmJ00exZTDv6cSZkwUKtvhNj7VhS8J7LsocHlyne2bRw0dsJb16dD8f5SYAOvj7u3lSER0IjVDX2NOeWwvvFNH8dIgA4vM5hpgP80RulEeS6clpLsDvibGvnWmHmfmgQIBvim+TKpMCfQrtNNtT7l7iktqvrSPbAP1Z2gl8hDnpDqRACekXpyduXthlsT2jISbBCKABYkEJSk5WIpVDyFZNNREhCGIGdgqJjTmUDulbpU243LkdZevkeZwo8quEmptbDEB9ledZsJ4OOiU9G2KAwSWXad055w/cWZ5QeC+h4u6DrxWKB1NdFdb1mKHa2fJqIaBRaSPYkaYwPD9eoFvC7L/mrdx356uPae71IDcrAD7dJMhSsDwPqX1dejAmYVj50jGzNwkXg2WqVwlMDuesfQvrwxGZgolumL1N4C0op5MwOk4zWfB9sIq5TJRAEQFP+3YjYd/UuDiuwx9oBHaw/CocH2a3q24xaZheCqox/xihXLZlKCcj+ziwlsMmJM9+gRHmPmTwlGYrFoBiR9IfK4DhSjgvUmzqp9AmHJO09QsABYcxjv0mJxuHqeMyxi0oXrl5xwDL1D7dwiuSutwFGsWj3w1hKj132nLtlESJz7nd7uJLK4SbloPyyZXZK45fFpzVPcZcYsm0u7wUk3NQhl2g1YOPHQwdaGbZuajHBB3w06PfM+N6Vf3ySFKhKrSqm4PZZLAjJLcOsdYby4LqUxrcjp9x67x0w4KETSTqBXbA1i3wJOmSC5pxGsjhXfDhzE70IjX078KuLSzbFF/ZoboTqSTBmlazyB/K3YU8V/rvgaLd8vD104ol/ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3054f174-e770-4df2-d5c3-08db40f38e07 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2023 16:31:40.8625 (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: gF6PCBoSaIAO/E3jv4IIJi1/6Z90+RI3hdYybNLNyOl9a65+KlCQ5fmxrkmaOlmRqh5j/Yfq7AIgQ1geafaoxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB5188 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,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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?1763623749874824870?= X-GMAIL-MSGID: =?utf-8?q?1763623749874824870?= This patch introduces a tracepoint to monitor discard thread behaviors. Signed-off-by: Yangtao Li --- fs/f2fs/segment.c | 3 +++ include/trace/events/f2fs.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 641bd8cc54da..e27ad310186c 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1839,6 +1839,9 @@ static int issue_discard_thread(void *data) if (!atomic_read(&dcc->discard_cmd_cnt)) wait_ms = dpolicy.max_interval; + trace_f2fs_discard_thread(sbi->sb, wait_ms, dcc->undiscard_blks, + atomic_read(&dcc->discard_cmd_cnt)); + sb_end_intwrite(sbi->sb); } while (!kthread_should_stop()); diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 99cbc5949e3c..e1939427deb2 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -1512,6 +1512,34 @@ DEFINE_EVENT(f2fs_discard, f2fs_remove_discard, TP_ARGS(dev, blkstart, blklen) ); +TRACE_EVENT(f2fs_discard_thread, + + TP_PROTO(struct super_block *sb, unsigned int wait_ms, + unsigned int undiscard_blks, unsigned int discard_cmd_cnt), + + TP_ARGS(sb, wait_ms, undiscard_blks, discard_cmd_cnt), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(unsigned int, wait_ms) + __field(unsigned int, undiscard_blks) + __field(unsigned int, discard_cmd_cnt) + ), + + TP_fast_assign( + __entry->dev = sb->s_dev; + __entry->wait_ms = wait_ms; + __entry->undiscard_blks = undiscard_blks; + __entry->discard_cmd_cnt = discard_cmd_cnt; + ), + + TP_printk("dev = (%d,%d), wait_ms = %u, undiscard_blks = %u, discard_cmd_cnt = %u", + show_dev(__entry->dev), + __entry->wait_ms, + __entry->undiscard_blks, + __entry->discard_cmd_cnt) +); + TRACE_EVENT(f2fs_issue_reset_zone, TP_PROTO(struct block_device *dev, block_t blkstart),