Skip to contentSkip to conversation

bcachefs: Add tracepoints for bch2_sync_fs() and bch2_fsync()

PATCH New Youling Tang 1 participant 1 message May 31, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: Add tracepoints for bch2_sync_fs() and bch2_fsync()

From: Youling Tang <[email protected]>

Add trace_bch2_sync_fs() and trace_bch2_fsync() implementations.

The output in trace is as follows:

  sync-29779   [000] .....   193.700935: bch2_sync_fs: dev 254,16 wait 1
  <...>-40027  [002] .....   342.535227: bch2_fsync: dev 254,32 ino 4099 parent 4096 datasync 1
---
 fs/bcachefs/fs-io.c |  2 ++
 fs/bcachefs/fs.c    |  3 +++
 fs/bcachefs/trace.h | 50 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+)
fs/bcachefs/fs-io.c +2 -0
index f5b266e51261..e89f01394ccb 100644
@@ -194,6 +194,8 @@ int bch2_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 	struct bch_fs *c = inode->v.i_sb->s_fs_info;
 	int ret, err;
 
+	trace_bch2_fsync(file, datasync);
+
 	ret = file_write_and_wait_range(file, start, end);
 	if (ret)
 		goto out;
fs/bcachefs/fs.c +3 -0
index 9b52ac233bf9..0695f478e206 100644
@@ -26,6 +26,7 @@
 #include "snapshot.h"
 #include "super.h"
 #include "xattr.h"
+#include "trace.h"
 
 #include <linux/aio.h>
 #include <linux/backing-dev.h>
@@ -1681,6 +1682,8 @@ static int bch2_sync_fs(struct super_block *sb, int wait)
 	struct bch_fs *c = sb->s_fs_info;
 	int ret;
 
+	trace_bch2_sync_fs(sb, wait);
+
 	if (c->opts.journal_flush_disabled)
 		return 0;
 
fs/bcachefs/trace.h +50 -0

56 lines not on this page · raw message

Signature · 1 line
2.34.1