Skip to contentSkip to conversation

buffer: Add tracepoints to buffer write path

PATCH New Gabriel Krisman Bertazi 1 participant 1 message Oct 8, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 buffer: Add tracepoints to buffer write path

From: Anatol Pomazau <[email protected]>

Hi Viro,

I'm not sure if you accept tracepoint inclusions on your tree, if so, please take these into consideration.

-- >8 --

Google has been carrying these tracepoints for a while, as they have proven particularly useful when investigating internal issues with direct vs. buffered IO on Google workloads.

---
 fs/buffer.c               | 10 +++++
 include/trace/events/fs.h | 82 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+)
 create mode 100644 include/trace/events/fs.h
fs/buffer.c +10 -0
index 50bbc99e3d96..f5430c721e14 100644
@@ -49,6 +49,9 @@
 #include <trace/events/block.h>
 #include <linux/fscrypt.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/fs.h>
+
 #include "internal.h"
 
 static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
@@ -119,7 +122,9 @@ EXPORT_SYMBOL(buffer_check_dirty_writeback);
  */
 void __wait_on_buffer(struct buffer_head * bh)
 {
+	trace_fs_buffer_wait_start(bh);
 	wait_on_bit_io(&bh->b_state, BH_Lock, TASK_UNINTERRUPTIBLE);
+	trace_fs_buffer_wait_end(bh);
 }
 EXPORT_SYMBOL(__wait_on_buffer);
 
@@ -1741,6 +1746,8 @@ int __block_write_full_page(struct inode *inode, struct page *page,
 	block = (sector_t)page->index << (PAGE_SHIFT - bbits);
 	last_block = (i_size_read(inode) - 1) >> bbits;
 
+	trace_block_write_full_page(inode, block, last_block);
+
 	/*
 	 * Get all the dirty buffers mapped to disk addresses and
 	 * handle any aliases from the underlying blockdev's mapping.
@@ -1830,6 +1837,9 @@ int __block_write_full_page(struct inode *inode, struct page *page,
 		 * here on.
 		 */
 	}
+
+	trace_block_write_full_page_done(inode, nr_underway, err);
+
 	return err;
 
 recover:
include/trace/events/fs.h new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
2.28.0