Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
E-EXK4 - Operating System Group
projects
Linux
Commits
68e8a9fe
Commit
68e8a9fe
authored
13 years ago
by
Al Viro
Browse files
Options
Downloads
Patches
Plain Diff
vfs: all counters taken to struct mount
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
83adc753
Loading
Loading
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
fs/mount.h
+12
-0
12 additions, 0 deletions
fs/mount.h
fs/namespace.c
+20
-20
20 additions, 20 deletions
fs/namespace.c
include/linux/mount.h
+0
-12
0 additions, 12 deletions
include/linux/mount.h
with
32 additions
and
32 deletions
fs/mount.h
+
12
−
0
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
)
...
...
This diff is collapsed.
Click to expand it.
fs/namespace.c
+
20
−
20
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
}
...
...
This diff is collapsed.
Click to expand it.
include/linux/mount.h
+
0
−
12
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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment