From patchwork Tue Nov 28 09:31:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13470737 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7C93CC4167B for ; Tue, 28 Nov 2023 09:32:10 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1r7uRs-0005pk-Ey; Tue, 28 Nov 2023 09:32:08 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r7uRn-0005pe-D8 for linux-f2fs-devel@lists.sourceforge.net; Tue, 28 Nov 2023 09:32:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=KfcTND6BssLdpzmPYPlDYig9sIrB6I9wGFcgPo8r/xE=; b=keYZzDblLwHEIZIjEBE6QUUxkh cM9sG+ZS7JLNgQvUdJmJX6u3H5alNxuCPic/DvUIW3R2Zsj5io2iex1oB9CTknvCr43XBWRTtVfAP 4dxSmNdB3J+yLB/rEFSku20w2Kj+iASvVuoWb3ggqVQ+qvizENWboHYXzYMZ7KJ19VmY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=KfcTND6BssLdpzmPYPlDYig9sIrB6I9wGFcgPo8r/xE=; b=h Nu14OUnyzuv/j+Vk60V65hVex5afR7lnk4wZ9y/U73I2fDrG4Y7Dt5Dw8BhzhkgE51wsJbzCJC4Dj 117jCsaqKAiypkdMSGaQbqb26JHeaNKi3jTGAIB+ApfR6Y0cP1maUC25Emwd431frnH9d/hYGLj+O I4/BXkdJe/pA2kz4=; Received: from ams.source.kernel.org ([145.40.68.75]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1r7uRk-0001Q4-Ei for linux-f2fs-devel@lists.sourceforge.net; Tue, 28 Nov 2023 09:32:03 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 0294EB8397B for ; Tue, 28 Nov 2023 09:31:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08D9CC433C9; Tue, 28 Nov 2023 09:31:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701163896; bh=2Dql++FKHJ8HVSjhd3VZ6CSZcME1Follek+sE8aZeJw=; h=From:To:Cc:Subject:Date:From; b=uM+SHt9GX2KUqUvXgBd787svm6ARgraDkrqYaF6Egelrh2xG59GlsMUcB7PuMpCpw 6N6MzY5q9OOYsB05ub5yHlVUthLCGmAjeYYBhQLo8bWgSgomf5/qUpyYjJCRD30das N3FEk2RSidtpASei6n2AU0i/C3+jf5QHGIii/tT3QBJiDoB+i3aeu13+MWd0VGgp7S S2tM2q5R2MNnicIEWoZfhFeh5QihqXBK/A8QNrHzd64rPxH8tifvfOy35jpC/AIqCw gwucsOqVaa7KilE2a0EZDW4PrF8FDCwSJAv1yFCTNiYH7md9gHQI0U3s7Dui9Ldj53 CRgxi4y927gLg== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 28 Nov 2023 17:31:29 +0800 Message-Id: <20231128093130.2885216-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Headers-End: 1r7uRk-0001Q4-Ei Subject: [f2fs-dev] [PATCH 1/2] f2fs: introduce tracepoint for f2fs_rename() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This patch adds tracepoints for f2fs_rename(). Signed-off-by: Chao Yu --- fs/f2fs/namei.c | 16 ++++++--- include/trace/events/f2fs.h | 69 +++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index a765db9e26c2..ede6afb81762 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -1315,21 +1315,27 @@ static int f2fs_rename2(struct mnt_idmap *idmap, if (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT)) return -EINVAL; + trace_f2fs_rename_start(old_dir, old_dentry, new_dir, new_dentry, + flags); + err = fscrypt_prepare_rename(old_dir, old_dentry, new_dir, new_dentry, flags); if (err) return err; - if (flags & RENAME_EXCHANGE) { - return f2fs_cross_rename(old_dir, old_dentry, - new_dir, new_dentry); - } + if (flags & RENAME_EXCHANGE) + err = f2fs_cross_rename(old_dir, old_dentry, + new_dir, new_dentry); + else /* * VFS has already handled the new dentry existence case, * here, we just deal with "RENAME_NOREPLACE" as regular rename. */ - return f2fs_rename(idmap, old_dir, old_dentry, + err = f2fs_rename(idmap, old_dir, old_dentry, new_dir, new_dentry, flags); + + trace_f2fs_rename_end(old_dentry, new_dentry, flags, err); + return err; } static const char *f2fs_encrypted_get_link(struct dentry *dentry, diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 793f82cc1515..36d9e29ca3c5 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -866,6 +866,75 @@ TRACE_EVENT(f2fs_lookup_end, __entry->err) ); +TRACE_EVENT(f2fs_rename_start, + + TP_PROTO(struct inode *old_dir, struct dentry *old_dentry, + struct inode *new_dir, struct dentry *new_dentry, + unsigned int flags), + + TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, flags), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __string(old_name, old_dentry->d_name.name) + __field(ino_t, new_pino) + __string(new_name, new_dentry->d_name.name) + __field(unsigned int, flags) + ), + + TP_fast_assign( + __entry->dev = old_dir->i_sb->s_dev; + __entry->ino = old_dir->i_ino; + __assign_str(old_name, old_dentry->d_name.name); + __entry->new_pino = new_dir->i_ino; + __assign_str(new_name, new_dentry->d_name.name); + __entry->flags = flags; + ), + + TP_printk("dev = (%d,%d), old_dir = %lu, old_name: %s, " + "new_dir = %lu, new_name: %s, flags = %u", + show_dev_ino(__entry), + __get_str(old_name), + __entry->new_pino, + __get_str(new_name), + __entry->flags) +); + +TRACE_EVENT(f2fs_rename_end, + + TP_PROTO(struct dentry *old_dentry, struct dentry *new_dentry, + unsigned int flags, int ret), + + TP_ARGS(old_dentry, new_dentry, flags, ret), + + TP_STRUCT__entry( + __field(dev_t, dev) + __field(ino_t, ino) + __string(old_name, old_dentry->d_name.name) + __string(new_name, new_dentry->d_name.name) + __field(unsigned int, flags) + __field(int, ret) + ), + + TP_fast_assign( + __entry->dev = old_dentry->d_sb->s_dev; + __entry->ino = old_dentry->d_inode->i_ino; + __assign_str(old_name, old_dentry->d_name.name); + __assign_str(new_name, new_dentry->d_name.name); + __entry->flags = flags; + __entry->ret = ret; + ), + + TP_printk("dev = (%d,%d), ino = %lu, old_name: %s, " + "new_name: %s, flags = %u, ret = %d", + show_dev_ino(__entry), + __get_str(old_name), + __get_str(new_name), + __entry->flags, + __entry->ret) +); + TRACE_EVENT(f2fs_readdir, TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err), From patchwork Tue Nov 28 09:31:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13470736 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 lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB09CC4167B for ; Tue, 28 Nov 2023 09:32:03 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1r7uRn-0000kx-Q0; Tue, 28 Nov 2023 09:32:02 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1r7uRi-0000kq-LA for linux-f2fs-devel@lists.sourceforge.net; Tue, 28 Nov 2023 09:31:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Yrf0Ha5B2dVQ1oyjwhbawOKsSsKx44e9w1NM0Ljj7Is=; b=de8Flm8y/zmNSGxf/cq7EHZGiE /gmgrcDnXHrIx90rl1ey3VuHwOi19AYUoPcMp365sG9rfQraw64yOs0YbfdieIwK+Nd9YaQZcEz+i UokjmfN4ft6YLvUaqTuL2inxJqFcxzFEwwdGjhrrGELVSfUqDq/4gXhPI4GYC728hdgo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Yrf0Ha5B2dVQ1oyjwhbawOKsSsKx44e9w1NM0Ljj7Is=; b=iIllh/GomkgnoHja7UjOPwdq2s bIj7m0mqUfCiFSN6Ek5LqMZROFSbeEy+EiNPcOaWSQ7na9CwfNaMHB0grSX/WDM1+eBRVLbOkAhom uc9oUC67Pd9pCAHDS7QhRKp51lqro0TVEbmt9C99JM+Wv5jMXJQqNmlKgK7THz5xaTp4=; Received: from ams.source.kernel.org ([145.40.68.75]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1r7uRV-0001Pn-6i for linux-f2fs-devel@lists.sourceforge.net; Tue, 28 Nov 2023 09:31:49 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id E5C4CB8399B for ; Tue, 28 Nov 2023 09:31:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E569BC433C7; Tue, 28 Nov 2023 09:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701163898; bh=G4S7OaZ+7+gNaP/ANhOUYrSGPJa7mnRp3UrQ13Aljts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qfoI+uJu2cYqV1quN6GEoY4pCDQoAKo0iNtVygR0GM8h9rYdGgSFovSUq5fsp3DCN XR+bFFHllMZOdmUp36p1PQsjWXcdmmFjihsNpv8BHhj9C5Uv4PI7mrN5NvgMkiE9py vCRGCbgBt9k4Bq788JiNDjMGU8uuVklRGZIlU0vv5xo3pqsrUG95wo3CDIuyUcOEDl 9LKaRi2KZFPmvn22MBt5odlp4lV5XLs1yrZe4Our8dSOGpROTUIglCJ4wsD6LH2wdO 7C47lXZZFmWGIMxlc1r433jYvzujanL5pfrVbQEKGxqQF68ZOOtA3fGtXzW5uhX9x1 wwzh3a//mHh9A== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 28 Nov 2023 17:31:30 +0800 Message-Id: <20231128093130.2885216-2-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231128093130.2885216-1-chao@kernel.org> References: <20231128093130.2885216-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1r7uRV-0001Pn-6i Subject: [f2fs-dev] [PATCH 2/2] f2fs: show i_mode in trace_f2fs_new_inode() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This patch supports to show i_mode field in trace_f2fs_new_inode(). Signed-off-by: Chao Yu --- include/trace/events/f2fs.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/include/trace/events/f2fs.h b/include/trace/events/f2fs.h index 36d9e29ca3c5..479d26eae22f 100644 --- a/include/trace/events/f2fs.h +++ b/include/trace/events/f2fs.h @@ -161,6 +161,19 @@ TRACE_DEFINE_ENUM(EX_BLOCK_AGE); { EX_READ, "Read" }, \ { EX_BLOCK_AGE, "Block Age" }) +#define show_inode_type(x) \ + __print_symbolic(x, \ + { S_IFLNK, "symbolic" }, \ + { S_IFREG, "regular" }, \ + { S_IFDIR, "directory" }, \ + { S_IFCHR, "character" }, \ + { S_IFBLK, "block" }, \ + { S_IFIFO, "fifo" }, \ + { S_IFSOCK, "sock" }) + +#define S_ALL_PERM (S_ISUID | S_ISGID | S_ISVTX | \ + S_IRWXU | S_IRWXG | S_IRWXO) + struct f2fs_sb_info; struct f2fs_io_info; struct extent_info; @@ -215,17 +228,21 @@ DECLARE_EVENT_CLASS(f2fs__inode_exit, TP_STRUCT__entry( __field(dev_t, dev) __field(ino_t, ino) + __field(umode_t, mode) __field(int, ret) ), TP_fast_assign( __entry->dev = inode->i_sb->s_dev; __entry->ino = inode->i_ino; + __entry->mode = inode->i_mode; __entry->ret = ret; ), - TP_printk("dev = (%d,%d), ino = %lu, ret = %d", + TP_printk("dev = (%d,%d), ino = %lu, type: %s, mode = 0%o, ret = %d", show_dev_ino(__entry), + show_inode_type(__entry->mode & S_IFMT), + __entry->mode & S_ALL_PERM, __entry->ret) );