[PATCH 23/24] orangefs: tracepoints for readpage and writeback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



trace_orangefs_writepage and trace_orangefs_radpage are self explanatory.

trace_orangefs_early_writeback will be used to determine the cost of the
inability to cache multiple writes from different uids or noncontiguous
writes within a page.

Signed-off-by: Martin Brandenburg <martin@xxxxxxxxxxxx>
---
 fs/orangefs/inode.c          | 11 +++++++++-
 fs/orangefs/orangefs-trace.h | 50 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 1 deletion(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index aae9dc91f836..8c67cdab2b12 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -13,6 +13,7 @@
 #include <linux/bvec.h>
 #include "orangefs-kernel.h"
 #include "orangefs-bufmap.h"
+#include "orangefs-trace.h"
 
 static int orangefs_writepage_locked(struct page *page,
     struct writeback_control *wbc)
@@ -51,6 +52,8 @@ static int orangefs_writepage_locked(struct page *page,
 
 	}
 
+	trace_orangefs_writepage(off, wlen, wr->mwrite);
+
 	bv.bv_page = page;
 	bv.bv_len = wlen;
 	bv.bv_offset = 0;
@@ -82,20 +85,24 @@ static int do_writepage_if_necessary(struct page *page, loff_t pos,
 	};
 	int r;
 	if (PagePrivate(page)) {
+		int noncontig;
 		wr = (struct orangefs_write_request *)page_private(page);
 		BUG_ON(!wr);
+ 		noncontig = pos + len < wr->pos || wr->pos + wr->len < pos;
 		/*
 		 * If the new request is not contiguous with the last one or if
 		 * the uid or gid is different, the page must be written out
 		 * before continuing.
 		 */
-		if (pos + len < wr->pos || wr->pos + wr->len < pos ||
+		if (noncontig ||
 		    !uid_eq(current_fsuid(), wr->uid) ||
 		    !gid_eq(current_fsgid(), wr->gid)) {
 			wbc.range_start = page_file_offset(page);
 			wbc.range_end = wbc.range_start + PAGE_SIZE - 1;
 			wait_on_page_writeback(page);
 			if (clear_page_dirty_for_io(page)) {
+				trace_orangefs_early_writeback(noncontig ?
+				    1 : 2);
 				r = orangefs_writepage_locked(page, &wbc);
 				if (r)
 					return r;
@@ -205,6 +212,7 @@ static int orangefs_readpage(struct file *file, struct page *page)
 	loff_t off;
 
 	off = page_offset(page);
+	trace_orangefs_readpage(off, PAGE_SIZE);
 	bv.bv_page = page;
 	bv.bv_len = PAGE_SIZE;
 	bv.bv_offset = 0;
@@ -278,6 +286,7 @@ static void orangefs_invalidatepage(struct page *page,
 			wbc.range_end = wbc.range_start + PAGE_SIZE - 1;
 			wait_on_page_writeback(page);
 			if (clear_page_dirty_for_io(page)) {
+				trace_orangefs_early_writeback(0);
 				r = orangefs_writepage_locked(page, &wbc);
 				if (r)
 					return;
diff --git a/fs/orangefs/orangefs-trace.h b/fs/orangefs/orangefs-trace.h
index 16e2b5a86071..faf09b26d9ba 100644
--- a/fs/orangefs/orangefs-trace.h
+++ b/fs/orangefs/orangefs-trace.h
@@ -63,6 +63,21 @@ TRACE_EVENT(orangefs_devreq_write_iter,
     )
 );
 
+TRACE_EVENT(orangefs_early_writeback,
+    TP_PROTO(int reason),
+    TP_ARGS(reason),
+    TP_STRUCT__entry(
+        __field(int, reason)
+    ),
+    TP_fast_assign(
+        __entry->reason = reason;
+    ),
+    TP_printk(
+        "%s", __entry->reason == 0 ? "invalidatepage" :
+            (__entry->reason == 1 ? "noncontiguous" : "uid/gid")
+    )
+);
+
 TRACE_EVENT(orangefs_service_operation,
     TP_PROTO(struct orangefs_kernel_op_s *op, int flags),
     TP_ARGS(op, flags),
@@ -82,6 +97,41 @@ TRACE_EVENT(orangefs_service_operation,
     )
 );
 
+TRACE_EVENT(orangefs_readpage,
+    TP_PROTO(loff_t off, size_t len),
+    TP_ARGS(off, len),
+    TP_STRUCT__entry(
+        __field(loff_t, off)
+        __field(size_t, len)
+    ),
+    TP_fast_assign(
+        __entry->off = off;
+        __entry->len = len;
+    ),
+    TP_printk(
+        "off=%lld len=%ld", __entry->off, __entry->len
+    )
+);
+
+TRACE_EVENT(orangefs_writepage,
+    TP_PROTO(loff_t off, size_t len, int mwrite),
+    TP_ARGS(off, len, mwrite),
+    TP_STRUCT__entry(
+        __field(loff_t, off)
+        __field(size_t, len)
+        __field(int, mwrite)
+    ),
+    TP_fast_assign(
+        __entry->off = off;
+        __entry->len = len;
+        __entry->mwrite = mwrite;
+    ),
+    TP_printk(
+        "off=%lld len=%ld mwrite=%s", __entry->off, __entry->len,
+            __entry->mwrite ? "yes" : "no"
+    )
+);
+
 #endif
 
 #undef TRACE_INCLUDE_PATH
-- 
2.16.2




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux