diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-02-27 14:40:10 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-04-01 23:19:09 -0400 |
commit | c7999c3627bc6d49aa6fb9451063938cfd2c2082 (patch) | |
tree | 05dba953a6e648864cfa580ae6f754b1570e1f46 /fs/namespace.c | |
parent | f2ebb3a921c1ca1e2ddd9242e95a1989a50c4c68 (diff) |
reduce m_start() cost...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r-- | fs/namespace.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 65233a5f390a..a66aff5bd3fe 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -52,7 +52,7 @@ static int __init set_mphash_entries(char *str) | |||
52 | } | 52 | } |
53 | __setup("mphash_entries=", set_mphash_entries); | 53 | __setup("mphash_entries=", set_mphash_entries); |
54 | 54 | ||
55 | static int event; | 55 | static u64 event; |
56 | static DEFINE_IDA(mnt_id_ida); | 56 | static DEFINE_IDA(mnt_id_ida); |
57 | static DEFINE_IDA(mnt_group_ida); | 57 | static DEFINE_IDA(mnt_group_ida); |
58 | static DEFINE_SPINLOCK(mnt_id_lock); | 58 | static DEFINE_SPINLOCK(mnt_id_lock); |
@@ -1100,14 +1100,29 @@ static void *m_start(struct seq_file *m, loff_t *pos) | |||
1100 | struct proc_mounts *p = proc_mounts(m); | 1100 | struct proc_mounts *p = proc_mounts(m); |
1101 | 1101 | ||
1102 | down_read(&namespace_sem); | 1102 | down_read(&namespace_sem); |
1103 | return seq_list_start(&p->ns->list, *pos); | 1103 | if (p->cached_event == p->ns->event) { |
1104 | void *v = p->cached_mount; | ||
1105 | if (*pos == p->cached_index) | ||
1106 | return v; | ||
1107 | if (*pos == p->cached_index + 1) { | ||
1108 | v = seq_list_next(v, &p->ns->list, &p->cached_index); | ||
1109 | return p->cached_mount = v; | ||
1110 | } | ||
1111 | } | ||
1112 | |||
1113 | p->cached_event = p->ns->event; | ||
1114 | p->cached_mount = seq_list_start(&p->ns->list, *pos); | ||
1115 | p->cached_index = *pos; | ||
1116 | return p->cached_mount; | ||
1104 | } | 1117 | } |
1105 | 1118 | ||
1106 | static void *m_next(struct seq_file *m, void *v, loff_t *pos) | 1119 | static void *m_next(struct seq_file *m, void *v, loff_t *pos) |
1107 | { | 1120 | { |
1108 | struct proc_mounts *p = proc_mounts(m); | 1121 | struct proc_mounts *p = proc_mounts(m); |
1109 | 1122 | ||
1110 | return seq_list_next(v, &p->ns->list, pos); | 1123 | p->cached_mount = seq_list_next(v, &p->ns->list, pos); |
1124 | p->cached_index = *pos; | ||
1125 | return p->cached_mount; | ||
1111 | } | 1126 | } |
1112 | 1127 | ||
1113 | static void m_stop(struct seq_file *m, void *v) | 1128 | static void m_stop(struct seq_file *m, void *v) |