From patchwork Fri Dec 30 22:18:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085504 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2B49C4332F for ; Sat, 31 Dec 2022 01:47:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236144AbiLaBrH (ORCPT ); Fri, 30 Dec 2022 20:47:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236138AbiLaBrD (ORCPT ); Fri, 30 Dec 2022 20:47:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 972EF1DDD3 for ; Fri, 30 Dec 2022 17:47:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5C4EFB81DF6 for ; Sat, 31 Dec 2022 01:47:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20F38C433D2; Sat, 31 Dec 2022 01:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672451220; bh=fASZhtPJUMZEXSn1VpkUGWF96WMnQK5GL3YSZCRhYV0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=aPxSMRWZXjOZbw0ARNoqU/wAZISjAhRwWuOSH70dgpcR7a7qdBuCm9z9QIfJt366H Uw4ngTQtx9Qn8UjH/5b8iq/CeNYDYvgsorU8au01hZ2rX1GZSqo/VsNqAv30zvGKG2 1elMx0liFgNtWSEMSRkQbnvjTdz2CiCwVkZP2++cqqqZABEBKX9qL1znVjcUIYULyR ZOOvy/hngfWsFEmMmzjQokruHYnpI0Rqrxbo3vXDNhczi9mCTzXZsidyenhotv/ol4 1RRW/nXU0VzElt60jgc2IfKqzEJfiY8snMGO8x9Z1Xrv0gxT5NJeCfLvcA6Rc81wmP rI22dLUPZpcdg== Subject: [PATCH 1/5] xfs: give refcount btree cursor error tracepoints their own class From: "Darrick J. Wong" To: djwong@kernel.org Cc: linux-xfs@vger.kernel.org Date: Fri, 30 Dec 2022 14:18:24 -0800 Message-ID: <167243870459.716629.10907691572155987244.stgit@magnolia> In-Reply-To: <167243870440.716629.17983217257958002785.stgit@magnolia> References: <167243870440.716629.17983217257958002785.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Convert all the refcount tracepoints to use the btree error tracepoint class. Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_refcount.c | 42 ++++++++++++++---------------------------- fs/xfs/xfs_trace.h | 26 +++++++++++++------------- 2 files changed, 27 insertions(+), 41 deletions(-) diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c index 83f681fb49fb..b77d40631e60 100644 --- a/fs/xfs/libxfs/xfs_refcount.c +++ b/fs/xfs/libxfs/xfs_refcount.c @@ -219,8 +219,7 @@ xfs_refcount_update( error = xfs_btree_update(cur, &rec); if (error) - trace_xfs_refcount_update_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_update_error(cur, error, _RET_IP_); return error; } @@ -255,8 +254,7 @@ xfs_refcount_insert( out_error: if (error) - trace_xfs_refcount_insert_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_insert_error(cur, error, _RET_IP_); return error; } @@ -296,8 +294,7 @@ xfs_refcount_delete( &found_rec); out_error: if (error) - trace_xfs_refcount_delete_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_delete_error(cur, error, _RET_IP_); return error; } @@ -446,8 +443,7 @@ xfs_refcount_split_extent( return error; out_error: - trace_xfs_refcount_split_extent_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_split_extent_error(cur, error, _RET_IP_); return error; } @@ -530,8 +526,7 @@ xfs_refcount_merge_center_extents( return error; out_error: - trace_xfs_refcount_merge_center_extents_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_merge_center_extents_error(cur, error, _RET_IP_); return error; } @@ -597,8 +592,7 @@ xfs_refcount_merge_left_extent( return error; out_error: - trace_xfs_refcount_merge_left_extent_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_merge_left_extent_error(cur, error, _RET_IP_); return error; } @@ -666,8 +660,7 @@ xfs_refcount_merge_right_extent( return error; out_error: - trace_xfs_refcount_merge_right_extent_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_merge_right_extent_error(cur, error, _RET_IP_); return error; } @@ -761,8 +754,7 @@ xfs_refcount_find_left_extents( return error; out_error: - trace_xfs_refcount_find_left_extent_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_find_left_extent_error(cur, error, _RET_IP_); return error; } @@ -856,8 +848,7 @@ xfs_refcount_find_right_extents( return error; out_error: - trace_xfs_refcount_find_right_extent_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_find_right_extent_error(cur, error, _RET_IP_); return error; } @@ -1256,8 +1247,7 @@ xfs_refcount_adjust_extents( return error; out_error: - trace_xfs_refcount_modify_extent_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_modify_extent_error(cur, error, _RET_IP_); return error; } @@ -1317,8 +1307,7 @@ xfs_refcount_adjust( return 0; out_error: - trace_xfs_refcount_adjust_error(cur->bc_mp, cur->bc_ag.pag->pag_agno, - error, _RET_IP_); + trace_xfs_refcount_adjust_error(cur, error, _RET_IP_); return error; } @@ -1632,8 +1621,7 @@ xfs_refcount_find_shared( out_error: if (error) - trace_xfs_refcount_find_shared_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_find_shared_error(cur, error, _RET_IP_); return error; } @@ -1788,8 +1776,7 @@ xfs_refcount_adjust_cow_extents( return error; out_error: - trace_xfs_refcount_modify_extent_error(cur->bc_mp, - cur->bc_ag.pag->pag_agno, error, _RET_IP_); + trace_xfs_refcount_modify_extent_error(cur, error, _RET_IP_); return error; } @@ -1835,8 +1822,7 @@ xfs_refcount_adjust_cow( return 0; out_error: - trace_xfs_refcount_adjust_cow_error(cur->bc_mp, cur->bc_ag.pag->pag_agno, - error, _RET_IP_); + trace_xfs_refcount_adjust_cow_error(cur, error, _RET_IP_); return error; } diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index a6de7b6e4afd..d6da679ebaba 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -3513,9 +3513,9 @@ DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get); DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update); DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert); DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete); -DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_insert_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_delete_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_update_error); /* refcount adjustment tracepoints */ DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase); @@ -3530,20 +3530,20 @@ DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent); DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent); DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent); DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent); -DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error); -DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_adjust_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_adjust_cow_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_merge_center_extents_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_modify_extent_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_split_extent_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_merge_left_extent_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_merge_right_extent_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_left_extent_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_right_extent_error); /* reflink helpers */ DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared); DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result); -DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error); +DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_shared_error); DECLARE_EVENT_CLASS(xfs_refcount_deferred_class, TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, From patchwork Fri Dec 30 22:18:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8B74C4332F for ; Sat, 31 Dec 2022 01:47:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236056AbiLaBrV (ORCPT ); Fri, 30 Dec 2022 20:47:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231435AbiLaBrT (ORCPT ); Fri, 30 Dec 2022 20:47:19 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E8E61DDD3 for ; Fri, 30 Dec 2022 17:47:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 18C02B81DEE for ; Sat, 31 Dec 2022 01:47:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE665C433D2; Sat, 31 Dec 2022 01:47:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672451235; bh=IBdwgTEf0ZsUeoyne1EQWuSmbPZQ75/b5Beu0JXZh6I=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=eW472ypcdtsxEgiFgfOTnvUPX3k4qp/pvDnX+kA9GiepXICXxOCJN649wd9gOQeyD DzveC+FqNLTBTZqP13xOeHTE+BowUbft68IKS6SeIX/IjucjURdahNVwR5WsUaydfF RVMb5Qav+9Dg9MdQv7BUzz1S2I5Ro+bsikOQSpkPwvJD3nszPWwc6W8lMkiV8DZcL/ 59LmSk747e60zC/qOt2/6HgPBpt0TK4x/bXDhLwIGiG/IZu0s0GMtoRLzwx6ZoCB5m T3NrJlWTsIKIjb9s2ksgXyeGvWNS/AMgq4BCOE7bcsWl9QXoGoQWss0B7z2cvF1df1 F9rkKzU9XnZcA== Subject: [PATCH 2/5] xfs: create specialized classes for refcount tracepoints From: "Darrick J. Wong" To: djwong@kernel.org Cc: linux-xfs@vger.kernel.org Date: Fri, 30 Dec 2022 14:18:24 -0800 Message-ID: <167243870473.716629.6474319882227995580.stgit@magnolia> In-Reply-To: <167243870440.716629.17983217257958002785.stgit@magnolia> References: <167243870440.716629.17983217257958002785.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong The only user of the "ag" tracepoint event classes is the refcount btree, so rename them to make that obvious and make them take the btree cursor to simplify the arguments. This will save us a lot of trouble later on. Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_refcount.c | 24 ++++++----------- fs/xfs/xfs_trace.h | 61 +++++++++++++++++++++++++++--------------- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c index b77d40631e60..1d181561a9ff 100644 --- a/fs/xfs/libxfs/xfs_refcount.c +++ b/fs/xfs/libxfs/xfs_refcount.c @@ -51,7 +51,7 @@ xfs_refcount_lookup_le( xfs_agblock_t bno, int *stat) { - trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, + trace_xfs_refcount_lookup(cur, xfs_refcount_encode_startblock(bno, domain), XFS_LOOKUP_LE); cur->bc_rec.rc.rc_startblock = bno; @@ -71,7 +71,7 @@ xfs_refcount_lookup_ge( xfs_agblock_t bno, int *stat) { - trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, + trace_xfs_refcount_lookup(cur, xfs_refcount_encode_startblock(bno, domain), XFS_LOOKUP_GE); cur->bc_rec.rc.rc_startblock = bno; @@ -91,7 +91,7 @@ xfs_refcount_lookup_eq( xfs_agblock_t bno, int *stat) { - trace_xfs_refcount_lookup(cur->bc_mp, cur->bc_ag.pag->pag_agno, + trace_xfs_refcount_lookup(cur, xfs_refcount_encode_startblock(bno, domain), XFS_LOOKUP_LE); cur->bc_rec.rc.rc_startblock = bno; @@ -1264,11 +1264,9 @@ xfs_refcount_adjust( int error; if (adj == XFS_REFCOUNT_ADJUST_INCREASE) - trace_xfs_refcount_increase(cur->bc_mp, - cur->bc_ag.pag->pag_agno, *agbno, *aglen); + trace_xfs_refcount_increase(cur, *agbno, *aglen); else - trace_xfs_refcount_decrease(cur->bc_mp, - cur->bc_ag.pag->pag_agno, *agbno, *aglen); + trace_xfs_refcount_decrease(cur, *agbno, *aglen); /* * Ensure that no rcextents cross the boundary of the adjustment range. @@ -1528,8 +1526,7 @@ xfs_refcount_find_shared( int have; int error; - trace_xfs_refcount_find_shared(cur->bc_mp, cur->bc_ag.pag->pag_agno, - agbno, aglen); + trace_xfs_refcount_find_shared(cur, agbno, aglen); /* By default, skip the whole range */ *fbno = NULLAGBLOCK; @@ -1616,8 +1613,7 @@ xfs_refcount_find_shared( } done: - trace_xfs_refcount_find_shared_result(cur->bc_mp, - cur->bc_ag.pag->pag_agno, *fbno, *flen); + trace_xfs_refcount_find_shared_result(cur, *fbno, *flen); out_error: if (error) @@ -1835,8 +1831,7 @@ __xfs_refcount_cow_alloc( xfs_agblock_t agbno, xfs_extlen_t aglen) { - trace_xfs_refcount_cow_increase(rcur->bc_mp, rcur->bc_ag.pag->pag_agno, - agbno, aglen); + trace_xfs_refcount_cow_increase(rcur, agbno, aglen); /* Add refcount btree reservation */ return xfs_refcount_adjust_cow(rcur, agbno, aglen, @@ -1852,8 +1847,7 @@ __xfs_refcount_cow_free( xfs_agblock_t agbno, xfs_extlen_t aglen) { - trace_xfs_refcount_cow_decrease(rcur->bc_mp, rcur->bc_ag.pag->pag_agno, - agbno, aglen); + trace_xfs_refcount_cow_decrease(rcur, agbno, aglen); /* Remove refcount btree reservation */ return xfs_refcount_adjust_cow(rcur, agbno, aglen, diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index d6da679ebaba..a5686b53ca80 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -3228,17 +3228,41 @@ DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error); /* refcount tracepoint classes */ -/* reuse the discard trace class for agbno/aglen-based traces */ -#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name) +DECLARE_EVENT_CLASS(xfs_refcount_class, + TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t agbno, + xfs_extlen_t len), + TP_ARGS(cur, agbno, len), + TP_STRUCT__entry( + __field(dev_t, dev) + __field(xfs_agnumber_t, agno) + __field(xfs_agblock_t, agbno) + __field(xfs_extlen_t, len) + ), + TP_fast_assign( + __entry->dev = cur->bc_mp->m_super->s_dev; + __entry->agno = cur->bc_ag.pag->pag_agno; + __entry->agbno = agbno; + __entry->len = len; + ), + TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x", + MAJOR(__entry->dev), MINOR(__entry->dev), + __entry->agno, + __entry->agbno, + __entry->len) +); +#define DEFINE_REFCOUNT_EVENT(name) \ +DEFINE_EVENT(xfs_refcount_class, name, \ + TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t agbno, \ + xfs_extlen_t len), \ + TP_ARGS(cur, agbno, len)) -/* ag btree lookup tracepoint class */ TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi); TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi); TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi); -DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class, - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, - xfs_agblock_t agbno, xfs_lookup_t dir), - TP_ARGS(mp, agno, agbno, dir), +TRACE_EVENT(xfs_refcount_lookup, + TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t agbno, + xfs_lookup_t dir), + TP_ARGS(cur, agbno, dir), TP_STRUCT__entry( __field(dev_t, dev) __field(xfs_agnumber_t, agno) @@ -3246,8 +3270,8 @@ DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class, __field(xfs_lookup_t, dir) ), TP_fast_assign( - __entry->dev = mp->m_super->s_dev; - __entry->agno = agno; + __entry->dev = cur->bc_mp->m_super->s_dev; + __entry->agno = cur->bc_ag.pag->pag_agno; __entry->agbno = agbno; __entry->dir = dir; ), @@ -3259,12 +3283,6 @@ DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class, __entry->dir) ) -#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \ -DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \ - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ - xfs_agblock_t agbno, xfs_lookup_t dir), \ - TP_ARGS(mp, agno, agbno, dir)) - /* single-rcext tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_extent_class, TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, @@ -3508,7 +3526,6 @@ DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \ TP_ARGS(mp, agno, i1, i2, i3)) /* refcount btree tracepoints */ -DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup); DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get); DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update); DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert); @@ -3518,10 +3535,10 @@ DEFINE_BTREE_ERROR_EVENT(xfs_refcount_delete_error); DEFINE_BTREE_ERROR_EVENT(xfs_refcount_update_error); /* refcount adjustment tracepoints */ -DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase); -DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease); -DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase); -DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease); +DEFINE_REFCOUNT_EVENT(xfs_refcount_increase); +DEFINE_REFCOUNT_EVENT(xfs_refcount_decrease); +DEFINE_REFCOUNT_EVENT(xfs_refcount_cow_increase); +DEFINE_REFCOUNT_EVENT(xfs_refcount_cow_decrease); DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents); DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent); DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent); @@ -3541,8 +3558,8 @@ DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_left_extent_error); DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_right_extent_error); /* reflink helpers */ -DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared); -DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result); +DEFINE_REFCOUNT_EVENT(xfs_refcount_find_shared); +DEFINE_REFCOUNT_EVENT(xfs_refcount_find_shared_result); DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_shared_error); DECLARE_EVENT_CLASS(xfs_refcount_deferred_class, From patchwork Fri Dec 30 22:18:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBED4C4332F for ; Sat, 31 Dec 2022 01:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236054AbiLaBrh (ORCPT ); Fri, 30 Dec 2022 20:47:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231435AbiLaBrf (ORCPT ); Fri, 30 Dec 2022 20:47:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E4A81DDD3 for ; Fri, 30 Dec 2022 17:47:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 94C44B81DEE for ; Sat, 31 Dec 2022 01:47:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5415CC433D2; Sat, 31 Dec 2022 01:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672451251; bh=L6vIPQv3JfLbyTZBLOiNxo9CF7q6P+ZMX1SVMV4MVX8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=eTPWU8s3Q5K4QI4IowXgEtH+4GqtmCoLLojwnJbqIX9LIzeVwd5VbJb3t2G10dB1i Fg+8WMLKSl0WOlfjatzaKJN6/ivnAsMy6yQSfJpgjaWFGg0So1dw4mp7vSvl27mIsq ix3EyGmV8fw5ZR8oGUkGuHFDtecW9Da8F8BagYb2YKrmyuKb67wtBjLfyUWkTKWiU1 KE/PuYJ8kVtqa7AJYfwpUQXtF25zw15d22OlP7POWnr702tjf1flhaK7C7TCqM1uKr SnZcGvSPvQaJXdxo9QWS7uJ4Bn5S2n4bRsj/PPOxu5ju2OSfU5NZkIKQ4ZZXBCqAQc YX/01foDeDmcA== Subject: [PATCH 3/5] xfs: prepare refcount btree tracepoints for widening From: "Darrick J. Wong" To: djwong@kernel.org Cc: linux-xfs@vger.kernel.org Date: Fri, 30 Dec 2022 14:18:24 -0800 Message-ID: <167243870487.716629.10920845342789966780.stgit@magnolia> In-Reply-To: <167243870440.716629.17983217257958002785.stgit@magnolia> References: <167243870440.716629.17983217257958002785.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Prepare the rest of refcount btree tracepoints for use with realtime reflink by making them take the btree cursor object as a parameter. This will save us a lot of trouble later on. Remove the xfs_refcount_recover_extent tracepoint since it's already covered by other refcount tracepoints. Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_refcount.c | 42 ++++++++------------- fs/xfs/xfs_trace.h | 83 +++++++++++++++++++----------------------- 2 files changed, 53 insertions(+), 72 deletions(-) diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c index 1d181561a9ff..4c6ed75059c8 100644 --- a/fs/xfs/libxfs/xfs_refcount.c +++ b/fs/xfs/libxfs/xfs_refcount.c @@ -191,7 +191,7 @@ xfs_refcount_get_rec( if (fa) return xfs_refcount_complain_bad_rec(cur, fa, irec); - trace_xfs_refcount_get(cur->bc_mp, cur->bc_ag.pag->pag_agno, irec); + trace_xfs_refcount_get(cur, irec); return 0; } @@ -209,7 +209,7 @@ xfs_refcount_update( uint32_t start; int error; - trace_xfs_refcount_update(cur->bc_mp, cur->bc_ag.pag->pag_agno, irec); + trace_xfs_refcount_update(cur, irec); start = xfs_refcount_encode_startblock(irec->rc_startblock, irec->rc_domain); @@ -236,7 +236,7 @@ xfs_refcount_insert( { int error; - trace_xfs_refcount_insert(cur->bc_mp, cur->bc_ag.pag->pag_agno, irec); + trace_xfs_refcount_insert(cur, irec); cur->bc_rec.rc.rc_startblock = irec->rc_startblock; cur->bc_rec.rc.rc_blockcount = irec->rc_blockcount; @@ -281,7 +281,7 @@ xfs_refcount_delete( error = -EFSCORRUPTED; goto out_error; } - trace_xfs_refcount_delete(cur->bc_mp, cur->bc_ag.pag->pag_agno, &irec); + trace_xfs_refcount_delete(cur, &irec); error = xfs_btree_delete(cur, i); if (XFS_IS_CORRUPT(cur->bc_mp, *i != 1)) { xfs_btree_mark_sick(cur); @@ -418,8 +418,7 @@ xfs_refcount_split_extent( return 0; *shape_changed = true; - trace_xfs_refcount_split_extent(cur->bc_mp, cur->bc_ag.pag->pag_agno, - &rcext, agbno); + trace_xfs_refcount_split_extent(cur, &rcext, agbno); /* Establish the right extent. */ tmp = rcext; @@ -462,8 +461,7 @@ xfs_refcount_merge_center_extents( int error; int found_rec; - trace_xfs_refcount_merge_center_extents(cur->bc_mp, - cur->bc_ag.pag->pag_agno, left, center, right); + trace_xfs_refcount_merge_center_extents(cur, left, center, right); ASSERT(left->rc_domain == center->rc_domain); ASSERT(right->rc_domain == center->rc_domain); @@ -544,8 +542,7 @@ xfs_refcount_merge_left_extent( int error; int found_rec; - trace_xfs_refcount_merge_left_extent(cur->bc_mp, - cur->bc_ag.pag->pag_agno, left, cleft); + trace_xfs_refcount_merge_left_extent(cur, left, cleft); ASSERT(left->rc_domain == cleft->rc_domain); @@ -609,8 +606,7 @@ xfs_refcount_merge_right_extent( int error; int found_rec; - trace_xfs_refcount_merge_right_extent(cur->bc_mp, - cur->bc_ag.pag->pag_agno, cright, right); + trace_xfs_refcount_merge_right_extent(cur, cright, right); ASSERT(right->rc_domain == cright->rc_domain); @@ -749,8 +745,7 @@ xfs_refcount_find_left_extents( cleft->rc_refcount = 1; cleft->rc_domain = domain; } - trace_xfs_refcount_find_left_extent(cur->bc_mp, cur->bc_ag.pag->pag_agno, - left, cleft, agbno); + trace_xfs_refcount_find_left_extent(cur, left, cleft, agbno); return error; out_error: @@ -843,8 +838,8 @@ xfs_refcount_find_right_extents( cright->rc_refcount = 1; cright->rc_domain = domain; } - trace_xfs_refcount_find_right_extent(cur->bc_mp, cur->bc_ag.pag->pag_agno, - cright, right, agbno + aglen); + trace_xfs_refcount_find_right_extent(cur, cright, right, + agbno + aglen); return error; out_error: @@ -1147,8 +1142,7 @@ xfs_refcount_adjust_extents( tmp.rc_refcount = 1 + adj; tmp.rc_domain = XFS_REFC_DOMAIN_SHARED; - trace_xfs_refcount_modify_extent(cur->bc_mp, - cur->bc_ag.pag->pag_agno, &tmp); + trace_xfs_refcount_modify_extent(cur, &tmp); /* * Either cover the hole (increment) or @@ -1210,8 +1204,7 @@ xfs_refcount_adjust_extents( if (ext.rc_refcount == MAXREFCOUNT) goto skip; ext.rc_refcount += adj; - trace_xfs_refcount_modify_extent(cur->bc_mp, - cur->bc_ag.pag->pag_agno, &ext); + trace_xfs_refcount_modify_extent(cur, &ext); cur->bc_ag.refc.nr_ops++; if (ext.rc_refcount > 1) { error = xfs_refcount_update(cur, &ext); @@ -1723,8 +1716,7 @@ xfs_refcount_adjust_cow_extents( tmp.rc_refcount = 1; tmp.rc_domain = XFS_REFC_DOMAIN_COW; - trace_xfs_refcount_modify_extent(cur->bc_mp, - cur->bc_ag.pag->pag_agno, &tmp); + trace_xfs_refcount_modify_extent(cur, &tmp); error = xfs_refcount_insert(cur, &tmp, &found_tmp); @@ -1755,8 +1747,7 @@ xfs_refcount_adjust_cow_extents( } ext.rc_refcount = 0; - trace_xfs_refcount_modify_extent(cur->bc_mp, - cur->bc_ag.pag->pag_agno, &ext); + trace_xfs_refcount_modify_extent(cur, &ext); error = xfs_refcount_delete(cur, &found_rec); if (error) goto out_error; @@ -1989,9 +1980,6 @@ xfs_refcount_recover_cow_leftovers( if (error) goto out_free; - trace_xfs_refcount_recover_extent(mp, pag->pag_agno, - &rr->rr_rrec); - /* Free the orphan record */ fsb = XFS_AGB_TO_FSB(mp, pag->pag_agno, rr->rr_rrec.rc_startblock); diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index a5686b53ca80..233c611b6018 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -3285,9 +3285,8 @@ TRACE_EVENT(xfs_refcount_lookup, /* single-rcext tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_extent_class, - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, - struct xfs_refcount_irec *irec), - TP_ARGS(mp, agno, irec), + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec), + TP_ARGS(cur, irec), TP_STRUCT__entry( __field(dev_t, dev) __field(xfs_agnumber_t, agno) @@ -3297,8 +3296,8 @@ DECLARE_EVENT_CLASS(xfs_refcount_extent_class, __field(xfs_nlink_t, refcount) ), TP_fast_assign( - __entry->dev = mp->m_super->s_dev; - __entry->agno = agno; + __entry->dev = cur->bc_mp->m_super->s_dev; + __entry->agno = cur->bc_ag.pag->pag_agno; __entry->domain = irec->rc_domain; __entry->startblock = irec->rc_startblock; __entry->blockcount = irec->rc_blockcount; @@ -3315,15 +3314,14 @@ DECLARE_EVENT_CLASS(xfs_refcount_extent_class, #define DEFINE_REFCOUNT_EXTENT_EVENT(name) \ DEFINE_EVENT(xfs_refcount_extent_class, name, \ - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ - struct xfs_refcount_irec *irec), \ - TP_ARGS(mp, agno, irec)) + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec), \ + TP_ARGS(cur, irec)) /* single-rcext and an agbno tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class, - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, - struct xfs_refcount_irec *irec, xfs_agblock_t agbno), - TP_ARGS(mp, agno, irec, agbno), + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec, + xfs_agblock_t agbno), + TP_ARGS(cur, irec, agbno), TP_STRUCT__entry( __field(dev_t, dev) __field(xfs_agnumber_t, agno) @@ -3334,8 +3332,8 @@ DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class, __field(xfs_agblock_t, agbno) ), TP_fast_assign( - __entry->dev = mp->m_super->s_dev; - __entry->agno = agno; + __entry->dev = cur->bc_mp->m_super->s_dev; + __entry->agno = cur->bc_ag.pag->pag_agno; __entry->domain = irec->rc_domain; __entry->startblock = irec->rc_startblock; __entry->blockcount = irec->rc_blockcount; @@ -3354,15 +3352,15 @@ DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class, #define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \ DEFINE_EVENT(xfs_refcount_extent_at_class, name, \ - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ - struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \ - TP_ARGS(mp, agno, irec, agbno)) + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec, \ + xfs_agblock_t agbno), \ + TP_ARGS(cur, irec, agbno)) /* double-rcext tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class, - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, - struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), - TP_ARGS(mp, agno, i1, i2), + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, + struct xfs_refcount_irec *i2), + TP_ARGS(cur, i1, i2), TP_STRUCT__entry( __field(dev_t, dev) __field(xfs_agnumber_t, agno) @@ -3376,8 +3374,8 @@ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class, __field(xfs_nlink_t, i2_refcount) ), TP_fast_assign( - __entry->dev = mp->m_super->s_dev; - __entry->agno = agno; + __entry->dev = cur->bc_mp->m_super->s_dev; + __entry->agno = cur->bc_ag.pag->pag_agno; __entry->i1_domain = i1->rc_domain; __entry->i1_startblock = i1->rc_startblock; __entry->i1_blockcount = i1->rc_blockcount; @@ -3403,16 +3401,15 @@ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class, #define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \ DEFINE_EVENT(xfs_refcount_double_extent_class, name, \ - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ - struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \ - TP_ARGS(mp, agno, i1, i2)) + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, \ + struct xfs_refcount_irec *i2), \ + TP_ARGS(cur, i1, i2)) /* double-rcext and an agbno tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class, - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, - struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, - xfs_agblock_t agbno), - TP_ARGS(mp, agno, i1, i2, agbno), + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, + struct xfs_refcount_irec *i2, xfs_agblock_t agbno), + TP_ARGS(cur, i1, i2, agbno), TP_STRUCT__entry( __field(dev_t, dev) __field(xfs_agnumber_t, agno) @@ -3427,8 +3424,8 @@ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class, __field(xfs_agblock_t, agbno) ), TP_fast_assign( - __entry->dev = mp->m_super->s_dev; - __entry->agno = agno; + __entry->dev = cur->bc_mp->m_super->s_dev; + __entry->agno = cur->bc_ag.pag->pag_agno; __entry->i1_domain = i1->rc_domain; __entry->i1_startblock = i1->rc_startblock; __entry->i1_blockcount = i1->rc_blockcount; @@ -3456,17 +3453,15 @@ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class, #define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \ DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \ - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ - struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \ - xfs_agblock_t agbno), \ - TP_ARGS(mp, agno, i1, i2, agbno)) + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, \ + struct xfs_refcount_irec *i2, xfs_agblock_t agbno), \ + TP_ARGS(cur, i1, i2, agbno)) /* triple-rcext tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class, - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, - struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, - struct xfs_refcount_irec *i3), - TP_ARGS(mp, agno, i1, i2, i3), + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, + struct xfs_refcount_irec *i2, struct xfs_refcount_irec *i3), + TP_ARGS(cur, i1, i2, i3), TP_STRUCT__entry( __field(dev_t, dev) __field(xfs_agnumber_t, agno) @@ -3484,8 +3479,8 @@ DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class, __field(xfs_nlink_t, i3_refcount) ), TP_fast_assign( - __entry->dev = mp->m_super->s_dev; - __entry->agno = agno; + __entry->dev = cur->bc_mp->m_super->s_dev; + __entry->agno = cur->bc_ag.pag->pag_agno; __entry->i1_domain = i1->rc_domain; __entry->i1_startblock = i1->rc_startblock; __entry->i1_blockcount = i1->rc_blockcount; @@ -3520,10 +3515,9 @@ DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class, #define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \ DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \ - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ - struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \ - struct xfs_refcount_irec *i3), \ - TP_ARGS(mp, agno, i1, i2, i3)) + TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, \ + struct xfs_refcount_irec *i2, struct xfs_refcount_irec *i3), \ + TP_ARGS(cur, i1, i2, i3)) /* refcount btree tracepoints */ DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get); @@ -3541,7 +3535,6 @@ DEFINE_REFCOUNT_EVENT(xfs_refcount_cow_increase); DEFINE_REFCOUNT_EVENT(xfs_refcount_cow_decrease); DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents); DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent); -DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent); DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent); DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent); DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent); From patchwork Fri Dec 30 22:18:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F634C4332F for ; Sat, 31 Dec 2022 01:47:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231435AbiLaBrt (ORCPT ); Fri, 30 Dec 2022 20:47:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236064AbiLaBrs (ORCPT ); Fri, 30 Dec 2022 20:47:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D81111DDD3 for ; Fri, 30 Dec 2022 17:47:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 749C261CC6 for ; Sat, 31 Dec 2022 01:47:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0A5CC433D2; Sat, 31 Dec 2022 01:47:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672451266; bh=qH22dh3BXzIYKcXNBx+CZIyiQjxlewuKcZ486+d94UY=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=gNmy55wHSn/YLNQze5kuDa+lmoerIT9wWchEipi74BmXwVT1fED1MV26AJ8EmRisI hYWoY71EE7/69XM9o69CAYV2N4Fc6XAmM9iOxOGp/doMDwcnF42JUm/tiGvZOuo5/d CCGB3keNfgLoTpPm3gXQl0MmNrdfExeptsHZEspEfWTt2g4Yko8m+rT6hFiOt3y4+h 5z+7FEm+hPHDmslHULfv8QCOxcUDSpcu40xetMQ8Ix3+gCfe2oDhVh+iqvqAXFWs3U rL4KwfmXH3Spn1mWAXi445DJOoYY+3ay5Nem11BjF9DG2F8x51KwXDiPojqzlUi3o2 bKgXs5lAT5D8w== Subject: [PATCH 4/5] xfs: clean up refcount log intent item tracepoint callsites From: "Darrick J. Wong" To: djwong@kernel.org Cc: linux-xfs@vger.kernel.org Date: Fri, 30 Dec 2022 14:18:25 -0800 Message-ID: <167243870501.716629.14870719836589439822.stgit@magnolia> In-Reply-To: <167243870440.716629.17983217257958002785.stgit@magnolia> References: <167243870440.716629.17983217257958002785.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Pass the incore refcount intent structure to the tracepoints instead of open-coding the argument passing. Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_refcount.c | 14 +++------- fs/xfs/libxfs/xfs_refcount.h | 6 ++++ fs/xfs/xfs_trace.c | 1 + fs/xfs/xfs_trace.h | 59 +++++++++++++----------------------------- 4 files changed, 29 insertions(+), 51 deletions(-) diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c index 4c6ed75059c8..3d2269c6855a 100644 --- a/fs/xfs/libxfs/xfs_refcount.c +++ b/fs/xfs/libxfs/xfs_refcount.c @@ -1369,9 +1369,7 @@ xfs_refcount_finish_one( bno = XFS_FSB_TO_AGBNO(mp, ri->ri_startblock); - trace_xfs_refcount_deferred(mp, XFS_FSB_TO_AGNO(mp, ri->ri_startblock), - ri->ri_type, XFS_FSB_TO_AGBNO(mp, ri->ri_startblock), - ri->ri_blockcount); + trace_xfs_refcount_deferred(mp, ri); if (XFS_TEST_ERROR(false, mp, XFS_ERRTAG_REFCOUNT_FINISH_ONE)) return -EIO; @@ -1434,8 +1432,7 @@ xfs_refcount_finish_one( return -EFSCORRUPTED; } if (!error && ri->ri_blockcount > 0) - trace_xfs_refcount_finish_one_leftover(mp, ri->ri_pag->pag_agno, - ri->ri_type, bno, ri->ri_blockcount); + trace_xfs_refcount_finish_one_leftover(mp, ri); return error; } @@ -1451,11 +1448,6 @@ __xfs_refcount_add( { struct xfs_refcount_intent *ri; - trace_xfs_refcount_defer(tp->t_mountp, - XFS_FSB_TO_AGNO(tp->t_mountp, startblock), - type, XFS_FSB_TO_AGBNO(tp->t_mountp, startblock), - blockcount); - ri = kmem_cache_alloc(xfs_refcount_intent_cache, GFP_NOFS | __GFP_NOFAIL); INIT_LIST_HEAD(&ri->ri_list); @@ -1463,6 +1455,8 @@ __xfs_refcount_add( ri->ri_startblock = startblock; ri->ri_blockcount = blockcount; + trace_xfs_refcount_defer(tp->t_mountp, ri); + xfs_refcount_update_get_group(tp->t_mountp, ri); xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_REFCOUNT, &ri->ri_list); } diff --git a/fs/xfs/libxfs/xfs_refcount.h b/fs/xfs/libxfs/xfs_refcount.h index 9563eb91be17..7713bb908bdc 100644 --- a/fs/xfs/libxfs/xfs_refcount.h +++ b/fs/xfs/libxfs/xfs_refcount.h @@ -48,6 +48,12 @@ enum xfs_refcount_intent_type { XFS_REFCOUNT_FREE_COW, }; +#define XFS_REFCOUNT_INTENT_STRINGS \ + { XFS_REFCOUNT_INCREASE, "incr" }, \ + { XFS_REFCOUNT_DECREASE, "decr" }, \ + { XFS_REFCOUNT_ALLOC_COW, "alloc_cow" }, \ + { XFS_REFCOUNT_FREE_COW, "free_cow" } + struct xfs_refcount_intent { struct list_head ri_list; struct xfs_perag *ri_pag; diff --git a/fs/xfs/xfs_trace.c b/fs/xfs/xfs_trace.c index ae35868e0638..0b9405749079 100644 --- a/fs/xfs/xfs_trace.c +++ b/fs/xfs/xfs_trace.c @@ -44,6 +44,7 @@ #include "xfs_xchgrange.h" #include "xfs_rtgroup.h" #include "xfs_rmap.h" +#include "xfs_refcount.h" static inline void xfs_rmapbt_crack_agno_opdev( diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index 233c611b6018..c22ffe459002 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -89,6 +89,7 @@ struct xfs_swapext_req; struct xfs_rtgroup; struct xfs_extent_free_item; struct xfs_rmap_intent; +struct xfs_refcount_intent; #define XFS_ATTR_FILTER_FLAGS \ { XFS_ATTR_ROOT, "ROOT" }, \ @@ -3555,66 +3556,42 @@ DEFINE_REFCOUNT_EVENT(xfs_refcount_find_shared); DEFINE_REFCOUNT_EVENT(xfs_refcount_find_shared_result); DEFINE_BTREE_ERROR_EVENT(xfs_refcount_find_shared_error); +TRACE_DEFINE_ENUM(XFS_REFCOUNT_INCREASE); +TRACE_DEFINE_ENUM(XFS_REFCOUNT_DECREASE); +TRACE_DEFINE_ENUM(XFS_REFCOUNT_ALLOC_COW); +TRACE_DEFINE_ENUM(XFS_REFCOUNT_FREE_COW); + DECLARE_EVENT_CLASS(xfs_refcount_deferred_class, - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, - int type, xfs_agblock_t agbno, xfs_extlen_t len), - TP_ARGS(mp, agno, type, agbno, len), + TP_PROTO(struct xfs_mount *mp, struct xfs_refcount_intent *refc), + TP_ARGS(mp, refc), TP_STRUCT__entry( __field(dev_t, dev) __field(xfs_agnumber_t, agno) - __field(int, type) + __field(int, op) __field(xfs_agblock_t, agbno) __field(xfs_extlen_t, len) ), TP_fast_assign( __entry->dev = mp->m_super->s_dev; - __entry->agno = agno; - __entry->type = type; - __entry->agbno = agbno; - __entry->len = len; + __entry->agno = XFS_FSB_TO_AGNO(mp, refc->ri_startblock); + __entry->op = refc->ri_type; + __entry->agbno = XFS_FSB_TO_AGBNO(mp, refc->ri_startblock); + __entry->len = refc->ri_blockcount; ), - TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x fsbcount 0x%x", + TP_printk("dev %d:%d op %s agno 0x%x agbno 0x%x fsbcount 0x%x", MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->type, + __print_symbolic(__entry->op, XFS_REFCOUNT_INTENT_STRINGS), __entry->agno, __entry->agbno, __entry->len) ); #define DEFINE_REFCOUNT_DEFERRED_EVENT(name) \ DEFINE_EVENT(xfs_refcount_deferred_class, name, \ - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ - int type, \ - xfs_agblock_t bno, \ - xfs_extlen_t len), \ - TP_ARGS(mp, agno, type, bno, len)) + TP_PROTO(struct xfs_mount *mp, struct xfs_refcount_intent *refc), \ + TP_ARGS(mp, refc)) DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer); DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred); - -TRACE_EVENT(xfs_refcount_finish_one_leftover, - TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, - int type, xfs_agblock_t agbno, xfs_extlen_t len), - TP_ARGS(mp, agno, type, agbno, len), - TP_STRUCT__entry( - __field(dev_t, dev) - __field(xfs_agnumber_t, agno) - __field(int, type) - __field(xfs_agblock_t, agbno) - __field(xfs_extlen_t, len) - ), - TP_fast_assign( - __entry->dev = mp->m_super->s_dev; - __entry->agno = agno; - __entry->type = type; - __entry->agbno = agbno; - __entry->len = len; - ), - TP_printk("dev %d:%d type %d agno 0x%x agbno 0x%x fsbcount 0x%x", - MAJOR(__entry->dev), MINOR(__entry->dev), - __entry->type, - __entry->agno, - __entry->agbno, - __entry->len) -); +DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_finish_one_leftover); /* simple inode-based error/%ip tracepoint class */ DECLARE_EVENT_CLASS(xfs_inode_error_class, From patchwork Fri Dec 30 22:18:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13085508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0687C4332F for ; Sat, 31 Dec 2022 01:48:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236067AbiLaBsG (ORCPT ); Fri, 30 Dec 2022 20:48:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236064AbiLaBsF (ORCPT ); Fri, 30 Dec 2022 20:48:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D52C81DDD1 for ; Fri, 30 Dec 2022 17:48:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9307BB81DF6 for ; Sat, 31 Dec 2022 01:48:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5732DC433D2; Sat, 31 Dec 2022 01:48:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672451282; bh=p+KS59amF+oAxHfLW/1JmQQ9nkjbjK0kW6S5zHbz820=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=JDhUL5vXvtWHEzBqWjEIgEvnZIxEwr4iF3o3ZXBS0ucXalo5UdkkU736XCp+0d5c0 5YAZTmnGGA5om6Xme2O+V76OrXqDZXwsG8GCvJM5PyB8iHxudvXBdLhPmUWoR1xDuk udxSqp1y0bl2Jo0A/2iRAjNu13QRNBYn7G5qDuXgahHNO+jhPtsxlw4+m9z/lrK18n DlrGbPtWbubv6eIx0AGpDbIfLPnyjB9z5H7fva1f1AGeBXtYBt5CK2puhq0KJKlEw2 +1aQ0h9sDAseA0w2J1kTcBYKbqpFLqpvRkOViwarmc9A/dXYxuKLAV/W6CaiJf1n+c kQMvZUUWewbvA== Subject: [PATCH 5/5] xfs: remove xfs_trans_set_refcount_flags From: "Darrick J. Wong" To: djwong@kernel.org Cc: linux-xfs@vger.kernel.org Date: Fri, 30 Dec 2022 14:18:25 -0800 Message-ID: <167243870516.716629.2373444330153950396.stgit@magnolia> In-Reply-To: <167243870440.716629.17983217257958002785.stgit@magnolia> References: <167243870440.716629.17983217257958002785.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Remove this single-use helper. Signed-off-by: Darrick J. Wong --- fs/xfs/xfs_refcount_item.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c index 5c6eecc5318a..ccc334d482a4 100644 --- a/fs/xfs/xfs_refcount_item.c +++ b/fs/xfs/xfs_refcount_item.c @@ -289,25 +289,6 @@ xfs_refcount_update_diff_items( return ra->ri_pag->pag_agno - rb->ri_pag->pag_agno; } -/* Set the phys extent flags for this reverse mapping. */ -static void -xfs_trans_set_refcount_flags( - struct xfs_phys_extent *pmap, - enum xfs_refcount_intent_type type) -{ - pmap->pe_flags = 0; - switch (type) { - case XFS_REFCOUNT_INCREASE: - case XFS_REFCOUNT_DECREASE: - case XFS_REFCOUNT_ALLOC_COW: - case XFS_REFCOUNT_FREE_COW: - pmap->pe_flags |= type; - break; - default: - ASSERT(0); - } -} - /* Log refcount updates in the intent item. */ STATIC void xfs_refcount_update_log_item( @@ -331,7 +312,18 @@ xfs_refcount_update_log_item( pmap = &cuip->cui_format.cui_extents[next_extent]; pmap->pe_startblock = ri->ri_startblock; pmap->pe_len = ri->ri_blockcount; - xfs_trans_set_refcount_flags(pmap, ri->ri_type); + + pmap->pe_flags = 0; + switch (ri->ri_type) { + case XFS_REFCOUNT_INCREASE: + case XFS_REFCOUNT_DECREASE: + case XFS_REFCOUNT_ALLOC_COW: + case XFS_REFCOUNT_FREE_COW: + pmap->pe_flags |= ri->ri_type; + break; + default: + ASSERT(0); + } } static struct xfs_log_item *