All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/7] ntfs3: add tracepoints for core filesystem paths
@ 2026-08-20  9:04 Baolin Liu
  2026-08-20  9:04 ` [PATCH v4 1/7] ntfs3: add mount and log replay tracepoints Baolin Liu
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Baolin Liu @ 2026-08-20  9:04 UTC (permalink / raw)
  To: almaz.alexandrovich, rostedt, mhiramat, mathieu.desnoyers
  Cc: linux-kernel, ntfs3, linux-trace-kernel, liubaolin12138,
	liubaolin12138, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

This series adds an initial set of tracepoints for ntfs3 core paths.

The tracepoints cover:
   - mount and log replay
   - namei operations
   - directory index operations
   - allocation and block mapping
   - iomap operations
   - file I/O entry points

Changes in v4 (both addressing review comments on patch 5):
   - ntfs3_attr_data_get_block: pass the "new" pointer to the trace
     event directly and move the "new != NULL" check into
     TP_fast_assign(), keeping that logic out of the call site and only
     executed when the event is enabled
   - ntfs3_attr_set_size_ex: stop sampling the old size with
     i_size_read() in TP_fast_assign() - on the truncate path
     truncate_setsize() has already updated i_size to the new value, so
     the recorded old_size always equaled new_size. Read the actual old
     size from the on-disk attribute record and pass it as an explicit
     parameter; move the call site after the attribute lookup so both
     resident and non-resident attributes are covered

Baolin Liu (7):
  ntfs3: add mount and log replay tracepoints
  ntfs3: add namei tracepoints
  ntfs3: add create inode tracepoint
  ntfs3: add directory index tracepoints
  ntfs3: add allocation tracepoints
  ntfs3: add iomap tracepoints
  ntfs3: add file I/O tracepoints

 MAINTAINERS                  |   1 +
 fs/ntfs3/attrib.c            |  12 ++
 fs/ntfs3/dir.c               |   3 +
 fs/ntfs3/file.c              |   5 +
 fs/ntfs3/fslog.c             |   3 +
 fs/ntfs3/index.c             |   8 +
 fs/ntfs3/inode.c             |   7 +
 fs/ntfs3/namei.c             |   5 +
 fs/ntfs3/super.c             |  11 +-
 include/trace/events/ntfs3.h | 389 +++++++++++++++++++++++++++++++++++
 10 files changed, 443 insertions(+), 1 deletion(-)
 create mode 100644 include/trace/events/ntfs3.h

-- 
2.51.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4 1/7] ntfs3: add mount and log replay tracepoints
  2026-08-20  9:04 [PATCH v4 0/7] ntfs3: add tracepoints for core filesystem paths Baolin Liu
@ 2026-08-20  9:04 ` Baolin Liu
  2026-08-20  9:04 ` [PATCH v4 2/7] ntfs3: add namei tracepoints Baolin Liu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Baolin Liu @ 2026-08-20  9:04 UTC (permalink / raw)
  To: almaz.alexandrovich, rostedt, mhiramat, mathieu.desnoyers
  Cc: linux-kernel, ntfs3, linux-trace-kernel, liubaolin12138,
	liubaolin12138, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

Add ntfs3 tracepoints for mount and log replay paths.

This adds trace events for ntfs_fill_super(), ntfs_init_from_boot(),
and log_replay() to help observe mount setup, boot sector parsing,
and $LogFile replay results.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 MAINTAINERS                  |  1 +
 fs/ntfs3/fslog.c             |  3 ++
 fs/ntfs3/super.c             | 11 ++++-
 include/trace/events/ntfs3.h | 85 ++++++++++++++++++++++++++++++++++++
 4 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 include/trace/events/ntfs3.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 8014b9f8253e..a8e2ea4acef8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19296,6 +19296,7 @@ W:	http://www.paragon-software.com/
 T:	git https://github.com/Paragon-Software-Group/linux-ntfs3.git
 F:	Documentation/filesystems/ntfs3.rst
 F:	fs/ntfs3/
+F:	include/trace/events/ntfs3.h
 
 NTSYNC SYNCHRONIZATION PRIMITIVE DRIVER
 M:	Elizabeth Figura <zfigura@codeweavers.com>
diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
index f038c799e7ac..5020da7e72f1 100644
--- a/fs/ntfs3/fslog.c
+++ b/fs/ntfs3/fslog.c
@@ -13,6 +13,7 @@
 #include "debug.h"
 #include "ntfs.h"
 #include "ntfs_fs.h"
+#include <trace/events/ntfs3.h>
 
 /*
  * LOG FILE structs
@@ -5362,6 +5363,8 @@ int log_replay(struct ntfs_inode *ni, bool *initialized)
 	else if (log->set_dirty)
 		ntfs_set_state(sbi, NTFS_DIRTY_ERROR);
 
+	trace_ntfs3_log_replay(&ni->vfs_inode, *initialized, err);
+
 	kfree(log);
 
 	return err;
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 3305fe406cb2..7034ef257452 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -76,6 +76,9 @@
 #include "lib/lib.h"
 #endif
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/ntfs3.h>
+
 #ifdef CONFIG_PRINTK
 /*
  * ntfs_printk - Trace warnings/notices/errors.
@@ -956,7 +959,7 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
 {
 	struct ntfs_sb_info *sbi = sb->s_fs_info;
 	int err;
-	u32 mb, gb, boot_sector_size, sct_per_clst, record_size;
+	u32 mb, gb, boot_sector_size = 0, sct_per_clst, record_size;
 	u64 sectors, clusters, mlcn, mlcn2, dev_size0;
 	struct NTFS_BOOT *boot;
 	struct buffer_head *bh;
@@ -1216,6 +1219,8 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
 	}
 
 out:
+	trace_ntfs3_init_from_boot(sb, sector_size, boot_sector_size,
+				 !!boot_block, err);
 	brelse(bh);
 
 	if (err == -EINVAL && !boot_block && dev_size0 > PAGE_SHIFT) {
@@ -1731,12 +1736,16 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)
 	}
 
 	ntfs_create_procdir(sb);
+	trace_ntfs3_fill_super(sb, ro, sbi->cluster_size, sbi->record_size,
+			      sbi->index_size, 0);
 
 	return 0;
 
 put_inode_out:
 	iput(inode);
 out:
+	trace_ntfs3_fill_super(sb, ro, sbi->cluster_size, sbi->record_size,
+			      sbi->index_size, err);
 	/* sbi->options == options */
 	if (options) {
 		put_mount_options(sbi->options);
diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
new file mode 100644
index 000000000000..a45f919cb33e
--- /dev/null
+++ b/include/trace/events/ntfs3.h
@@ -0,0 +1,85 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM ntfs3
+
+#if !defined(_TRACE_NTFS3_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_NTFS3_H
+
+#include <linux/fs.h>
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(ntfs3_fill_super,
+	TP_PROTO(struct super_block *sb, bool ro, u32 cluster_size,
+		 u32 record_size, u32 index_size, int err),
+	TP_ARGS(sb, ro, cluster_size, record_size, index_size, err),
+	TP_STRUCT__entry(
+		__field(dev_t, dev)
+		__field(u32, cluster_size)
+		__field(u32, record_size)
+		__field(u32, index_size)
+		__field(int, err)
+		__field(bool, ro)
+	),
+	TP_fast_assign(
+		__entry->dev = sb->s_bdev->bd_dev;
+		__entry->cluster_size = cluster_size;
+		__entry->record_size = record_size;
+		__entry->index_size = index_size;
+		__entry->err = err;
+		__entry->ro = ro;
+	),
+	TP_printk("dev=(%d,%d) ro=%d cluster=%u record=%u index=%u err=%d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ro,
+		  __entry->cluster_size, __entry->record_size,
+		  __entry->index_size, __entry->err)
+);
+
+TRACE_EVENT(ntfs3_init_from_boot,
+	TP_PROTO(struct super_block *sb, u32 media_sector_size,
+		 u32 boot_sector_size, bool used_alt_boot, int err),
+	TP_ARGS(sb, media_sector_size, boot_sector_size, used_alt_boot, err),
+	TP_STRUCT__entry(
+		__field(dev_t, dev)
+		__field(u32, media_sector_size)
+		__field(u32, boot_sector_size)
+		__field(int, err)
+		__field(bool, used_alt_boot)
+	),
+	TP_fast_assign(
+		__entry->dev = sb->s_bdev->bd_dev;
+		__entry->media_sector_size = media_sector_size;
+		__entry->boot_sector_size = boot_sector_size;
+		__entry->err = err;
+		__entry->used_alt_boot = used_alt_boot;
+	),
+	TP_printk("dev=(%d,%d) media_sector=%u boot_sector=%u alt_boot=%d err=%d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->media_sector_size, __entry->boot_sector_size,
+		  __entry->used_alt_boot, __entry->err)
+);
+
+TRACE_EVENT(ntfs3_log_replay,
+	TP_PROTO(struct inode *inode, bool initialized, int err),
+	TP_ARGS(inode, initialized, err),
+	TP_STRUCT__entry(
+		__field(unsigned long, ino)
+		__field(loff_t, size)
+		__field(dev_t, dev)
+		__field(int, err)
+		__field(bool, initialized)
+	),
+	TP_fast_assign(
+		__entry->ino = inode->i_ino;
+		__entry->size = i_size_read(inode);
+		__entry->dev = inode->i_sb->s_dev;
+		__entry->err = err;
+		__entry->initialized = initialized;
+	),
+	TP_printk("dev=(%d,%d) ino=%lu size=%lld initialized=%d err=%d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
+		  __entry->size, __entry->initialized, __entry->err)
+);
+
+#endif /* _TRACE_NTFS3_H */
+
+#include <trace/define_trace.h>
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 2/7] ntfs3: add namei tracepoints
  2026-08-20  9:04 [PATCH v4 0/7] ntfs3: add tracepoints for core filesystem paths Baolin Liu
  2026-08-20  9:04 ` [PATCH v4 1/7] ntfs3: add mount and log replay tracepoints Baolin Liu
@ 2026-08-20  9:04 ` Baolin Liu
  2026-08-20  9:05 ` [PATCH v4 3/7] ntfs3: add create inode tracepoint Baolin Liu
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Baolin Liu @ 2026-08-20  9:04 UTC (permalink / raw)
  To: almaz.alexandrovich, rostedt, mhiramat, mathieu.desnoyers
  Cc: linux-kernel, ntfs3, linux-trace-kernel, liubaolin12138,
	liubaolin12138, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

Add ntfs3 tracepoints for namei operations.

This adds trace events for ntfs_lookup() and ntfs_rename()
to help observe directory lookup and rename activity.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 fs/ntfs3/namei.c             |  5 ++++
 include/trace/events/ntfs3.h | 44 ++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index c59de5f2fa97..c1523decee32 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -13,6 +13,7 @@
 #include "debug.h"
 #include "ntfs.h"
 #include "ntfs_fs.h"
+#include <trace/events/ntfs3.h>
 
 /*
  * fill_name_de - Format NTFS_DE in @buf.
@@ -72,6 +73,8 @@ static struct dentry *ntfs_lookup(struct inode *dir, struct dentry *dentry,
 	struct inode *inode;
 	int err;
 
+	trace_ntfs3_lookup(dir, dentry);
+
 	if (!uni)
 		inode = ERR_PTR(-ENOMEM);
 	else {
@@ -275,6 +278,8 @@ static int ntfs_rename(struct mnt_idmap *idmap, struct inode *dir,
 	if (unlikely(ntfs3_forced_shutdown(sb)))
 		return -EIO;
 
+	trace_ntfs3_rename(dir, dentry, new_dir, new_dentry);
+
 	if (flags & ~RENAME_NOREPLACE)
 		return -EINVAL;
 
diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
index a45f919cb33e..a1e4bdb6ec59 100644
--- a/include/trace/events/ntfs3.h
+++ b/include/trace/events/ntfs3.h
@@ -80,6 +80,50 @@ TRACE_EVENT(ntfs3_log_replay,
 		  __entry->size, __entry->initialized, __entry->err)
 );
 
+TRACE_EVENT(ntfs3_lookup,
+	TP_PROTO(struct inode *dir, struct dentry *dentry),
+	TP_ARGS(dir, dentry),
+	TP_STRUCT__entry(
+		__field(unsigned long, parent_ino)
+		__field(dev_t, dev)
+		__string(name, dentry->d_name.name)
+	),
+	TP_fast_assign(
+		__entry->parent_ino = dir->i_ino;
+		__entry->dev = dir->i_sb->s_dev;
+		__assign_str(name);
+	),
+	TP_printk("dev=(%d,%d) parent=%lu name=%s",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->parent_ino, __get_str(name))
+);
+
+TRACE_EVENT(ntfs3_rename,
+	TP_PROTO(struct inode *dir, struct dentry *dentry,
+		 struct inode *new_dir, struct dentry *new_dentry),
+	TP_ARGS(dir, dentry, new_dir, new_dentry),
+	TP_STRUCT__entry(
+		__field(unsigned long, dir_ino)
+		__field(unsigned long, new_dir_ino)
+		__field(unsigned long, ino)
+		__field(dev_t, dev)
+		__string(old_name, dentry->d_name.name)
+		__string(new_name, new_dentry->d_name.name)
+	),
+	TP_fast_assign(
+		__entry->dir_ino = dir->i_ino;
+		__entry->new_dir_ino = new_dir->i_ino;
+		__entry->ino = d_inode(dentry)->i_ino;
+		__entry->dev = dir->i_sb->s_dev;
+		__assign_str(old_name);
+		__assign_str(new_name);
+	),
+	TP_printk("dev=(%d,%d) dir=%lu new_dir=%lu ino=%lu old=%s new=%s",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->dir_ino, __entry->new_dir_ino, __entry->ino,
+		  __get_str(old_name), __get_str(new_name))
+);
+
 #endif /* _TRACE_NTFS3_H */
 
 #include <trace/define_trace.h>
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 3/7] ntfs3: add create inode tracepoint
  2026-08-20  9:04 [PATCH v4 0/7] ntfs3: add tracepoints for core filesystem paths Baolin Liu
  2026-08-20  9:04 ` [PATCH v4 1/7] ntfs3: add mount and log replay tracepoints Baolin Liu
  2026-08-20  9:04 ` [PATCH v4 2/7] ntfs3: add namei tracepoints Baolin Liu
@ 2026-08-20  9:05 ` Baolin Liu
  2026-08-20  9:05 ` [PATCH v4 4/7] ntfs3: add directory index tracepoints Baolin Liu
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Baolin Liu @ 2026-08-20  9:05 UTC (permalink / raw)
  To: almaz.alexandrovich, rostedt, mhiramat, mathieu.desnoyers
  Cc: linux-kernel, ntfs3, linux-trace-kernel, liubaolin12138,
	liubaolin12138, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

Add an ntfs3 tracepoint for inode creation.

This adds a trace event for ntfs_create_inode() to help
observe inode creation activity.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 fs/ntfs3/inode.c             |  3 +++
 include/trace/events/ntfs3.h | 18 ++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 0c9bd669117d..4c427ed69272 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -17,6 +17,7 @@
 #include "debug.h"
 #include "ntfs.h"
 #include "ntfs_fs.h"
+#include <trace/events/ntfs3.h>
 
 /*
  * ntfs_read_mft - Read record and parse MFT.
@@ -1203,6 +1204,8 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
 	/* New file will be resident or non resident. */
 	const bool new_file_resident = 1;
 
+	trace_ntfs3_create_inode(dir, dentry);
+
 	if (!fnd)
 		ni_lock_dir(dir_ni);
 
diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
index a1e4bdb6ec59..67a2bde0266d 100644
--- a/include/trace/events/ntfs3.h
+++ b/include/trace/events/ntfs3.h
@@ -124,6 +124,24 @@ TRACE_EVENT(ntfs3_rename,
 		  __get_str(old_name), __get_str(new_name))
 );
 
+TRACE_EVENT(ntfs3_create_inode,
+	TP_PROTO(struct inode *dir, struct dentry *dentry),
+	TP_ARGS(dir, dentry),
+	TP_STRUCT__entry(
+		__field(unsigned long, parent_ino)
+		__field(dev_t, dev)
+		__string(name, dentry->d_name.name)
+	),
+	TP_fast_assign(
+		__entry->parent_ino = dir->i_ino;
+		__entry->dev = dir->i_sb->s_dev;
+		__assign_str(name);
+	),
+	TP_printk("dev=(%d,%d) parent=%lu name=%s",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->parent_ino, __get_str(name))
+);
+
 #endif /* _TRACE_NTFS3_H */
 
 #include <trace/define_trace.h>
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 4/7] ntfs3: add directory index tracepoints
  2026-08-20  9:04 [PATCH v4 0/7] ntfs3: add tracepoints for core filesystem paths Baolin Liu
                   ` (2 preceding siblings ...)
  2026-08-20  9:05 ` [PATCH v4 3/7] ntfs3: add create inode tracepoint Baolin Liu
@ 2026-08-20  9:05 ` Baolin Liu
  2026-08-20  9:17   ` sashiko-bot
  2026-08-20  9:05 ` [PATCH v4 5/7] ntfs3: add allocation tracepoints Baolin Liu
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Baolin Liu @ 2026-08-20  9:05 UTC (permalink / raw)
  To: almaz.alexandrovich, rostedt, mhiramat, mathieu.desnoyers
  Cc: linux-kernel, ntfs3, linux-trace-kernel, liubaolin12138,
	liubaolin12138, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

Add ntfs3 tracepoints for directory index operations.

This adds trace events for dir_search_u(), indx_find(),
indx_insert_entry(), and indx_delete_entry() to help observe
directory index lookup, insert, and delete activity.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 fs/ntfs3/dir.c               |  3 ++
 fs/ntfs3/index.c             |  8 ++++
 include/trace/events/ntfs3.h | 81 ++++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+)

diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
index 873d52233003..eb10e7ff45bc 100644
--- a/fs/ntfs3/dir.c
+++ b/fs/ntfs3/dir.c
@@ -14,6 +14,7 @@
 #include "debug.h"
 #include "ntfs.h"
 #include "ntfs_fs.h"
+#include <trace/events/ntfs3.h>
 
 /* Convert little endian UTF-16 to NLS string. */
 int ntfs_utf16_to_nls(struct ntfs_sb_info *sbi, const __le16 *name, u32 len,
@@ -243,6 +244,8 @@ struct inode *dir_search_u(struct inode *dir, const struct cpu_str *uni,
 	struct inode *inode = NULL;
 	struct ntfs_fnd *fnd_a = NULL;
 
+	trace_ntfs3_dir_search_u(dir, uni ? uni->len : 0);
+
 	if (!fnd) {
 		fnd_a = fnd_get();
 		if (!fnd_a) {
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 2b439ac04356..d4ca7b1bb524 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -13,6 +13,7 @@
 #include "debug.h"
 #include "ntfs.h"
 #include "ntfs_fs.h"
+#include <trace/events/ntfs3.h>
 
 static const struct INDEX_NAMES {
 	const __le16 *name;
@@ -1179,6 +1180,8 @@ int indx_find(struct ntfs_index *indx, struct ntfs_inode *ni,
 	if (!root)
 		root = indx_get_root(&ni->dir, ni, NULL, NULL);
 
+	trace_ntfs3_indx_find(&ni->vfs_inode, indx->type, key_len);
+
 	if (!root) {
 		/* Should not happen. */
 		return -EINVAL;
@@ -2051,6 +2054,9 @@ int indx_insert_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
 		return -EINVAL;
 	}
 
+	trace_ntfs3_indx_insert_entry(&ni->vfs_inode, indx->type,
+				      le16_to_cpu(new_de->key_size), undo);
+
 	if (fnd_is_empty(fnd)) {
 		/*
 		 * Find the spot the tree where we want to
@@ -2409,6 +2415,8 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
 		return -EINVAL;
 	}
 
+	trace_ntfs3_indx_delete_entry(&ni->vfs_inode, indx->type, key_len);
+
 	/* Locate the entry to remove. */
 	err = indx_find(indx, ni, root, key, key_len, ctx, &diff, &e, fnd);
 	if (err)
diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
index 67a2bde0266d..4ac05ed29e49 100644
--- a/include/trace/events/ntfs3.h
+++ b/include/trace/events/ntfs3.h
@@ -142,6 +142,87 @@ TRACE_EVENT(ntfs3_create_inode,
 		  __entry->parent_ino, __get_str(name))
 );
 
+TRACE_EVENT(ntfs3_dir_search_u,
+	TP_PROTO(struct inode *dir, unsigned int name_len),
+	TP_ARGS(dir, name_len),
+	TP_STRUCT__entry(
+		__field(unsigned long, dir_ino)
+		__field(dev_t, dev)
+		__field(unsigned int, name_len)
+	),
+	TP_fast_assign(
+		__entry->dir_ino = dir->i_ino;
+		__entry->dev = dir->i_sb->s_dev;
+		__entry->name_len = name_len;
+	),
+	TP_printk("dev=(%d,%d) dir=%lu name_len=%u",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->dir_ino, __entry->name_len)
+);
+
+TRACE_EVENT(ntfs3_indx_find,
+	TP_PROTO(struct inode *inode, u8 type, size_t key_len),
+	TP_ARGS(inode, type, key_len),
+	TP_STRUCT__entry(
+		__field(unsigned long, ino)
+		__field(size_t, key_len)
+		__field(dev_t, dev)
+		__field(u8, type)
+	),
+	TP_fast_assign(
+		__entry->ino = inode->i_ino;
+		__entry->key_len = key_len;
+		__entry->dev = inode->i_sb->s_dev;
+		__entry->type = type;
+	),
+	TP_printk("dev=(%d,%d) ino=%lu type=%u key_len=%zu",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->ino, __entry->type, __entry->key_len)
+);
+
+TRACE_EVENT(ntfs3_indx_insert_entry,
+	TP_PROTO(struct inode *inode, u8 type, u16 key_len, bool undo),
+	TP_ARGS(inode, type, key_len, undo),
+	TP_STRUCT__entry(
+		__field(unsigned long, ino)
+		__field(dev_t, dev)
+		__field(u16, key_len)
+		__field(u8, type)
+		__field(bool, undo)
+	),
+	TP_fast_assign(
+		__entry->ino = inode->i_ino;
+		__entry->dev = inode->i_sb->s_dev;
+		__entry->key_len = key_len;
+		__entry->type = type;
+		__entry->undo = undo;
+	),
+	TP_printk("dev=(%d,%d) ino=%lu type=%u key_len=%u undo=%d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->ino, __entry->type, __entry->key_len,
+		  __entry->undo)
+);
+
+TRACE_EVENT(ntfs3_indx_delete_entry,
+	TP_PROTO(struct inode *inode, u8 type, u32 key_len),
+	TP_ARGS(inode, type, key_len),
+	TP_STRUCT__entry(
+		__field(unsigned long, ino)
+		__field(u32, key_len)
+		__field(dev_t, dev)
+		__field(u8, type)
+	),
+	TP_fast_assign(
+		__entry->ino = inode->i_ino;
+		__entry->key_len = key_len;
+		__entry->dev = inode->i_sb->s_dev;
+		__entry->type = type;
+	),
+	TP_printk("dev=(%d,%d) ino=%lu type=%u key_len=%u",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->ino, __entry->type, __entry->key_len)
+);
+
 #endif /* _TRACE_NTFS3_H */
 
 #include <trace/define_trace.h>
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 5/7] ntfs3: add allocation tracepoints
  2026-08-20  9:04 [PATCH v4 0/7] ntfs3: add tracepoints for core filesystem paths Baolin Liu
                   ` (3 preceding siblings ...)
  2026-08-20  9:05 ` [PATCH v4 4/7] ntfs3: add directory index tracepoints Baolin Liu
@ 2026-08-20  9:05 ` Baolin Liu
  2026-08-20  9:05 ` [PATCH v4 6/7] ntfs3: add iomap tracepoints Baolin Liu
  2026-08-20  9:05 ` [PATCH v4 7/7] ntfs3: add file I/O tracepoints Baolin Liu
  6 siblings, 0 replies; 11+ messages in thread
From: Baolin Liu @ 2026-08-20  9:05 UTC (permalink / raw)
  To: almaz.alexandrovich, rostedt, mhiramat, mathieu.desnoyers
  Cc: linux-kernel, ntfs3, linux-trace-kernel, liubaolin12138,
	liubaolin12138, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

Add ntfs3 tracepoints for allocation operations.

This adds trace events for attr_allocate_clusters(),
attr_set_size_ex(), and attr_data_get_block() to help
observe cluster allocation, size changes, and block
mapping activity.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 fs/ntfs3/attrib.c            | 12 ++++++
 include/trace/events/ntfs3.h | 78 ++++++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)

diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index c621a4c582f9..8c4a14a87721 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -13,6 +13,7 @@
 #include "debug.h"
 #include "ntfs.h"
 #include "ntfs_fs.h"
+#include <trace/events/ntfs3.h>
 
 /*
  * You can set external NTFS_MIN_LOG2_OF_CLUMP/NTFS_MAX_LOG2_OF_CLUMP to manage
@@ -167,6 +168,8 @@ int attr_allocate_clusters(struct ntfs_sb_info *sbi, struct runs_tree *run,
 	CLST flen, vcn0 = vcn, pre = pre_alloc ? *pre_alloc : 0;
 	size_t cnt = run->count;
 
+	trace_ntfs3_attr_allocate_clusters(sbi->sb, vcn, lcn, len, opt);
+
 	for (;;) {
 		err = ntfs_look_for_free_space(sbi, lcn, len + pre, &lcn, &flen,
 					       opt);
@@ -462,6 +465,12 @@ int attr_set_size_ex(struct ntfs_inode *ni, enum ATTR_TYPE type,
 		goto bad_inode;
 	}
 
+	trace_ntfs3_attr_set_size_ex(&ni->vfs_inode, le32_to_cpu(type),
+				     attr_b->non_res ?
+					     le64_to_cpu(attr_b->nres.data_size) :
+					     le32_to_cpu(attr_b->res.data_size),
+				     new_size, keep_prealloc, no_da);
+
 	if (!attr_b->non_res) {
 		err = attr_set_size_res(ni, attr_b, le_b, mi_b, new_size, run,
 					&attr_b);
@@ -960,6 +969,9 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,
 	if (res)
 		*res = NULL;
 
+	trace_ntfs3_attr_data_get_block(&ni->vfs_inode, vcn, clen, new, zero,
+					no_da);
+
 	/* Try to find in cache. */
 	down_read(&ni->file.run_lock);
 	if (run_lookup_entry_da(&ni->file.run, !no_da ? &ni->file.run_da : NULL,
diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
index 4ac05ed29e49..e39765bc062f 100644
--- a/include/trace/events/ntfs3.h
+++ b/include/trace/events/ntfs3.h
@@ -223,6 +223,84 @@ TRACE_EVENT(ntfs3_indx_delete_entry,
 		  __entry->ino, __entry->type, __entry->key_len)
 );
 
+TRACE_EVENT(ntfs3_attr_allocate_clusters,
+	TP_PROTO(struct super_block *sb, u64 vcn, u64 lcn, u64 len, u32 opt),
+	TP_ARGS(sb, vcn, lcn, len, opt),
+	TP_STRUCT__entry(
+		__field(u64, vcn)
+		__field(u64, lcn)
+		__field(u64, len)
+		__field(dev_t, dev)
+		__field(u32, opt)
+	),
+	TP_fast_assign(
+		__entry->vcn = vcn;
+		__entry->lcn = lcn;
+		__entry->len = len;
+		__entry->dev = sb->s_dev;
+		__entry->opt = opt;
+	),
+	TP_printk("dev=(%d,%d) vcn=%llu lcn=%llu len=%llu opt=0x%x",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->vcn, __entry->lcn, __entry->len, __entry->opt)
+);
+
+TRACE_EVENT(ntfs3_attr_set_size_ex,
+	TP_PROTO(struct inode *inode, u32 type, u64 old_size, u64 new_size,
+		 bool keep_prealloc, bool no_da),
+	TP_ARGS(inode, type, old_size, new_size, keep_prealloc, no_da),
+	TP_STRUCT__entry(
+		__field(u64, old_size)
+		__field(u64, new_size)
+		__field(unsigned long, ino)
+		__field(dev_t, dev)
+		__field(u32, type)
+		__field(bool, keep_prealloc)
+		__field(bool, no_da)
+	),
+	TP_fast_assign(
+		__entry->old_size = old_size;
+		__entry->new_size = new_size;
+		__entry->ino = inode->i_ino;
+		__entry->dev = inode->i_sb->s_dev;
+		__entry->type = type;
+		__entry->keep_prealloc = keep_prealloc;
+		__entry->no_da = no_da;
+	),
+	TP_printk("dev=(%d,%d) ino=%lu type=0x%x old_size=%llu new_size=%llu keep_prealloc=%d no_da=%d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
+		  __entry->type, __entry->old_size, __entry->new_size,
+		  __entry->keep_prealloc, __entry->no_da)
+);
+
+TRACE_EVENT(ntfs3_attr_data_get_block,
+	TP_PROTO(struct inode *inode, u64 vcn, u64 clen, bool *new,
+		 bool zero, bool no_da),
+	TP_ARGS(inode, vcn, clen, new, zero, no_da),
+	TP_STRUCT__entry(
+		__field(u64, vcn)
+		__field(u64, clen)
+		__field(unsigned long, ino)
+		__field(dev_t, dev)
+		__field(bool, create)
+		__field(bool, zero)
+		__field(bool, no_da)
+	),
+	TP_fast_assign(
+		__entry->vcn = vcn;
+		__entry->clen = clen;
+		__entry->ino = inode->i_ino;
+		__entry->dev = inode->i_sb->s_dev;
+		__entry->create = !!new;
+		__entry->zero = zero;
+		__entry->no_da = no_da;
+	),
+	TP_printk("dev=(%d,%d) ino=%lu vcn=%llu clen=%llu create=%d zero=%d no_da=%d",
+		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
+		  __entry->vcn, __entry->clen, __entry->create,
+		  __entry->zero, __entry->no_da)
+);
+
 #endif /* _TRACE_NTFS3_H */
 
 #include <trace/define_trace.h>
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 6/7] ntfs3: add iomap tracepoints
  2026-08-20  9:04 [PATCH v4 0/7] ntfs3: add tracepoints for core filesystem paths Baolin Liu
                   ` (4 preceding siblings ...)
  2026-08-20  9:05 ` [PATCH v4 5/7] ntfs3: add allocation tracepoints Baolin Liu
