Commit 7991e6bb authored by Brian Gerst's avatar Brian Gerst Committed by Linus Torvalds

[PATCH] Fix up slabinfo code

Move printing the header to s_start, removing the need for the special
pointer value.
parent 8b0f29fb
...@@ -2194,10 +2194,19 @@ static void *s_start(struct seq_file *m, loff_t *pos) ...@@ -2194,10 +2194,19 @@ static void *s_start(struct seq_file *m, loff_t *pos)
struct list_head *p; struct list_head *p;
down(&cache_chain_sem); down(&cache_chain_sem);
if (!n) if (!n) {
return (void *)1; /*
* Output format version, so at least we can change it
* without _too_ many complaints.
*/
seq_puts(m, "slabinfo - version: 1.2"
#if STATS
" (statistics)"
#endif
"\n");
}
p = cache_chain.next; p = cache_chain.next;
while (--n) { while (n--) {
p = p->next; p = p->next;
if (p == &cache_chain) if (p == &cache_chain)
return NULL; return NULL;
...@@ -2209,8 +2218,6 @@ static void *s_next(struct seq_file *m, void *p, loff_t *pos) ...@@ -2209,8 +2218,6 @@ static void *s_next(struct seq_file *m, void *p, loff_t *pos)
{ {
kmem_cache_t *cachep = p; kmem_cache_t *cachep = p;
++*pos; ++*pos;
if (p == (void *)1)
return list_entry(cache_chain.next, kmem_cache_t, next);
return cachep->next.next == &cache_chain ? NULL return cachep->next.next == &cache_chain ? NULL
: list_entry(cachep->next.next, kmem_cache_t, next); : list_entry(cachep->next.next, kmem_cache_t, next);
} }
...@@ -2234,20 +2241,6 @@ static int s_show(struct seq_file *m, void *p) ...@@ -2234,20 +2241,6 @@ static int s_show(struct seq_file *m, void *p)
mm_segment_t old_fs; mm_segment_t old_fs;
char tmp; char tmp;
if (p == (void*)1) {
/*
* Output format version, so at least we can change it
* without _too_ many complaints.
*/
seq_puts(m, "slabinfo - version: 1.2"
#if STATS
" (statistics)"
#endif
"\n");
return 0;
}
check_irq_on(); check_irq_on();
spin_lock_irq(&cachep->spinlock); spin_lock_irq(&cachep->spinlock);
active_objs = 0; active_objs = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment