Skip to contentSkip to conversation

relay - Replace subbuf_start and notify_consumers callbacks with new_subbuf.

RFC PATCH In review Tom Zanussi 1 participant 1 message Sep 29, 2008

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

RFC PATCH 9/11 relay - Replace subbuf_start and notify_consumers callbacks with new_subbuf.

Replace subbuf_start and notify_consumers callbacks with new_subbuf.

The subbuf_start callback was too confusing and there's no reason to have a separate callback to notify consumers; this patch combines them both and simplifies the interface. It's only called when there actually has been a switch to a new sub-buffer and there's now no return value saying whether the buffer is full or not - that's now handled internally. Keeping a count of dropped events is also now done internally, so the user doesn't have to do that any more either.

---
 block/blktrace.c             |   22 +-----------------
 include/linux/blktrace_api.h |    1 -
 include/linux/relay.h        |   51 ++++++++++++++++++++++++++++-------------
 kernel/relay.c               |   44 ++++++++++--------------------------
 virt/kvm/kvm_trace.c         |   43 ++++++++++++++--------------------
 5 files changed, 66 insertions(+), 95 deletions(-)
block/blktrace.c +1 -21
index 271b7b7..c04168b 100644
@@ -281,7 +281,7 @@ static ssize_t blk_dropped_read(struct file *filp, char __user *buffer,
 	struct blk_trace *bt = filp->private_data;
 	char buf[16];
 
-	snprintf(buf, sizeof(buf), "%u\n", atomic_read(&bt->dropped));
+	snprintf(buf, sizeof(buf), "%u\n", atomic_read(&bt->rchan->dropped));
 
 	return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
 }
@@ -330,24 +330,6 @@ static const struct file_operations blk_msg_fops = {
 	.write =	blk_msg_write,
 };
 
-/*
- * Keep track of how many times we encountered a full subbuffer, to aid
- * the user space app in telling how many lost events there were.
- */
-static int blk_subbuf_start_callback(struct rchan_buf *buf,
-				     void *subbuf,
-				     int first_subbuf)
-{
-	struct blk_trace *bt;
-
-	if (!relay_buf_full(buf))
-		return 1;
-
-	bt = buf->chan->private_data;
-	atomic_inc(&bt->dropped);
-	return 0;
-}
-
 static int blk_remove_buf_file_callback(struct dentry *dentry)
 {
 	debugfs_remove(dentry);
@@ -364,7 +346,6 @@ static struct dentry *blk_create_buf_file_callback(const char *filename,
 }
 
 static struct rchan_callbacks blk_relay_callbacks = {
-	.subbuf_start		= blk_subbuf_start_callback,
 	.create_buf_file	= blk_create_buf_file_callback,
 	.remove_buf_file	= blk_remove_buf_file_callback,
 };
@@ -412,7 +393,6 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 
 	bt->dir = dir;
 	bt->dev = dev;
-	atomic_set(&bt->dropped, 0);
 
 	ret = -EIO;
 	bt->dropped_file = debugfs_create_file("dropped", 0444, dir, bt, &blk_dropped_fops);
include/linux/blktrace_api.h +0 -1
index d084b8d..628cf3c 100644
@@ -130,7 +130,6 @@ struct blk_trace {
 	struct dentry *dir;
 	struct dentry *dropped_file;
 	struct dentry *msg_file;
-	atomic_t dropped;
 };
 
 /*
include/linux/relay.h +35 -16

87 lines not on this page · raw message

kernel/relay.c +12 -32

108 lines not on this page · raw message

virt/kvm/kvm_trace.c +18 -25

75 lines not on this page · raw message

Signature · 1 line
1.5.3.5