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
Kirill Smelkov
linux
Commits
68e8a9fe
Commit
68e8a9fe
authored
Nov 24, 2011
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vfs: all counters taken to struct mount
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
83adc753
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
32 deletions
+32
-32
fs/mount.h
fs/mount.h
+12
-0
fs/namespace.c
fs/namespace.c
+20
-20
include/linux/mount.h
include/linux/mount.h
+0
-12
No files found.
fs/mount.h
View file @
68e8a9fe
#include <linux/mount.h>
struct
mnt_pcp
{
int
mnt_count
;
int
mnt_writers
;
};
struct
mount
{
struct
list_head
mnt_hash
;
struct
mount
*
mnt_parent
;
struct
dentry
*
mnt_mountpoint
;
struct
vfsmount
mnt
;
#ifdef CONFIG_SMP
struct
mnt_pcp
__percpu
*
mnt_pcp
;
atomic_t
mnt_longterm
;
/* how many of the refs are longterm */
#else
int
mnt_count
;
int
mnt_writers
;
#endif
};
static
inline
struct
mount
*
real_mount
(
struct
vfsmount
*
mnt
)
...
...
fs/namespace.c
View file @
68e8a9fe
...
...
@@ -144,10 +144,10 @@ void mnt_release_group_id(struct mount *mnt)
static
inline
void
mnt_add_count
(
struct
mount
*
mnt
,
int
n
)
{
#ifdef CONFIG_SMP
this_cpu_add
(
mnt
->
mnt
.
mnt
_pcp
->
mnt_count
,
n
);
this_cpu_add
(
mnt
->
mnt_pcp
->
mnt_count
,
n
);
#else
preempt_disable
();
mnt
->
mnt
.
mnt
_count
+=
n
;
mnt
->
mnt_count
+=
n
;
preempt_enable
();
#endif
}
...
...
@@ -162,12 +162,12 @@ unsigned int mnt_get_count(struct mount *mnt)
int
cpu
;
for_each_possible_cpu
(
cpu
)
{
count
+=
per_cpu_ptr
(
mnt
->
mnt
.
mnt
_pcp
,
cpu
)
->
mnt_count
;
count
+=
per_cpu_ptr
(
mnt
->
mnt_pcp
,
cpu
)
->
mnt_count
;
}
return
count
;
#else
return
mnt
->
mnt
.
mnt
_count
;
return
mnt
->
mnt_count
;
#endif
}
...
...
@@ -189,14 +189,14 @@ static struct mount *alloc_vfsmnt(const char *name)
}
#ifdef CONFIG_SMP
mnt
->
mnt_pcp
=
alloc_percpu
(
struct
mnt_pcp
);
if
(
!
mnt
->
mnt_pcp
)
p
->
mnt_pcp
=
alloc_percpu
(
struct
mnt_pcp
);
if
(
!
p
->
mnt_pcp
)
goto
out_free_devname
;
this_cpu_add
(
mnt
->
mnt_pcp
->
mnt_count
,
1
);
this_cpu_add
(
p
->
mnt_pcp
->
mnt_count
,
1
);
#else
mnt
->
mnt_count
=
1
;
mnt
->
mnt_writers
=
0
;
p
->
mnt_count
=
1
;
p
->
mnt_writers
=
0
;
#endif
INIT_LIST_HEAD
(
&
p
->
mnt_hash
);
...
...
@@ -256,18 +256,18 @@ EXPORT_SYMBOL_GPL(__mnt_is_readonly);
static
inline
void
mnt_inc_writers
(
struct
mount
*
mnt
)
{
#ifdef CONFIG_SMP
this_cpu_inc
(
mnt
->
mnt
.
mnt
_pcp
->
mnt_writers
);
this_cpu_inc
(
mnt
->
mnt_pcp
->
mnt_writers
);
#else
mnt
->
mnt
.
mnt
_writers
++
;
mnt
->
mnt_writers
++
;
#endif
}
static
inline
void
mnt_dec_writers
(
struct
mount
*
mnt
)
{
#ifdef CONFIG_SMP
this_cpu_dec
(
mnt
->
mnt
.
mnt
_pcp
->
mnt_writers
);
this_cpu_dec
(
mnt
->
mnt_pcp
->
mnt_writers
);
#else
mnt
->
mnt
.
mnt
_writers
--
;
mnt
->
mnt_writers
--
;
#endif
}
...
...
@@ -278,7 +278,7 @@ static unsigned int mnt_get_writers(struct mount *mnt)
int
cpu
;
for_each_possible_cpu
(
cpu
)
{
count
+=
per_cpu_ptr
(
mnt
->
mnt
.
mnt
_pcp
,
cpu
)
->
mnt_writers
;
count
+=
per_cpu_ptr
(
mnt
->
mnt_pcp
,
cpu
)
->
mnt_writers
;
}
return
count
;
...
...
@@ -454,7 +454,7 @@ static void free_vfsmnt(struct mount *mnt)
kfree
(
mnt
->
mnt
.
mnt_devname
);
mnt_free_id
(
mnt
);
#ifdef CONFIG_SMP
free_percpu
(
mnt
->
mnt
.
mnt
_pcp
);
free_percpu
(
mnt
->
mnt_pcp
);
#endif
kmem_cache_free
(
mnt_cache
,
mnt
);
}
...
...
@@ -594,7 +594,7 @@ static void attach_mnt(struct mount *mnt, struct path *path)
static
inline
void
__mnt_make_longterm
(
struct
mount
*
mnt
)
{
#ifdef CONFIG_SMP
atomic_inc
(
&
mnt
->
mnt
.
mnt
_longterm
);
atomic_inc
(
&
mnt
->
mnt_longterm
);
#endif
}
...
...
@@ -602,7 +602,7 @@ static inline void __mnt_make_longterm(struct mount *mnt)
static
inline
void
__mnt_make_shortterm
(
struct
mount
*
mnt
)
{
#ifdef CONFIG_SMP
atomic_dec
(
&
mnt
->
mnt
.
mnt
_longterm
);
atomic_dec
(
&
mnt
->
mnt_longterm
);
#endif
}
...
...
@@ -769,7 +769,7 @@ static void mntput_no_expire(struct vfsmount *m)
put_again:
#ifdef CONFIG_SMP
br_read_lock
(
vfsmount_lock
);
if
(
likely
(
atomic_read
(
&
mnt
->
mnt
.
mnt
_longterm
)))
{
if
(
likely
(
atomic_read
(
&
mnt
->
mnt_longterm
)))
{
mnt_add_count
(
mnt
,
-
1
);
br_read_unlock
(
vfsmount_lock
);
return
;
...
...
@@ -2375,10 +2375,10 @@ void mnt_make_shortterm(struct vfsmount *m)
{
#ifdef CONFIG_SMP
struct
mount
*
mnt
=
real_mount
(
m
);
if
(
atomic_add_unless
(
&
mnt
->
mnt
.
mnt
_longterm
,
-
1
,
1
))
if
(
atomic_add_unless
(
&
mnt
->
mnt_longterm
,
-
1
,
1
))
return
;
br_write_lock
(
vfsmount_lock
);
atomic_dec
(
&
mnt
->
mnt
.
mnt
_longterm
);
atomic_dec
(
&
mnt
->
mnt_longterm
);
br_write_unlock
(
vfsmount_lock
);
#endif
}
...
...
include/linux/mount.h
View file @
68e8a9fe
...
...
@@ -47,21 +47,9 @@ struct mnt_namespace;
#define MNT_INTERNAL 0x4000
struct
mnt_pcp
{
int
mnt_count
;
int
mnt_writers
;
};
struct
vfsmount
{
struct
dentry
*
mnt_root
;
/* root of the mounted tree */
struct
super_block
*
mnt_sb
;
/* pointer to superblock */
#ifdef CONFIG_SMP
struct
mnt_pcp
__percpu
*
mnt_pcp
;
atomic_t
mnt_longterm
;
/* how many of the refs are longterm */
#else
int
mnt_count
;
int
mnt_writers
;
#endif
struct
list_head
mnt_mounts
;
/* list of children, anchored here */
struct
list_head
mnt_child
;
/* and going through their mnt_child */
int
mnt_flags
;
...
...
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