From: Baolin Liu <liubaolin12138@163.com>
To: almaz.alexandrovich@paragon-software.com, rostedt@goodmis.org,
mhiramat@kernel.org, mathieu.desnoyers@efficios.com
Cc: linux-kernel@vger.kernel.org, ntfs3@lists.linux.dev,
linux-trace-kernel@vger.kernel.org, liubaolin12138@163.com,
liubaolin12138@gmail.com, Baolin Liu <liubaolin@kylinos.cn>
Subject: [PATCH v3 v3 5/7] ntfs3: add allocation tracepoints
Date: Fri, 7 Aug 2026 09:03:52 +0800 [thread overview]
Message-ID: <20260807010354.2277156-6-liubaolin12138@163.com> (raw)
In-Reply-To: <20260807010354.2277156-1-liubaolin12138@163.com>
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 | 9 +++++
include/trace/events/ntfs3.h | 78 ++++++++++++++++++++++++++++++++++++
2 files changed, 87 insertions(+)
diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index c621a4c582f9..a793f17b6bb4 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);
@@ -452,6 +455,9 @@ int attr_set_size_ex(struct ntfs_inode *ni, enum ATTR_TYPE type,
u32 align;
struct MFT_REC *rec;
+ trace_ntfs3_attr_set_size_ex(&ni->vfs_inode, le32_to_cpu(type), new_size,
+ keep_prealloc, no_da);
+
again:
alen = 0;
le_b = NULL;
@@ -960,6 +966,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 != NULL, 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..d16dd127ff2e 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 new_size, bool keep_prealloc,
+ bool no_da),
+ TP_ARGS(inode, type, new_size, keep_prealloc, no_da),
+ TP_STRUCT__entry(
+ __field(loff_t, 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 = i_size_read(inode);
+ __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=%lld 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 create,
+ bool zero, bool no_da),
+ TP_ARGS(inode, vcn, clen, create, 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 = create;
+ __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
next prev parent reply other threads:[~2026-08-07 1:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 1:03 [PATCH v3 v3 0/7] ntfs3: add tracepoints for core filesystem paths Baolin Liu
2026-08-07 1:03 ` [PATCH v3 v3 1/7] ntfs3: add mount and log replay tracepoints Baolin Liu
2026-08-07 1:03 ` [PATCH v3 v3 2/7] ntfs3: add namei tracepoints Baolin Liu
2026-08-07 1:03 ` [PATCH v3 v3 3/7] ntfs3: add create inode tracepoint Baolin Liu
2026-08-07 1:03 ` [PATCH v3 v3 4/7] ntfs3: add directory index tracepoints Baolin Liu
2026-08-07 1:03 ` Baolin Liu [this message]
2026-08-07 1:03 ` [PATCH v3 v3 6/7] ntfs3: add iomap tracepoints Baolin Liu
2026-08-07 1:03 ` [PATCH v3 v3 7/7] ntfs3: add file I/O tracepoints Baolin Liu
2026-08-07 1:07 ` [PATCH v3 v3 0/7] ntfs3: add tracepoints for core filesystem paths liubaolin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260807010354.2277156-6-liubaolin12138@163.com \
--to=liubaolin12138@163.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=liubaolin12138@gmail.com \
--cc=liubaolin@kylinos.cn \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=ntfs3@lists.linux.dev \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox