relayfs: abolish prev_padding
Patch series "relayfs: misc changes", v5. The series mostly focuses on the error counters which helps every user debug their own kernel module. This patch (of 5): prev_padding represents the unused space of certain subbuffer. If the content of a call of relay_write() exceeds the limit of the remainder of this subbuffer, it will skip storing in the rest space and record the start point as buf->prev_padding in relay_switch_subbuf(). Since the buf is a per-cpu big buffer, the point of prev_padding as a global value for the whole buffer instead of a single subbuffer (whose padding info is stored in buf->padding[]) seems meaningless from the real use cases, so we don't bother to record it any more. Link: https://lkml.kernel.org/r/20250612061201.34272-1-kerneljasonxing@gmail.com Link: https://lkml.kernel.org/r/20250612061201.34272-2-kerneljasonxing@gmail.com Signed-off-by: Jason Xing <kernelxing@tencent.com> Reviewed-by: Yushan Zhou <katrinzhou@tencent.com> Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Cc: Jens Axboe <axboe@kernel.dk> 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:
committed by
Andrew Morton
parent
c9e3fb050e
commit
2489e95812
+8
-6
@@ -249,13 +249,13 @@ EXPORT_SYMBOL_GPL(relay_buf_full);
|
||||
*/
|
||||
|
||||
static int relay_subbuf_start(struct rchan_buf *buf, void *subbuf,
|
||||
void *prev_subbuf, size_t prev_padding)
|
||||
void *prev_subbuf)
|
||||
{
|
||||
if (!buf->chan->cb->subbuf_start)
|
||||
return !relay_buf_full(buf);
|
||||
|
||||
return buf->chan->cb->subbuf_start(buf, subbuf,
|
||||
prev_subbuf, prev_padding);
|
||||
prev_subbuf);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,7 +301,7 @@ static void __relay_reset(struct rchan_buf *buf, unsigned int init)
|
||||
for (i = 0; i < buf->chan->n_subbufs; i++)
|
||||
buf->padding[i] = 0;
|
||||
|
||||
relay_subbuf_start(buf, buf->data, NULL, 0);
|
||||
relay_subbuf_start(buf, buf->data, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -554,9 +554,11 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length)
|
||||
goto toobig;
|
||||
|
||||
if (buf->offset != buf->chan->subbuf_size + 1) {
|
||||
buf->prev_padding = buf->chan->subbuf_size - buf->offset;
|
||||
size_t prev_padding;
|
||||
|
||||
prev_padding = buf->chan->subbuf_size - buf->offset;
|
||||
old_subbuf = buf->subbufs_produced % buf->chan->n_subbufs;
|
||||
buf->padding[old_subbuf] = buf->prev_padding;
|
||||
buf->padding[old_subbuf] = prev_padding;
|
||||
buf->subbufs_produced++;
|
||||
if (buf->dentry)
|
||||
d_inode(buf->dentry)->i_size +=
|
||||
@@ -581,7 +583,7 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length)
|
||||
new_subbuf = buf->subbufs_produced % buf->chan->n_subbufs;
|
||||
new = buf->start + new_subbuf * buf->chan->subbuf_size;
|
||||
buf->offset = 0;
|
||||
if (!relay_subbuf_start(buf, new, old, buf->prev_padding)) {
|
||||
if (!relay_subbuf_start(buf, new, old)) {
|
||||
buf->offset = buf->chan->subbuf_size + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -461,7 +461,7 @@ static const struct file_operations blk_msg_fops = {
|
||||
* 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, size_t prev_padding)
|
||||
void *prev_subbuf)
|
||||
{
|
||||
struct blk_trace *bt;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user