[RFC PATCH 10/11] relay - Remove sub-buffers from relay.

Previous thread: [RFC PATCH 9/11] relay - Replace subbuf_start and notify_consumers callbacks with new_subbuf. by Tom Zanussi on Sunday, September 28, 2008 - 10:40 pm. (1 message)

Next thread: [RFC PATCH 11/11] relay - Remove vmap of relay buffers. by Tom Zanussi on Sunday, September 28, 2008 - 10:40 pm. (1 message)
From: Tom Zanussi
Date: Sunday, September 28, 2008 - 10:40 pm

Remove sub-buffers from relay.

This patch removes the concept of sub-buffers from relay - everything
now just operates on pages.  relay_open() was also changed
accordingly; instead of specifying buffer sizes in terms of sub-buffer
sizes and numbers, the buffer size is specfied in pages.  There's also
a new param that specifies how often to wake up consumers, in terms of
every n pages produced.  If 0 is given for this param, consumers are
never woken up.

Signed-off-by: Tom Zanussi <zanussi@comcast.net>

---
 block/blktrace.c      |    7 +-
 include/linux/relay.h |  113 +++++++++++-----------
 kernel/relay.c        |  257 ++++++++++++++++++++++++-------------------------
 virt/kvm/kvm_trace.c  |   25 +++--
 4 files changed, 202 insertions(+), 200 deletions(-)

diff --git a/block/blktrace.c b/block/blktrace.c
index c04168b..84a9cb4 100644
--- a/block/blktrace.c
+++ b/block/blktrace.c
@@ -359,6 +359,7 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 	struct blk_trace *old_bt, *bt = NULL;
 	struct dentry *dir = NULL;
 	int ret, i;
+	int n_pages, n_pages_wakeup;
 
 	if (!buts->buf_size || !buts->buf_nr)
 		return -EINVAL;
@@ -403,8 +404,10 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 	if (!bt->msg_file)
 		goto err;
 
-	bt->rchan = relay_open("trace", dir, buts->buf_size,
-			       buts->buf_nr, &blk_relay_callbacks, bt, 0UL);
+	n_pages = (buts->buf_size * buts->buf_nr) / PAGE_SIZE;
+	n_pages_wakeup = buts->buf_size / PAGE_SIZE;
+	bt->rchan = relay_open("trace", dir, n_pages, n_pages_wakeup,
+			       &blk_relay_callbacks, bt, 0UL);
 	if (!bt->rchan)
 		goto err;
 
diff --git a/include/linux/relay.h b/include/linux/relay.h
index dd51caf..e0b1730 100644
--- a/include/linux/relay.h
+++ b/include/linux/relay.h
@@ -19,9 +19,6 @@
 #include <linux/poll.h>
 #include <linux/kref.h>
 
-/* Needs a _much_ better name... */
-#define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE)
-
 /*
  * Tracks changes to ...
Previous thread: [RFC PATCH 9/11] relay - Replace subbuf_start and notify_consumers callbacks with new_subbuf. by Tom Zanussi on Sunday, September 28, 2008 - 10:40 pm. (1 message)

Next thread: [RFC PATCH 11/11] relay - Remove vmap of relay buffers. by Tom Zanussi on Sunday, September 28, 2008 - 10:40 pm. (1 message)