Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3084026pxb; Mon, 18 Oct 2021 07:57:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXVrujOe3ujWhWCWKfJppjgT/YOwj5gl7dvNz0bYy+YKdKMHBpqViivbcxN4CYoO35NOJI X-Received: by 2002:a05:6402:c11:: with SMTP id co17mr3043385edb.36.1634569046886; Mon, 18 Oct 2021 07:57:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634569046; cv=none; d=google.com; s=arc-20160816; b=aXzAqZTS789BYrRhYQ+KSyDh1Ji/HmIAXjaj4MUZyIZlhXqL/JHu2LXovlqTjGtLbS YGplQT45XhaJLR2wj/DZiKo38rdzlRKtgQVvtmSPQafSXjuZIUdqMkwLV8qDxbek93w/ uLZiB+nEOW98zajwkfyKHTnt687aH/kUvev7A7cK+5C3qiekd4YC6nrOIQxOJIwhTR21 VZ3HRdkTnFfwBtlYh637fbRICeK4lKEEKqm2iIgboP8d92nqX97y0UxDpfX/1cA1JBMM HhXb9zl8qf5nrI0DctohDU1mzodI/woXty28GL/MNYQtsjVWymln+GcVLr8z/daBUVJk FGeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:dkim-signature; bh=0IGgvCu7e2XQhbY70i8TSPJVNJmFP5Vsi2waD4HEQVM=; b=MzOn9e4SJ5lP5MbTzNxrvMzr6NvmFmB+XdXyBFH5Pm6T2xS+T3ifMbugbMtFvjzL3u 5YNzD1w9jt9/KxIXjbiYwr/+PMhOA0oUcz70wJ0QQC+/3a4YdrEKQS3BlH2UWc7ePcTg Q/M7zwhGBu2+kzYz39h0rXCp2f3CgxT+r3JDoPQZJ2HAuAkXiNg7RiQ4xlXPHzKo8WQL tgd5ZIEAsu/CVcIuqtYhmBEkhlWFA6cFbOXzO5mBc2mulmECJFVs+Dk6/VQQ4q5Hq7Hd VFiTVvu2zQXIGpcJAekfQWff0wI4w19oL6qHkH2XzCLtb5X9Jr60Dfkg5ihxaoI3m8NZ fYBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EtELqXaq; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 5si21789655ejq.621.2021.10.18.07.57.02; Mon, 18 Oct 2021 07:57:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EtELqXaq; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232349AbhJRO7L (ORCPT + 99 others); Mon, 18 Oct 2021 10:59:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20035 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232385AbhJRO7I (ORCPT ); Mon, 18 Oct 2021 10:59:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634569017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0IGgvCu7e2XQhbY70i8TSPJVNJmFP5Vsi2waD4HEQVM=; b=EtELqXaqt4iPvuEkmUVvYTi64E9wEVjEGTg7ObiLzhwu+F5XmtARcW4KMoTDzZbFvrm1oR 4seOMpXzUZjjtqxpkkBvxrnhJlotQ/WosnuPwR1XQj52XunPALkTKO/4TLi59PAFNInn9x ZiinTtuVzaUfEEBAGI0rskiAfFHMcZQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-226-YOy2swJJMP6NZIQxWFL5mw-1; Mon, 18 Oct 2021 10:56:52 -0400 X-MC-Unique: YOy2swJJMP6NZIQxWFL5mw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2BB418D6A36; Mon, 18 Oct 2021 14:56:49 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99AE7100E809; Mon, 18 Oct 2021 14:56:46 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 23/67] cachefiles: trace: Improve the lookup tracepoint From: David Howells To: linux-cachefs@redhat.com Cc: dhowells@redhat.com, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Jeff Layton , Matthew Wilcox , Alexander Viro , Omar Sandoval , Linus Torvalds , linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 18 Oct 2021 15:56:45 +0100 Message-ID: <163456900574.2614702.12478396115896341195.stgit@warthog.procyon.org.uk> In-Reply-To: <163456861570.2614702.14754548462706508617.stgit@warthog.procyon.org.uk> References: <163456861570.2614702.14754548462706508617.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Improve the cachefiles_lookup tracepoint: - Don't display the dentry address, since it's going to get hashed. - Do display any error code. - Work out the inode in the tracepoint rather than in the caller so that the logic is conditional on the tracepoint being enabled. Signed-off-by: David Howells --- fs/cachefiles/namei.c | 4 +--- include/trace/events/cachefiles.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index 10b6d571eda8..b5a0aec529af 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c @@ -340,14 +340,12 @@ static int cachefiles_walk_to_file(struct cachefiles_cache *cache, inode_lock_nested(dinode, I_MUTEX_PARENT); dentry = lookup_one_len(object->d_name, fan, object->d_name_len); + trace_cachefiles_lookup(object, dentry); if (IS_ERR(dentry)) { - trace_cachefiles_lookup(object, dentry, NULL); ret = PTR_ERR(dentry); goto error; } - trace_cachefiles_lookup(object, dentry, d_backing_inode(dentry)); - if (d_is_negative(dentry)) { /* This element of the path doesn't exist, so we can release * any readers in the certain knowledge that there's nothing diff --git a/include/trace/events/cachefiles.h b/include/trace/events/cachefiles.h index bd0b5bbd3889..87681dd957ec 100644 --- a/include/trace/events/cachefiles.h +++ b/include/trace/events/cachefiles.h @@ -98,25 +98,25 @@ TRACE_EVENT(cachefiles_ref, TRACE_EVENT(cachefiles_lookup, TP_PROTO(struct cachefiles_object *obj, - struct dentry *de, - struct inode *inode), + struct dentry *de), - TP_ARGS(obj, de, inode), + TP_ARGS(obj, de), TP_STRUCT__entry( __field(unsigned int, obj ) - __field(struct dentry *, de ) - __field(struct inode *, inode ) + __field(short, error ) + __field(unsigned long, ino ) ), TP_fast_assign( __entry->obj = obj->fscache.debug_id; - __entry->de = de; - __entry->inode = inode; + __entry->ino = (!IS_ERR(de) && d_backing_inode(de) ? + d_backing_inode(de)->i_ino : 0); + __entry->error = IS_ERR(de) ? PTR_ERR(de) : 0; ), - TP_printk("o=%08x d=%p i=%p", - __entry->obj, __entry->de, __entry->inode) + TP_printk("o=%08x i=%lx e=%d", + __entry->obj, __entry->ino, __entry->error) ); TRACE_EVENT(cachefiles_create,