From patchwork Mon Oct 3 17:44:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12997696 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 B1251C433FE for ; Mon, 3 Oct 2022 17:44:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229679AbiJCRop (ORCPT ); Mon, 3 Oct 2022 13:44:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229672AbiJCRom (ORCPT ); Mon, 3 Oct 2022 13:44:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D213A304 for ; Mon, 3 Oct 2022 10:44:35 -0700 (PDT) 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 6F3E461193 for ; Mon, 3 Oct 2022 17:44:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DD4DC433D6; Mon, 3 Oct 2022 17:44:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664819074; bh=5GTGL4ViTtMMjSNBZ5MZJEzv17jU75OEbJty7Qu+baU=; h=From:To:Cc:Subject:Date:From; b=qQmyhtr56WTi20Feh1Apa0fKrh6m3Ov09Px1fMYHf8B6u1ijWy5XH87RWD3OzRqTG ihs7sGwMMMpjRY8eFLLCVGo5KlW4EVY4yZ4QBhfIyxBGYhVgxiZBr3Mil1t96v/WLU tEB2oBsal/xAXsYRGcfHLc1q4Q5Geu8JWust4unM7qYrDAQmNPxjXVsgzI2TJofmAZ AV10q8sga8XtOiudxE9cwqc5RT89pRIOEEsxb7w6DLv24XFhxlntEUOE+exusPVCR7 UI1JUw8n8hQtEu6C4OdZuHSkFiWEiei4Nta3yxW+7wPPHawtpJZzOYWf7G2xqlPZfs rbailgY+s3jnw== From: Anna Schumaker To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com Cc: anna@kernel.org Subject: [PATCH 1/3] NFSv4.2: Move TRACE_DEFINE_ENUM(NFS4_CONTENT_*) under CONFIG_NFS_V4_2 Date: Mon, 3 Oct 2022 13:44:31 -0400 Message-Id: <20221003174433.476685-1-anna@kernel.org> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker NFS4_CONTENT_DATA and NFS4_CONTENT_HOLE both only exist under NFS v4.2. Move their corresponding TRACE_DEFINE_ENUM calls under this Kconfig option. Signed-off-by: Anna Schumaker --- fs/nfs/nfs4trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index 6ee6ad3674a2..37c4c105ed29 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -2097,6 +2097,7 @@ TRACE_EVENT(ff_layout_commit_error, ) ); +#ifdef CONFIG_NFS_V4_2 TRACE_DEFINE_ENUM(NFS4_CONTENT_DATA); TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE); @@ -2105,7 +2106,6 @@ TRACE_DEFINE_ENUM(NFS4_CONTENT_HOLE); { NFS4_CONTENT_DATA, "DATA" }, \ { NFS4_CONTENT_HOLE, "HOLE" }) -#ifdef CONFIG_NFS_V4_2 TRACE_EVENT(nfs4_llseek, TP_PROTO( const struct inode *inode, From patchwork Mon Oct 3 17:44:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12997697 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 9CAB2C433F5 for ; Mon, 3 Oct 2022 17:44:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229630AbiJCRoq (ORCPT ); Mon, 3 Oct 2022 13:44:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiJCRom (ORCPT ); Mon, 3 Oct 2022 13:44:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AC1E316 for ; Mon, 3 Oct 2022 10:44:36 -0700 (PDT) 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 014A761189 for ; Mon, 3 Oct 2022 17:44:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17251C433D7; Mon, 3 Oct 2022 17:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664819075; bh=pwUwM5u8duBV7zxnFPO2/x3SgczSF72eJmMc09T5tQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bs0xThLEwEQQ+G/GZwsN43OQd8KjkWtJ/ZRQBGSEXqpb6rVtT8l0dCd4AqjwLTTrX 1pCqwR1Nlk/98ohq/+Nty24FUrvRbI5YzknQwknywT3oHctmnzfCa8wEeIzuWDb4RX R1VM/ycAQjZVJcutgzqkwJgmMReBKM6xV7XRek3MLODg95TwvW5rkMeaS2isiBGXLn mYWkTT64P1AvWpu7tTULaE4Hosr0MsskMdtdIkw7ITyg7/+WQgZOMppvOwsNbty47j QxG36chzD+qgCGtnWTy48abLoH4EAl7udBGW1M3CkyxqZggxHYQjlJdM1fzUu64RrK /xsYsD6qa9YAQ== From: Anna Schumaker To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com Cc: anna@kernel.org Subject: [PATCH 2/3] NFSv4.2: Add tracepoints for getxattr, setxattr, and removexattr Date: Mon, 3 Oct 2022 13:44:32 -0400 Message-Id: <20221003174433.476685-2-anna@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003174433.476685-1-anna@kernel.org> References: <20221003174433.476685-1-anna@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker These functions take similar arguments, and can share a tracepoint class for common formatting. Signed-off-by: Anna Schumaker --- fs/nfs/nfs42proc.c | 3 +++ fs/nfs/nfs4trace.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 6dab9e408372..c4791ca00df1 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -1175,6 +1175,7 @@ static int _nfs42_proc_removexattr(struct inode *inode, const char *name) ret = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 1); + trace_nfs4_removexattr(inode, name, ret); if (!ret) nfs4_update_changeattr(inode, &res.cinfo, timestamp, 0); @@ -1214,6 +1215,7 @@ static int _nfs42_proc_setxattr(struct inode *inode, const char *name, ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); + trace_nfs4_setxattr(inode, name, ret); for (; np > 0; np--) put_page(pages[np - 1]); @@ -1246,6 +1248,7 @@ static ssize_t _nfs42_proc_getxattr(struct inode *inode, const char *name, ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 0); + trace_nfs4_getxattr(inode, name, ret); if (ret < 0) return ret; diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index 37c4c105ed29..650c9353826f 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -2496,6 +2496,52 @@ TRACE_EVENT(nfs4_offload_cancel, __entry->stateid_seq, __entry->stateid_hash ) ); + +DECLARE_EVENT_CLASS(nfs4_xattr_event, + TP_PROTO( + const struct inode *inode, + const char *name, + int error + ), + + TP_ARGS(inode, name, error), + + TP_STRUCT__entry( + __field(unsigned long, error) + __field(dev_t, dev) + __field(u32, fhandle) + __field(u64, fileid) + __string(name, name) + ), + + TP_fast_assign( + __entry->error = error < 0 ? -error : 0; + __entry->dev = inode->i_sb->s_dev; + __entry->fileid = NFS_FILEID(inode); + __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode)); + __assign_str(name, name); + ), + + TP_printk( + "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x " + "name=%s", + -__entry->error, show_nfs4_status(__entry->error), + MAJOR(__entry->dev), MINOR(__entry->dev), + (unsigned long long)__entry->fileid, + __entry->fhandle, __get_str(name) + ) +); +#define DEFINE_NFS4_XATTR_EVENT(name) \ + DEFINE_EVENT(nfs4_xattr_event, name, \ + TP_PROTO( \ + const struct inode *inode, \ + const char *name, \ + int error \ + ), \ + TP_ARGS(inode, name, error)) +DEFINE_NFS4_XATTR_EVENT(nfs4_getxattr); +DEFINE_NFS4_XATTR_EVENT(nfs4_setxattr); +DEFINE_NFS4_XATTR_EVENT(nfs4_removexattr); #endif /* CONFIG_NFS_V4_2 */ #endif /* CONFIG_NFS_V4_1 */ From patchwork Mon Oct 3 17:44:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna Schumaker X-Patchwork-Id: 12997698 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 74586C4332F for ; Mon, 3 Oct 2022 17:44:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229486AbiJCRor (ORCPT ); Mon, 3 Oct 2022 13:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229705AbiJCRon (ORCPT ); Mon, 3 Oct 2022 13:44:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE5C339 for ; Mon, 3 Oct 2022 10:44:37 -0700 (PDT) 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 8AC6161195 for ; Mon, 3 Oct 2022 17:44:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B544C4347C; Mon, 3 Oct 2022 17:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664819076; bh=U/ajbWiZiy/3y7Ei2/ZUIip3krZuU+SEv1n69J+sxA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J32B7Au6RG52nAvCPqpJptR4HoUmmXCm3nAZCGGc6l8WQEv6y7EGok9Go+bEiIP0s DPf1bYAMeBp5WZo/eWwXcRjN+uJk4DWvqasm227i+YfszrO2E8g7bEoz3Upr7NXvhi 2z3CKkRNCt1HbtueShUzgq/Ok1b0+fF81EFa5LQu9IogvqeWbx0CjH+i/p04IT2jAq sOWZD7yo7c1ntkS55U6KOqMhGZUh1iwODIk9aZbkrj8sUU6gqoNbFxvvd549oPYnjw wPcLLatu2WaOBzCrhpHAwvW1rgs8Jt3CotpYd3vlVHk/sxW2ptKanekGxbGh6ykpFF yxTZQTyYFicYw== From: Anna Schumaker To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com Cc: anna@kernel.org Subject: [PATCH 3/3] NFSv4.2: Add a tracepoint for listxattr Date: Mon, 3 Oct 2022 13:44:33 -0400 Message-Id: <20221003174433.476685-3-anna@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003174433.476685-1-anna@kernel.org> References: <20221003174433.476685-1-anna@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker This can be defined as simply an NFS4_INODE_EVENT() since we don't have the name of a specific xattr to list. This roughly matches readdir, which also uses an NFS4_INODE_EVENT() tracepoint. Signed-off-by: Anna Schumaker --- fs/nfs/nfs42proc.c | 1 + fs/nfs/nfs4trace.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index c4791ca00df1..ced9170701b6 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -1320,6 +1320,7 @@ static ssize_t _nfs42_proc_listxattrs(struct inode *inode, void *buf, ret = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 0); + trace_nfs4_listxattr(inode, ret); if (ret >= 0) { ret = res.copied; diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h index 650c9353826f..2cff5901c689 100644 --- a/fs/nfs/nfs4trace.h +++ b/fs/nfs/nfs4trace.h @@ -2542,6 +2542,8 @@ DECLARE_EVENT_CLASS(nfs4_xattr_event, DEFINE_NFS4_XATTR_EVENT(nfs4_getxattr); DEFINE_NFS4_XATTR_EVENT(nfs4_setxattr); DEFINE_NFS4_XATTR_EVENT(nfs4_removexattr); + +DEFINE_NFS4_INODE_EVENT(nfs4_listxattr); #endif /* CONFIG_NFS_V4_2 */ #endif /* CONFIG_NFS_V4_1 */