From patchwork Fri Jan 5 19:51:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 10147055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5DEB160153 for ; Fri, 5 Jan 2018 20:54:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE1CA28926 for ; Fri, 5 Jan 2018 20:54:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E32E528929; Fri, 5 Jan 2018 20:54:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89D4E28926 for ; Fri, 5 Jan 2018 20:54:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752985AbeAEUyT (ORCPT ); Fri, 5 Jan 2018 15:54:19 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:35599 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752931AbeAEUyL (ORCPT ); Fri, 5 Jan 2018 15:54:11 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.21/8.16.0.21) with SMTP id w05KqOUY024178 for ; Fri, 5 Jan 2018 20:54:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=BfYpVt5e2jlcL44O8LW+ozkXCH++SjXam5N8ta6DbZ0=; b=gMmgE52iP6hbJPQHUV57jcabnCG+SPjeeh0yIj54PMoQeHHmrOgQxZRAzOcj5XHMKnBL EFOHGksRVlxarx/21o1f/rVqijiuo1weQvUe/a/VhFpiIAPtL+c3gpwrti6LNDXAanhX 429RBo0not5AinHox8WHmX24ytNQexhxG8A3NlTXef+sUILFSxIjmVcPzfTUGfvkSyQL FdVCB32wZiEEZHJHfcE6xorkHUYTinSB0Cpr9Vbh847xoSTlMN7Zb2A04JtGoQrjbE5K zPkoE/NR60y38h8eNCTAj9KJJG6PF+s+TjbDwMSnwIADeFrReIV2s6iJgd4RjPKHFAzk Tw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2fagex02gc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 05 Jan 2018 20:54:10 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w05KsAWp000508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 5 Jan 2018 20:54:10 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w05KsACO000483 for ; Fri, 5 Jan 2018 20:54:10 GMT Received: from dhcp-10-211-47-181.usdhcp.oraclecorp.com.com (/10.211.47.181) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 05 Jan 2018 12:54:10 -0800 From: Liu Bo To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 09/10] Btrfs: add tracepoint for em's EEXIST case Date: Fri, 5 Jan 2018 12:51:16 -0700 Message-Id: <20180105195117.5131-10-bo.li.liu@oracle.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20180105195117.5131-1-bo.li.liu@oracle.com> References: <20180105195117.5131-1-bo.li.liu@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8765 signatures=668651 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=5 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=883 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801050287 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is adding a tracepoint 'btrfs_handle_em_exist' to help debug the subtle bugs around merge_extent_mapping. Signed-off-by: Liu Bo Reviewed-by: Josef Bacik --- fs/btrfs/extent_map.c | 3 +++ include/trace/events/btrfs.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index b5d0add..a5a1d17 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c @@ -552,6 +552,9 @@ int btrfs_add_extent_mapping(struct extent_map_tree *em_tree, ret = 0; existing = search_extent_mapping(em_tree, start, len); + + trace_btrfs_handle_em_exist(existing, em, start, len); + /* * existing will always be non-NULL, since there must be * extent causing the -EEXIST. diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index 4342a32..b7ffcf7 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -249,6 +249,41 @@ TRACE_EVENT_CONDITION(btrfs_get_extent, __entry->refs, __entry->compress_type) ); +TRACE_EVENT(btrfs_handle_em_exist, + + TP_PROTO(const struct extent_map *existing, const struct extent_map *map, u64 start, u64 len), + + TP_ARGS(existing, map, start, len), + + TP_STRUCT__entry( + __field( u64, e_start ) + __field( u64, e_len ) + __field( u64, map_start ) + __field( u64, map_len ) + __field( u64, start ) + __field( u64, len ) + ), + + TP_fast_assign( + __entry->e_start = existing->start; + __entry->e_len = existing->len; + __entry->map_start = map->start; + __entry->map_len = map->len; + __entry->start = start; + __entry->len = len; + ), + + TP_printk("start=%llu len=%llu " + "existing(start=%llu len=%llu) " + "em(start=%llu len=%llu)", + (unsigned long long)__entry->start, + (unsigned long long)__entry->len, + (unsigned long long)__entry->e_start, + (unsigned long long)__entry->e_len, + (unsigned long long)__entry->map_start, + (unsigned long long)__entry->map_len) +); + /* file extent item */ DECLARE_EVENT_CLASS(btrfs__file_extent_item_regular,