reduce m_start() cost...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -52,7 +52,7 @@ static int __init set_mphash_entries(char *str)
|
||||
}
|
||||
__setup("mphash_entries=", set_mphash_entries);
|
||||
|
||||
static int event;
|
||||
static u64 event;
|
||||
static DEFINE_IDA(mnt_id_ida);
|
||||
static DEFINE_IDA(mnt_group_ida);
|
||||
static DEFINE_SPINLOCK(mnt_id_lock);
|
||||
@@ -1100,14 +1100,29 @@ static void *m_start(struct seq_file *m, loff_t *pos)
|
||||
struct proc_mounts *p = proc_mounts(m);
|
||||
|
||||
down_read(&namespace_sem);
|
||||
return seq_list_start(&p->ns->list, *pos);
|
||||
if (p->cached_event == p->ns->event) {
|
||||
void *v = p->cached_mount;
|
||||
if (*pos == p->cached_index)
|
||||
return v;
|
||||
if (*pos == p->cached_index + 1) {
|
||||
v = seq_list_next(v, &p->ns->list, &p->cached_index);
|
||||
return p->cached_mount = v;
|
||||
}
|
||||
}
|
||||
|
||||
p->cached_event = p->ns->event;
|
||||
p->cached_mount = seq_list_start(&p->ns->list, *pos);
|
||||
p->cached_index = *pos;
|
||||
return p->cached_mount;
|
||||
}
|
||||
|
||||
static void *m_next(struct seq_file *m, void *v, loff_t *pos)
|
||||
{
|
||||
struct proc_mounts *p = proc_mounts(m);
|
||||
|
||||
return seq_list_next(v, &p->ns->list, pos);
|
||||
p->cached_mount = seq_list_next(v, &p->ns->list, pos);
|
||||
p->cached_index = *pos;
|
||||
return p->cached_mount;
|
||||
}
|
||||
|
||||
static void m_stop(struct seq_file *m, void *v)
|
||||
|
Reference in New Issue
Block a user