Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4743362pxj; Tue, 25 May 2021 15:34:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3eE25Tuc9nCNx6SSbU24iBR9mRUpxJF0pkx4tvgJpF7nNlqupbGxCsN4ztBsZElrkUv7f X-Received: by 2002:a05:6402:34d5:: with SMTP id w21mr34322426edc.38.1621982048919; Tue, 25 May 2021 15:34:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621982048; cv=none; d=google.com; s=arc-20160816; b=PdTiLez9nZpKccXe4HBRqEFswlZyzjGwGg9FILu+ta2owRZQipMlg/+TKMMWGrUrD1 P44v5+20qP15jbQiaYm7QEs5yssVcmnkAz4IBhILggyYDcez8iTjqqTCJzzhclLTxgQC hllWoNqCsI2LgNNOuAJO5Hzuei0YWed5dX2t1qFA1cDCBkS9EMT9VNqtaVpNwnOm4ZsD WbbL1IE17UIhDuSG0G08D1i/vZDsIqehpRbsw7hEjTYBpkCB9zrP32Lg1hLiNhaRUNU3 xMlf5/eeeZNFpG8eHi2SW4lZxbkhcPp8oURpfWfIqg6EJaVvY9Qypgj6UPDJtzfqj6LV 3EfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=MiJl6qZD3NtAnrAn17UrmtlClz5d7dAYh/kY9Ifi1As=; b=vLPL5GGZ/K/4SSbY+L+X2VrzvN0ezHATZ01j4SKwEkAPeuxOHeTuSN7+8/ZakBPZLo KunfMc6VVv0MB41r8Lo0mCSqk8Azykd7zIuRKtymgNI6fcidaeHA09Ca97NKctGJtb+Q hOfB69ZopFE43NAMW6GDwIufyK6Bm9qMNe1BBrJldWP+fNTFLpYM/T1sPgHoVCJGRfVv q0oX9WJHOOEfin6ElsiB6j+Jq52nKMHt49EVppOoKIy/xXTesapFUACJcja8QmgdDLTB g3Gm0kxU4sr1wOKYD+ye1SeARVjQKvRGpeojgL3iJhLN0NF5C4Q7gg7hF08KBIu2tPGb 8tgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=luBb1phn; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si18736312edr.28.2021.05.25.15.33.45; Tue, 25 May 2021 15:34:08 -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=@fieldses.org header.s=default header.b=luBb1phn; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232080AbhEYVAS (ORCPT + 99 others); Tue, 25 May 2021 17:00:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbhEYVAS (ORCPT ); Tue, 25 May 2021 17:00:18 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03984C061574 for ; Tue, 25 May 2021 13:58:47 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id EA1886851; Tue, 25 May 2021 16:58:45 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org EA1886851 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1621976325; bh=MiJl6qZD3NtAnrAn17UrmtlClz5d7dAYh/kY9Ifi1As=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=luBb1phnpRjxwKBnOsxPkH1AWV+udq+EYwT0rfbF1oEpD5AZ0aY8cOUWRB2JgPdhs p2eiFHg1rhzNaNt+UVTAEWzcvbhSk59LKl1KIz2GvS25wLCO4lvdryGgAGBFT5Hv9z V0xjUO1nH6eomkBXQsZys7JkBXggyOXWnWzuD6Yw= Date: Tue, 25 May 2021 16:58:45 -0400 From: Bruce Fields To: Dave Wysochanski Cc: Chuck Lever III , linux-nfs@vger.kernel.org Subject: Re: [PATCH v2 1/1] nfsd4: Expose the callback address and state of each NFS4 client Message-ID: <20210525205845.GB4162@fieldses.org> References: <1621283385-24390-1-git-send-email-dwysocha@redhat.com> <1621283385-24390-2-git-send-email-dwysocha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1621283385-24390-2-git-send-email-dwysocha@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org When I run trace-cmd report I get output like: [nfsd:nfsd_cb_state] function cb_state2str not defined [nfsd:nfsd_cb_shutdown] function cb_state2str not defined [nfsd:nfsd_cb_probe] function cb_state2str not defined [nfsd:nfsd_cb_lost] function cb_state2str not defined I don't know how this is supposed to work. Is it OK for tracepoint definitions to reference kernel functions if they're defined in the right way somehow? If not, I don't know what the solution would be for sharing this--define a macro that expands to the array literal and use that in both places? Or maybe just live with the the redundancy. --b. On Mon, May 17, 2021 at 04:29:45PM -0400, Dave Wysochanski wrote: > In addition to the client's address, display the callback channel > state and address in the 'info' file. Define and use a common > function for this information that can be used by both callback > trace events and the NFS4 client 'info' file. > > Signed-off-by: Dave Wysochanski > --- > fs/nfsd/nfs4state.c | 2 ++ > fs/nfsd/trace.c | 15 +++++++++++++++ > fs/nfsd/trace.h | 9 ++------- > 3 files changed, 19 insertions(+), 7 deletions(-) > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index b2573d3ecd3c..f3b8221bb543 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -2385,6 +2385,8 @@ static int client_info_show(struct seq_file *m, void *v) > seq_printf(m, "\nImplementation time: [%lld, %ld]\n", > clp->cl_nii_time.tv_sec, clp->cl_nii_time.tv_nsec); > } > + seq_printf(m, "callback state: %s\n", cb_state2str(clp->cl_cb_state)); > + seq_printf(m, "callback address: %pISpc\n", &clp->cl_cb_conn.cb_addr); > drop_client(clp); > > return 0; > diff --git a/fs/nfsd/trace.c b/fs/nfsd/trace.c > index f008b95ceec2..6291b5d10824 100644 > --- a/fs/nfsd/trace.c > +++ b/fs/nfsd/trace.c > @@ -2,3 +2,18 @@ > > #define CREATE_TRACE_POINTS > #include "trace.h" > + > +const char *cb_state2str(const int state) > +{ > + switch (state) { > + case NFSD4_CB_UP: > + return "UP"; > + case NFSD4_CB_UNKNOWN: > + return "UNKNOWN"; > + case NFSD4_CB_DOWN: > + return "DOWN"; > + case NFSD4_CB_FAULT: > + return "FAULT"; > + } > + return "UNDEFINED"; > +} > diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h > index 10cc3aaf1089..8908d48b2aa6 100644 > --- a/fs/nfsd/trace.h > +++ b/fs/nfsd/trace.h > @@ -876,12 +876,7 @@ > TP_printk("client %08x:%08x", __entry->cl_boot, __entry->cl_id) > ) > > -#define show_cb_state(val) \ > - __print_symbolic(val, \ > - { NFSD4_CB_UP, "UP" }, \ > - { NFSD4_CB_UNKNOWN, "UNKNOWN" }, \ > - { NFSD4_CB_DOWN, "DOWN" }, \ > - { NFSD4_CB_FAULT, "FAULT"}) > +const char *cb_state2str(const int state); > > DECLARE_EVENT_CLASS(nfsd_cb_class, > TP_PROTO(const struct nfs4_client *clp), > @@ -901,7 +896,7 @@ > ), > TP_printk("addr=%pISpc client %08x:%08x state=%s", > __entry->addr, __entry->cl_boot, __entry->cl_id, > - show_cb_state(__entry->state)) > + cb_state2str(__entry->state)) > ); > > #define DEFINE_NFSD_CB_EVENT(name) \ > -- > 1.8.3.1