Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c7999c36
Commit
c7999c36
authored
Feb 27, 2014
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce m_start() cost...
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
f2ebb3a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
4 deletions
+23
-4
fs/mount.h
fs/mount.h
+4
-1
fs/namespace.c
fs/namespace.c
+18
-3
fs/proc_namespace.c
fs/proc_namespace.c
+1
-0
No files found.
fs/mount.h
View file @
c7999c36
...
@@ -10,7 +10,7 @@ struct mnt_namespace {
...
@@ -10,7 +10,7 @@ struct mnt_namespace {
struct
user_namespace
*
user_ns
;
struct
user_namespace
*
user_ns
;
u64
seq
;
/* Sequence number to prevent loops */
u64
seq
;
/* Sequence number to prevent loops */
wait_queue_head_t
poll
;
wait_queue_head_t
poll
;
int
event
;
u64
event
;
};
};
struct
mnt_pcp
{
struct
mnt_pcp
{
...
@@ -104,6 +104,9 @@ struct proc_mounts {
...
@@ -104,6 +104,9 @@ struct proc_mounts {
struct
mnt_namespace
*
ns
;
struct
mnt_namespace
*
ns
;
struct
path
root
;
struct
path
root
;
int
(
*
show
)(
struct
seq_file
*
,
struct
vfsmount
*
);
int
(
*
show
)(
struct
seq_file
*
,
struct
vfsmount
*
);
void
*
cached_mount
;
u64
cached_event
;
loff_t
cached_index
;
};
};
#define proc_mounts(p) (container_of((p), struct proc_mounts, m))
#define proc_mounts(p) (container_of((p), struct proc_mounts, m))
...
...
fs/namespace.c
View file @
c7999c36
...
@@ -52,7 +52,7 @@ static int __init set_mphash_entries(char *str)
...
@@ -52,7 +52,7 @@ static int __init set_mphash_entries(char *str)
}
}
__setup
(
"mphash_entries="
,
set_mphash_entries
);
__setup
(
"mphash_entries="
,
set_mphash_entries
);
static
int
event
;
static
u64
event
;
static
DEFINE_IDA
(
mnt_id_ida
);
static
DEFINE_IDA
(
mnt_id_ida
);
static
DEFINE_IDA
(
mnt_group_ida
);
static
DEFINE_IDA
(
mnt_group_ida
);
static
DEFINE_SPINLOCK
(
mnt_id_lock
);
static
DEFINE_SPINLOCK
(
mnt_id_lock
);
...
@@ -1100,14 +1100,29 @@ static void *m_start(struct seq_file *m, loff_t *pos)
...
@@ -1100,14 +1100,29 @@ static void *m_start(struct seq_file *m, loff_t *pos)
struct
proc_mounts
*
p
=
proc_mounts
(
m
);
struct
proc_mounts
*
p
=
proc_mounts
(
m
);
down_read
(
&
namespace_sem
);
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
)
static
void
*
m_next
(
struct
seq_file
*
m
,
void
*
v
,
loff_t
*
pos
)
{
{
struct
proc_mounts
*
p
=
proc_mounts
(
m
);
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
)
static
void
m_stop
(
struct
seq_file
*
m
,
void
*
v
)
...
...
fs/proc_namespace.c
View file @
c7999c36
...
@@ -267,6 +267,7 @@ static int mounts_open_common(struct inode *inode, struct file *file,
...
@@ -267,6 +267,7 @@ static int mounts_open_common(struct inode *inode, struct file *file,
p
->
root
=
root
;
p
->
root
=
root
;
p
->
m
.
poll_event
=
ns
->
event
;
p
->
m
.
poll_event
=
ns
->
event
;
p
->
show
=
show
;
p
->
show
=
show
;
p
->
cached_event
=
~
0ULL
;
return
0
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment