|
@@ -203,17 +203,21 @@ static void *stat_seq_start(struct seq_file *s, loff_t *pos)
|
|
{
|
|
{
|
|
struct stat_session *session = s->private;
|
|
struct stat_session *session = s->private;
|
|
struct rb_node *node;
|
|
struct rb_node *node;
|
|
|
|
+ int n = *pos;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
/* Prevent from tracer switch or rbtree modification */
|
|
/* Prevent from tracer switch or rbtree modification */
|
|
mutex_lock(&session->stat_mutex);
|
|
mutex_lock(&session->stat_mutex);
|
|
|
|
|
|
/* If we are in the beginning of the file, print the headers */
|
|
/* If we are in the beginning of the file, print the headers */
|
|
- if (!*pos && session->ts->stat_headers)
|
|
|
|
- return SEQ_START_TOKEN;
|
|
|
|
|
|
+ if (session->ts->stat_headers) {
|
|
|
|
+ if (n == 0)
|
|
|
|
+ return SEQ_START_TOKEN;
|
|
|
|
+ n--;
|
|
|
|
+ }
|
|
|
|
|
|
node = rb_first(&session->stat_root);
|
|
node = rb_first(&session->stat_root);
|
|
- for (i = 0; node && i < *pos; i++)
|
|
|
|
|
|
+ for (i = 0; node && i < n; i++)
|
|
node = rb_next(node);
|
|
node = rb_next(node);
|
|
|
|
|
|
return node;
|
|
return node;
|