From patchwork Thu Sep 14 16:07:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 139684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp466708vqi; Thu, 14 Sep 2023 09:21:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9IloeellroT5mZi6ZqduRGDX7cJZoKuEU8cUR4GVDeGIYUTgPeYZJX6ewNWTBc3Vsxj+R X-Received: by 2002:a17:902:c1cd:b0:1c0:9d5a:9b06 with SMTP id c13-20020a170902c1cd00b001c09d5a9b06mr5704735plc.63.1694708517689; Thu, 14 Sep 2023 09:21:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694708517; cv=none; d=google.com; s=arc-20160816; b=ZY3dFv6FH/RRRrF69tAuxMHeuZ9Yx9S3zfBca2wST0gj6yMtV+Hyyrr8Fi8WzweDfp Xw4hLPxcwpV2YhZJvRc435gwn0AD3uCAVYZaU2B24PMKPIde40dgLWG/u1ib6yTkc4iv 5fjYosLs5ZMz0Up+Akf3XuaMoG0UXMvzttKobEWTdY51MwVzgqp5PSoE70ZjKLeDUosa ftDijL0Rfzu/v0FG3nOkzMQQhubD4bbkNinrt29HXyUNcWQoizCzWpGxrwUjrtG8q1/3 /5v6rHZtKJPDeI3BKqIg4qNmE4c1khrG3TO+28AHqLHoAQ+I+SYw9qGMAGVR+hqjuWSH VSlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :wdcironportexception:ironport-sdr:ironport-sdr:dkim-signature; bh=cIpDauTVHwQBHshoqRNheO69kTHVb1VWyjuzaEl8Rgo=; fh=bp3vMIo1qVzFCHckMTFYF7uCNt+DyLY9wZgFAQuWS8M=; b=PyRPVzkrtkEGy7ETn56GmyhS6H7CQM+unppw3xEVCVaLm9gNTgjPI2tiQfRCD905TH fuH0DgsM+nAejuHzxrtj7mt9I4kb+tpvEPxC0UAeCPcDxY/hW0q9PyRg5f3bSnV1e4/7 RO15f0QKnohS/3Or+Qv8R4EnAQIDQyBFIsoMeROoJKXz+01zqJojewFwy+xwHixUyDrv V7BrtitZj+2XOBudpUuaZw1cpIwbg1Ab57yEtrm8f4QyPkOZk3bS8ugf9WPIWs7U3q4v jy7CfilAvFFAT9l/JCWzmZ61rI0495CzLL/lY/P+v9csYfXdjf5NM1olJBIwtxmgULNB Edmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=OlSncPK6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id o6-20020a170902d4c600b001c3ce0922ecsi2103070plg.627.2023.09.14.09.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 09:21:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=OlSncPK6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 9BA788370D8E; Thu, 14 Sep 2023 09:07:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241852AbjINQHp (ORCPT + 34 others); Thu, 14 Sep 2023 12:07:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241860AbjINQHV (ORCPT ); Thu, 14 Sep 2023 12:07:21 -0400 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBBD91FFD; Thu, 14 Sep 2023 09:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1694707637; x=1726243637; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=dAFGj2lSFggsGCAxlAi8drVBv+UlMJSnIu/xYz5RsQY=; b=OlSncPK6IwuAJqqRusaKBmItI6MEK89PelvbS+D1HXVBKi7vglXjNtmP XFg7YZY91x73fUZKu1yJGyeROOkHeXlg3rmPpPyuTdxN8SlLQGIHnCe38 xcuNVFF4stK19Empq1YTxp1/8C5x59Bw30n3H9k6CBAYfGwo23kxnP/aO p756NthR+7BSrQTaDbb6yw4MtP3oCyw2eYbr5f+eCo/uc6Nxpxy2E3L/P v5zFROTdAorS7i0Z0soGK8q+VFsSRNlWHkEZBfljpquPd+gJNI23vmhmj oKrbg7dn7SwbpKIu49ffmjte5y8tWa1ehmSREyy7NnsvqrXfX5CT3ynnJ w==; X-CSE-ConnectionGUID: FmfcZvvmSD+76dB2jk3zew== X-CSE-MsgGUID: L71ry+ZZQ0KW29JWL0M17A== X-IronPort-AV: E=Sophos;i="6.02,146,1688400000"; d="scan'208";a="248490559" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 15 Sep 2023 00:07:17 +0800 IronPort-SDR: 3AsZ+kunBFYzKfyu3zzBus9gbMJl9wU5cEdEkTrcVLEY45OfxnyjEPTk3Q26ni/op+s05fuG9k vIEEeB5ybaPqLwV7MZfyHVcz3UFrTS3C0RQ9r7zw0HTlfgOHg2UOZ48IUJKk2tJa24/x9Zayya tawBJAx8o1oGnf0vjywYw90M8gg769KjbyPGlOcslpoYPdQB58GhFFvOFXVb8hYAUirrxUj0Te IOHxkHSGZYK5w4M7yEVzsZJqe/27EAvhaZA5sdaVw+gLkeMu6SuJKNJBO5wVs6YJU7Ckvqydqd iTc= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 14 Sep 2023 08:14:18 -0700 IronPort-SDR: gqmI05Gt11sOtVS4hVMypzk0BmiyPmIS1c2fqlI5Lk7a8exO5LUHbaHpe4QrcKi0IkPv8t1uXI wR7sUdWa+YrGOTKq9l0/ujNJtIDjdc50iDa2I88VqAOVQ6BPuXX9+7f7o+yHD4mcOQvg1OArmg 5wLuqlCOW9Uo7VKPejqiaiK/2yNBuia3lqKwQ3Mt5Cj3+8AF38ZDhU73cHERkAQgdlQ8uYHe9c fWiy9nLmmmiMyhhf4zscuZHQGhgFbPvG+igbrRkMbBi27pRTqzVwWPt7TgI+U9PTef1e4QkvLr BiQ= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip01.wdc.com with ESMTP; 14 Sep 2023 09:07:17 -0700 From: Johannes Thumshirn Date: Thu, 14 Sep 2023 09:07:05 -0700 Subject: [PATCH v9 10/11] btrfs: add trace events for RST MIME-Version: 1.0 Message-Id: <20230914-raid-stripe-tree-v9-10-15d423829637@wdc.com> References: <20230914-raid-stripe-tree-v9-0-15d423829637@wdc.com> In-Reply-To: <20230914-raid-stripe-tree-v9-0-15d423829637@wdc.com> To: Chris Mason , Josef Bacik , David Sterba Cc: Christoph Hellwig , Naohiro Aota , Qu Wenruo , Damien Le Moal , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694707621; l=3855; i=johannes.thumshirn@wdc.com; s=20230613; h=from:subject:message-id; bh=dAFGj2lSFggsGCAxlAi8drVBv+UlMJSnIu/xYz5RsQY=; b=co+EasJda8IZv4EJ9EvHsTRizSP9zKL9+eZ6w2RoigsWuNiOAR9LVIw2Q4R8ZZC/iqO0y3r/c 1Ke0AyETENDD10rDl5cPeiBaPq5ayEuBcnIq2SDXmcZjB4vf8iJ60uu X-Developer-Key: i=johannes.thumshirn@wdc.com; a=ed25519; pk=TGmHKs78FdPi+QhrViEvjKIGwReUGCfa+3LEnGoR2KM= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 09:07:47 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777030678410022955 X-GMAIL-MSGID: 1777030678410022955 Add trace events for raid-stripe-tree operations. Signed-off-by: Johannes Thumshirn --- fs/btrfs/raid-stripe-tree.c | 8 +++++ include/trace/events/btrfs.h | 75 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c index 63bf62c33436..ee4155377bf9 100644 --- a/fs/btrfs/raid-stripe-tree.c +++ b/fs/btrfs/raid-stripe-tree.c @@ -62,6 +62,9 @@ int btrfs_delete_raid_extent(struct btrfs_trans_handle *trans, u64 start, if (found_end <= start) break; + trace_btrfs_raid_extent_delete(fs_info, start, end, + found_start, found_end); + ASSERT(found_start >= start && found_end <= end); ret = btrfs_del_item(trans, stripe_root, path); if (ret) @@ -94,6 +97,8 @@ static int btrfs_insert_one_raid_extent(struct btrfs_trans_handle *trans, return -ENOMEM; } + trace_btrfs_insert_one_raid_extent(fs_info, bioc->logical, bioc->size, + num_stripes); btrfs_set_stack_stripe_extent_encoding(stripe_extent, encoding); for (int i = 0; i < num_stripes; i++) { u64 devid = bioc->stripes[i].dev->devid; @@ -414,6 +419,9 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info, stripe->physical = physical + offset; + trace_btrfs_get_raid_extent_offset(fs_info, logical, *length, + stripe->physical, devid); + ret = 0; goto free_path; } diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index b2db2c2f1c57..fcf246f84547 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -2497,6 +2497,81 @@ DEFINE_EVENT(btrfs_raid56_bio, raid56_write, TP_ARGS(rbio, bio, trace_info) ); +TRACE_EVENT(btrfs_insert_one_raid_extent, + + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 logical, u64 length, + int num_stripes), + + TP_ARGS(fs_info, logical, length, num_stripes), + + TP_STRUCT__entry_btrfs( + __field( u64, logical ) + __field( u64, length ) + __field( int, num_stripes ) + ), + + TP_fast_assign_btrfs(fs_info, + __entry->logical = logical; + __entry->length = length; + __entry->num_stripes = num_stripes; + ), + + TP_printk_btrfs("logical=%llu length=%llu num_stripes=%d", + __entry->logical, __entry->length, + __entry->num_stripes) +); + +TRACE_EVENT(btrfs_raid_extent_delete, + + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 start, u64 end, + u64 found_start, u64 found_end), + + TP_ARGS(fs_info, start, end, found_start, found_end), + + TP_STRUCT__entry_btrfs( + __field( u64, start ) + __field( u64, end ) + __field( u64, found_start ) + __field( u64, found_end ) + ), + + TP_fast_assign_btrfs(fs_info, + __entry->start = start; + __entry->end = end; + __entry->found_start = found_start; + __entry->found_end = found_end; + ), + + TP_printk_btrfs("start=%llu end=%llu found_start=%llu found_end=%llu", + __entry->start, __entry->end, __entry->found_start, + __entry->found_end) +); + +TRACE_EVENT(btrfs_get_raid_extent_offset, + + TP_PROTO(const struct btrfs_fs_info *fs_info, u64 logical, u64 length, + u64 physical, u64 devid), + + TP_ARGS(fs_info, logical, length, physical, devid), + + TP_STRUCT__entry_btrfs( + __field( u64, logical ) + __field( u64, length ) + __field( u64, physical ) + __field( u64, devid ) + ), + + TP_fast_assign_btrfs(fs_info, + __entry->logical = logical; + __entry->length = length; + __entry->physical = physical; + __entry->devid = devid; + ), + + TP_printk_btrfs("logical=%llu length=%llu physical=%llu devid=%llu", + __entry->logical, __entry->length, __entry->physical, + __entry->devid) +); #endif /* _TRACE_BTRFS_H */ /* This part must be outside protection */