All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Brandenburg <martin@omnibond.com>
To: hubcap@omnibond.com, linux-fsdevel@vger.kernel.org
Cc: Martin Brandenburg <martin@omnibond.com>
Subject: [PATCH 23/24] orangefs: tracepoints for readpage and writeback
Date: Tue, 20 Mar 2018 17:02:33 +0000	[thread overview]
Message-ID: <20180320170234.1412-24-martin@omnibond.com> (raw)
In-Reply-To: <20180320170234.1412-1-martin@omnibond.com>

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@omnibond.com>
---
 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

  parent reply	other threads:[~2018-03-20 17:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 17:02 [PATCH 00/24] orangefs: page cache Martin Brandenburg
2018-03-20 17:02 ` [PATCH 01/24] orangefs: make several *_operations structs static Martin Brandenburg
2018-03-20 17:02 ` [PATCH 02/24] orangefs: remove unused code Martin Brandenburg
2018-03-20 17:02 ` [PATCH 03/24] orangefs: create uapi interface Martin Brandenburg
2018-03-20 17:02 ` [PATCH 04/24] orangefs: open code short single-use functions Martin Brandenburg
2018-03-20 17:02 ` [PATCH 05/24] orangefs: implement vm_ops->fault Martin Brandenburg
2018-03-20 17:02 ` [PATCH 06/24] orangefs: implement xattr cache Martin Brandenburg
2018-03-20 17:02 ` [PATCH 07/24] orangefs: simpler installation documentation Martin Brandenburg
2018-03-20 17:02 ` [PATCH 08/24] orangefs: add tracepoint for service_operation Martin Brandenburg
2018-03-20 17:02 ` [PATCH 09/24] orangefs: tracepoints for orangefs_devreq_{read,write_iter,poll} Martin Brandenburg
2018-03-20 17:02 ` [PATCH 10/24] orangefs: do not invalidate attributes on inode create Martin Brandenburg
2018-03-20 17:02 ` [PATCH 11/24] orangefs: simply orangefs_inode_getattr interface Martin Brandenburg
2018-03-20 17:02 ` [PATCH 12/24] orangefs: update attributes rather than relying on server Martin Brandenburg
2018-03-20 17:02 ` [PATCH 13/24] orangefs: hold i_lock during inode_getattr Martin Brandenburg
2018-03-20 17:02 ` [PATCH 14/24] orangefs: set up and use backing_dev_info Martin Brandenburg
2018-03-20 17:02 ` [PATCH 15/24] orangefs: let setattr write to cached inode Martin Brandenburg
2018-03-20 17:02 ` [PATCH 16/24] orangefs: reorganize setattr functions to track attribute changes Martin Brandenburg
2018-03-20 17:02 ` [PATCH 17/24] orangefs: remove orangefs_readpages Martin Brandenburg
2018-03-20 17:02 ` [PATCH 18/24] orangefs: service ops done for writeback are not killable Martin Brandenburg
2018-03-20 17:02 ` [PATCH 19/24] orangefs: migrate to generic_file_read_iter Martin Brandenburg
2018-03-20 17:02 ` [PATCH 20/24] orangefs: implement writepage Martin Brandenburg
2018-03-20 17:02 ` [PATCH 21/24] orangefs: skip inode writeout if nothing to write Martin Brandenburg
2018-03-20 17:02 ` [PATCH 22/24] orangefs: write range tracking Martin Brandenburg
2018-03-20 17:02 ` Martin Brandenburg [this message]
2018-03-20 17:02 ` [PATCH 24/24] orangefs: tracepoints for getattr, setattr, and write_inode Martin Brandenburg

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=20180320170234.1412-24-martin@omnibond.com \
    --to=martin@omnibond.com \
    --cc=hubcap@omnibond.com \
    --cc=linux-fsdevel@vger.kernel.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 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.