@ 2026-08-20  9:05 ` Baolin Liu
  2026-08-20  9:19   ` sashiko-bot
  2026-08-20  9:05 ` [PATCH v4 7/7] ntfs3: add file I/O tracepoints Baolin Liu
  6 siblings, 1 reply; 11+ messages in thread
From: Baolin Liu @ 2026-08-20  9:05 UTC (permalink / raw)
  To: almaz.alexandrovich, rostedt, mhiramat, mathieu.desnoyers
  Cc: linux-kernel, ntfs3, linux-trace-kernel, liubaolin12138,
	liubaolin12138, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

Add ntfs3 tracepoints for iomap operations.

This adds trace events for ntfs_iomap_begin() and
ntfs_iomap_end() to help observe iomap mapping activity.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 fs/ntfs3/inode.c             |  4 +++
 include/trace/events/ntfs3.h | 50 ++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 4c427ed69272..54bf5225fa47 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -741,6 +741,8 @@ static int ntfs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
 	bool new_clst = false;
 	bool no_da;
 	bool zero = false;
+
+	trace_ntfs3_iomap_begin(inode, offset, length, flags);
 	if (unlikely(ntfs3_forced_shutdown(sbi->sb)))
 		return -EIO;
 
@@ -879,6 +881,8 @@ static int ntfs_iomap_end(struct inode *inode, loff_t pos, loff_t length,
 	struct ntfs_inode *ni = ntfs_i(inode);
 	loff_t endbyte = pos + written;
 
+	trace_ntfs3_iomap_end(inode, pos, length, written, flags);
+
 	if ((flags & IOMAP_WRITE) || (flags & IOMAP_ZERO)) {
 		if (iomap->type == IOMAP_INLINE) {
 			u32 data_size;
diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
index e39765bc062f..e0c0c44ce318 100644
--- a/include/trace/events/ntfs3.h
+++ b/include/trace/events/ntfs3.h
@@ -301,6 +301,56 @@ TRACE_EVENT(ntfs3_attr_data_get_block,
 		  __entry->zero, __entry->no_da)
 );
 
+TRACE_EVENT(ntfs3_iomap_begin,
+	TP_PROTO(struct inode *inode, loff_t offset, loff_t length,
+		 unsigned int flags),
+	TP_ARGS(inode, offset, length, flags),
+	TP_STRUCT__entry(
+		__field(unsigned long, ino)
+		__field(loff_t, offset)
+		__field(loff_t, length)
+		__field(dev_t, dev)
+		__field(unsigned int, flags)
+	),
+	TP_fast_assign(
+		__entry->ino = inode->i_ino;
+		__entry->offset = offset;
+		__entry->length = length;
+		__entry->dev = inode->i_sb->s_dev;
+		__entry->flags = flags;
+	),
+	TP_printk("dev=(%d,%d) ino=%lu offset=%lld length=%lld flags=0x%x",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->ino, __entry->offset, __entry->length,
+		  __entry->flags)
+);
+
+TRACE_EVENT(ntfs3_iomap_end,
+	TP_PROTO(struct inode *inode, loff_t pos, loff_t length,
+		 ssize_t written, unsigned int flags),
+	TP_ARGS(inode, pos, length, written, flags),
+	TP_STRUCT__entry(
+		__field(unsigned long, ino)
+		__field(loff_t, pos)
+		__field(loff_t, length)
+		__field(ssize_t, written)
+		__field(dev_t, dev)
+		__field(unsigned int, flags)
+	),
+	TP_fast_assign(
+		__entry->ino = inode->i_ino;
+		__entry->pos = pos;
+		__entry->length = length;
+		__entry->written = written;
+		__entry->dev = inode->i_sb->s_dev;
+		__entry->flags = flags;
+	),
+	TP_printk("dev=(%d,%d) ino=%lu pos=%lld length=%lld written=%zd flags=0x%x",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->ino, __entry->pos, __entry->length,
+		  __entry->written, __entry->flags)
+);
+
 #endif /* _TRACE_NTFS3_H */
 
 #include <trace/define_trace.h>
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 7/7] ntfs3: add file I/O tracepoints
  2026-08-20  9:04 [PATCH v4 0/7] ntfs3: add tracepoints for core filesystem paths Baolin Liu
                   ` (5 preceding siblings ...)
  2026-08-20  9:05 ` [PATCH v4 6/7] ntfs3: add iomap tracepoints Baolin Liu
@ 2026-08-20  9:05 ` Baolin Liu
  2026-08-20  9:19   ` sashiko-bot
  6 siblings, 1 reply; 11+ messages in thread
From: Baolin Liu @ 2026-08-20  9:05 UTC (permalink / raw)
  To: almaz.alexandrovich, rostedt, mhiramat, mathieu.desnoyers
  Cc: linux-kernel, ntfs3, linux-trace-kernel, liubaolin12138,
	liubaolin12138, Baolin Liu

From: Baolin Liu <liubaolin@kylinos.cn>

Add ntfs3 tracepoints for file I/O operations.

This adds trace events for ntfs_file_read_iter() and
ntfs_file_write_iter() to help observe file read and
write activity.

Signed-off-by: Baolin Liu <liubaolin@kylinos.cn>
---
 fs/ntfs3/file.c              |  5 +++++
 include/trace/events/ntfs3.h | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index d601f088618c..a260a57ebd65 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -20,6 +20,7 @@
 #include "debug.h"
 #include "ntfs.h"
 #include "ntfs_fs.h"
+#include <trace/events/ntfs3.h>
 
 /*
  * cifx, btrfs, exfat, ext4, f2fs use this constant.
@@ -822,6 +823,8 @@ static ssize_t ntfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
 	unsigned int dio_flags;
 	ssize_t err;
 
+	trace_ntfs3_file_read_iter(iocb, iter);
+
 	err = check_read_restriction(inode);
 	if (err)
 		return err;
@@ -1225,6 +1228,8 @@ static ssize_t ntfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	loff_t vbo, endbyte;
 	ssize_t ret, err;
 
+	trace_ntfs3_file_write_iter(iocb, from);
+
 	if (!inode_trylock(inode)) {
 		if (iocb->ki_flags & IOCB_NOWAIT)
 			return -EAGAIN;
diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
index e0c0c44ce318..750300068984 100644
--- a/include/trace/events/ntfs3.h
+++ b/include/trace/events/ntfs3.h
@@ -351,6 +351,39 @@ TRACE_EVENT(ntfs3_iomap_end,
 		  __entry->written, __entry->flags)
 );
 
+DECLARE_EVENT_CLASS(ntfs3_file_class,
+	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
+	TP_ARGS(iocb, iter),
+	TP_STRUCT__entry(
+		__field(loff_t, size)
+		__field(loff_t, offset)
+		__field(size_t, count)
+		__field(unsigned long, ino)
+		__field(dev_t, dev)
+	),
+	TP_fast_assign(
+		__entry->size = i_size_read(file_inode(iocb->ki_filp));
+		__entry->offset = iocb->ki_pos;
+		__entry->count = iov_iter_count(iter);
+		__entry->ino = file_inode(iocb->ki_filp)->i_ino;
+		__entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
+	),
+	TP_printk("dev=(%d,%d) ino=%lu size=%lld pos=%lld bytecount=%zu",
+		  MAJOR(__entry->dev), MINOR(__entry->dev),
+		  __entry->ino, __entry->size, __entry->offset,
+		  __entry->count)
+);
+
+DEFINE_EVENT(ntfs3_file_class, ntfs3_file_read_iter,
+	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
+	TP_ARGS(iocb, iter)
+);
+
+DEFINE_EVENT(ntfs3_file_class, ntfs3_file_write_iter,
+	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
+	TP_ARGS(iocb, iter)
+);
+
 #endif /* _TRACE_NTFS3_H */
 
 #include <trace/define_trace.h>
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 4/7] ntfs3: add directory index tracepoints
  2026-08-20  9:05 ` [PATCH v4 4/7] ntfs3: add directory index tracepoints Baolin Liu
@ 2026-08-20  9:17   ` sashiko-bot
  0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-08-20  9:17 UTC (permalink / raw)
  To: Baolin Liu; +Cc: linux-trace-kernel

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] Tracepoints silently truncate 64-bit inode numbers on 32-bit platforms.

Pre-existing issues:
- [High] Pre-existing memory leaks of `struct ntfs_fnd` objects in the error paths of index modification functions.
--

--- Patch [4]: [PATCH v4 4/7] ntfs3: add directory index tracepoints ---
commit c766c411cdb54b2e6d2b021851b232bc13e68d08
Author: Baolin Liu <liubaolin@kylinos.cn>

ntfs3: add directory index tracepoints

Add ntfs3 tracepoints for directory index operations.

This adds trace events for dir_search_u(), indx_find(),
indx_insert_entry(), and indx_delete_entry() to help observe
directory index lookup, insert, and delete activity.

> diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
> index 2b439ac043563..d4ca7b1bb5249 100644
> --- a/fs/ntfs3/index.c
> +++ b/fs/ntfs3/index.c

[ ... ]

> @@ -2051,6 +2054,9 @@ int indx_insert_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
>  		return -EINVAL;
>  	}

[Severity: High]
This isn't a bug introduced by this patch, but does this direct return in
indx_insert_entry() leak the fnd_a memory?

Earlier in this function, memory is allocated:

	if (!fnd) {
		fnd_a = fnd_get();
...

And then later when checking the collation rule:

	cmp = get_cmp_func(root);
	if (unlikely(!cmp)) {
		WARN_ON_ONCE(1);
		return -EINVAL;
	}

If get_cmp_func() returns NULL due to an unrecognized collation rule, shouldn't
this jump to the `out` label so that fnd_a can be properly freed?

>  
> +	trace_ntfs3_indx_insert_entry(&ni->vfs_inode, indx->type,
> +				      le16_to_cpu(new_de->key_size), undo);
> +
>  	if (fnd_is_empty(fnd)) {

[ ... ]

> @@ -2409,6 +2415,8 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
>  		return -EINVAL;
>  	}

[Severity: High]
This is a pre-existing issue, but does this direct return in
indx_delete_entry() leak both the fnd and fnd2 memory?

Similar to indx_insert_entry(), this function allocates memory:

	fnd = fnd_get();
...
	fnd2 = fnd_get();

Then if get_cmp_func() returns NULL:

	cmp = get_cmp_func(root);
	if (unlikely(!cmp)) {
		WARN_ON_ONCE(1);
		return -EINVAL;
	}

Shouldn't this go to the `out` label to clean up the memory instead of
returning directly?

>  
> +	trace_ntfs3_indx_delete_entry(&ni->vfs_inode, indx->type, key_len);
> +
>  	/* Locate the entry to remove. */
>  	err = indx_find(indx, ni, root, key, key_len, ctx, &diff, &e, fnd);

> diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
> index 67a2bde0266df..4ac05ed29e49d 100644
> --- a/include/trace/events/ntfs3.h
> +++ b/include/trace/events/ntfs3.h

[ ... ]

> @@ -142,6 +142,87 @@ TRACE_EVENT(ntfs3_create_inode,
>  		  __entry->parent_ino, __get_str(name))
>  );
>  
> +TRACE_EVENT(ntfs3_dir_search_u,
> +	TP_PROTO(struct inode *dir, unsigned int name_len),
> +	TP_ARGS(dir, name_len),
> +	TP_STRUCT__entry(
> +		__field(unsigned long, dir_ino)

[Severity: Low]
Since the i_ino field in struct inode is a u64, will declaring this field as
unsigned long truncate 64-bit inode numbers on 32-bit architectures?

> +		__field(dev_t, dev)
> +		__field(unsigned int, name_len)
> +	),
> +	TP_fast_assign(
> +		__entry->dir_ino = dir->i_ino;
> +		__entry->dev = dir->i_sb->s_dev;
> +		__entry->name_len = name_len;
> +	),
> +	TP_printk("dev=(%d,%d) dir=%lu name_len=%u",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev),
> +		  __entry->dir_ino, __entry->name_len)
> +);
> +
> +TRACE_EVENT(ntfs3_indx_find,
> +	TP_PROTO(struct inode *inode, u8 type, size_t key_len),
> +	TP_ARGS(inode, type, key_len),
> +	TP_STRUCT__entry(
> +		__field(unsigned long, ino)

[Severity: Low]
Will this also truncate 64-bit inode numbers on 32-bit architectures?

> +		__field(size_t, key_len)
> +		__field(dev_t, dev)
> +		__field(u8, type)
> +	),
> +	TP_fast_assign(
> +		__entry->ino = inode->i_ino;
> +		__entry->key_len = key_len;
> +		__entry->dev = inode->i_sb->s_dev;
> +		__entry->type = type;
> +	),
> +	TP_printk("dev=(%d,%d) ino=%lu type=%u key_len=%zu",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev),
> +		  __entry->ino, __entry->type, __entry->key_len)
> +);
> +
> +TRACE_EVENT(ntfs3_indx_insert_entry,
> +	TP_PROTO(struct inode *inode, u8 type, u16 key_len, bool undo),
> +	TP_ARGS(inode, type, key_len, undo),
> +	TP_STRUCT__entry(
> +		__field(unsigned long, ino)

[Severity: Low]
Will this also truncate 64-bit inode numbers on 32-bit architectures?

> +		__field(dev_t, dev)
> +		__field(u16, key_len)
> +		__field(u8, type)
> +		__field(bool, undo)
> +	),
> +	TP_fast_assign(
> +		__entry->ino = inode->i_ino;
> +		__entry->dev = inode->i_sb->s_dev;
> +		__entry->key_len = key_len;
> +		__entry->type = type;
> +		__entry->undo = undo;
> +	),
> +	TP_printk("dev=(%d,%d) ino=%lu type=%u key_len=%u undo=%d",
> +		  MAJOR(__entry->dev), MINOR(__entry->dev),
> +		  __entry->ino, __entry->type, __entry->key_len,
> +		  __entry->undo)
> +);
> +
> +TRACE_EVENT(ntfs3_indx_delete_entry,
> +	TP_PROTO(struct inode *inode, u8 type, u32 key_len),
> +	TP_ARGS(inode, type, key_len),
> +	TP_STRUCT__entry(
> +		__field(unsigned long, ino)

[Severity: Low]
Will this also truncate 64-bit inode numbers on 32-bit architectures?

> +		__field(u32, key_len)
> +		__field(dev_t, dev)
> +		__field(u8, type)
> +	),

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260820090504.950475-1-liubaolin12138@163.com?part=4

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 7/7] ntfs3: add file I/O tracepoints
  2026-08-20  9:05 ` [PATCH v4 7/7] ntfs3: add file I/O tracepoints Baolin Liu
@ 2026-08-20  9:19   ` sashiko-bot
  0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-08-20  9:19 UTC (permalink / raw)
  To: Baolin Liu; +Cc: linux-trace-kernel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Tracepoint truncates the 64-bit inode number to 32 bits on 32-bit architectures.
--

--- Patch [7]: [PATCH v4 7/7] ntfs3: add file I/O tracepoints ---
commit 49c2384143cc4908780b467e9d3b31597d86cf97
Author: Baolin Liu <liubaolin@kylinos.cn>

ntfs3: add file I/O tracepoints

This commit adds trace events for ntfs_file_read_iter() and
ntfs_file_write_iter() to help observe file read and write activity.

> diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
> index e0c0c44ce318f..7503000689840 100644
> --- a/include/trace/events/ntfs3.h
> +++ b/include/trace/events/ntfs3.h
[ ... ]
> +DECLARE_EVENT_CLASS(ntfs3_file_class,
> +	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
> +	TP_ARGS(iocb, iter),
> +	TP_STRUCT__entry(
> +		__field(loff_t, size)
> +		__field(loff_t, offset)
> +		__field(size_t, count)
> +		__field(unsigned long, ino)

[Severity: Medium]
Does this truncate the 64-bit inode number to 32 bits on 32-bit architectures?

NTFS uses 48-bit MFT references that frequently exceed 32 bits, and
`inode->i_ino` is defined as a 64-bit `u64` in the VFS. Using `unsigned long`
here will silently truncate high inode numbers on 32-bit systems.

If this field is updated to `u64`, the `TP_printk` format string would also
need to be updated to use `%llu` instead of `%lu`.

> +		__field(dev_t, dev)
> +	),

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260820090504.950475-1-liubaolin12138@163.com?part=7

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 6/7] ntfs3: add iomap tracepoints
  2026-08-20  9:05 ` [PATCH v4 6/7] ntfs3: add iomap tracepoints Baolin Liu
@ 2026-08-20  9:19   ` sashiko-bot
  0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-08-20  9:19 UTC (permalink / raw)
  To: Baolin Liu; +Cc: linux-trace-kernel

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Data truncation of 64-bit inode number to 32-bit unsigned long in trace events on 32-bit architectures.
--

--- Patch [6]: [PATCH v4 6/7] ntfs3: add iomap tracepoints ---
commit 6e265a35dba7936f19ebddff3d05806b6ce60f0a
Author: Baolin Liu <liubaolin@kylinos.cn>

ntfs3: add iomap tracepoints

This commit adds trace events for ntfs_iomap_begin() and ntfs_iomap_end()
to help observe iomap mapping activity.

> diff --git a/include/trace/events/ntfs3.h b/include/trace/events/ntfs3.h
> index e39765bc062f1..e0c0c44ce318f 100644
> --- a/include/trace/events/ntfs3.h
> +++ b/include/trace/events/ntfs3.h
[ ... ]
> +TRACE_EVENT(ntfs3_iomap_begin,
> +	TP_PROTO(struct inode *inode, loff_t offset, loff_t length,
> +		 unsigned int flags),
> +	TP_ARGS(inode, offset, length, flags),
> +	TP_STRUCT__entry(
> +		__field(unsigned long, ino)

[Severity: Low]
Is unsigned long wide enough for the inode number here? In struct inode,
i_ino is defined as a u64. On 32-bit architectures, won't assigning
inode->i_ino to an unsigned long silently truncate high inode numbers?
Could this be changed to use u64 instead?

> +		__field(loff_t, offset)
> +		__field(loff_t, length)
> +		__field(dev_t, dev)
> +		__field(unsigned int, flags)
> +	),
> +	TP_fast_assign(
> +		__entry->ino = inode->i_ino;
[ ... ]
> +TRACE_EVENT(ntfs3_iomap_end,
> +	TP_PROTO(struct inode *inode, loff_t pos, loff_t length,
> +		 ssize_t written, unsigned int flags),
> +	TP_ARGS(inode, pos, length, written, flags),
> +	TP_STRUCT__entry(
> +		__field(unsigned long, ino)

[Severity: Low]
Does this field also risk truncating the u64 inode->i_ino when running on
32-bit architectures?

> +		__field(loff_t, pos)
> +		__field(loff_t, length)
> +		__field(ssize_t, written)
> +		__field(dev_t, dev)
> +		__field(unsigned int, flags)
> +	),
> +	TP_fast_assign(
> +		__entry->ino = inode->i_ino;
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260820090504.950475-1-liubaolin12138@163.com?part=6

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2026-08-20  9:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20  9:04 [PATCH v4 0/7] ntfs3: add tracepoints for core filesystem paths Baolin Liu
2026-08-20  9:04 ` [PATCH v4 1/7] ntfs3: add mount and log replay tracepoints Baolin Liu
2026-08-20  9:04 ` [PATCH v4 2/7] ntfs3: add namei tracepoints Baolin Liu
2026-08-20  9:05 ` [PATCH v4 3/7] ntfs3: add create inode tracepoint Baolin Liu
2026-08-20  9:05 ` [PATCH v4 4/7] ntfs3: add directory index tracepoints Baolin Liu
2026-08-20  9:17   ` sashiko-bot
2026-08-20  9:05 ` [PATCH v4 5/7] ntfs3: add allocation tracepoints Baolin Liu
2026-08-20  9:05 ` [PATCH v4 6/7] ntfs3: add iomap tracepoints Baolin Liu
2026-08-20  9:19   ` sashiko-bot
2026-08-20  9:05 ` [PATCH v4 7/7] ntfs3: add file I/O tracepoints Baolin Liu
2026-08-20  9:19   ` sashiko-bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.