mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:44:45 +01:00
blktrace: use rbuf->stats.full as a drop indicator in relayfs
Replace internal subbuf_start in blktrace with the default policy in relayfs. Remove dropped field from struct blktrace. Correspondingly, call the common helper in relay. By incrementing full_count to keep track of how many times we encountered a full buffer issue, user space will know how many events were lost. Link: https://lkml.kernel.org/r/20250612061201.34272-5-kerneljasonxing@gmail.com Signed-off-by: Jason Xing <kernelxing@tencent.com> Reviewed-by: Yushan Zhou <katrinzhou@tencent.com> Reviewed-by: Jens Axboe <axboe@kernel.dk> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
a53202ce7f
commit
7f2173894f
1 changed files with 2 additions and 20 deletions
|
|
@ -415,9 +415,10 @@ static ssize_t blk_dropped_read(struct file *filp, char __user *buffer,
|
|||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct blk_trace *bt = filp->private_data;
|
||||
size_t dropped = relay_stats(bt->rchan, RELAY_STATS_BUF_FULL);
|
||||
char buf[16];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%u\n", atomic_read(&bt->dropped));
|
||||
snprintf(buf, sizeof(buf), "%zu\n", dropped);
|
||||
|
||||
return simple_read_from_buffer(buffer, count, ppos, buf, strlen(buf));
|
||||
}
|
||||
|
|
@ -456,23 +457,6 @@ static const struct file_operations blk_msg_fops = {
|
|||
.llseek = noop_llseek,
|
||||
};
|
||||
|
||||
/*
|
||||
* 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,
|
||||
void *prev_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);
|
||||
|
|
@ -491,7 +475,6 @@ static struct dentry *blk_create_buf_file_callback(const char *filename,
|
|||
}
|
||||
|
||||
static const 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,
|
||||
};
|
||||
|
|
@ -580,7 +563,6 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
|
|||
}
|
||||
|
||||
bt->dev = dev;
|
||||
atomic_set(&bt->dropped, 0);
|
||||
INIT_LIST_HEAD(&bt->running_list);
|
||||
|
||||
ret = -EIO;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue