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
7eb5e882
Commit
7eb5e882
authored
Oct 01, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uninline destroy_super(), consolidate alloc_super()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
966c1f75
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
120 deletions
+86
-120
fs/super.c
fs/super.c
+86
-120
No files found.
fs/super.c
View file @
7eb5e882
...
...
@@ -129,33 +129,27 @@ static unsigned long super_cache_count(struct shrinker *shrink,
return
total_objects
;
}
static
int
init_sb_writers
(
struct
super_block
*
s
,
struct
file_system_type
*
type
)
{
int
err
;
int
i
;
for
(
i
=
0
;
i
<
SB_FREEZE_LEVELS
;
i
++
)
{
err
=
percpu_counter_init
(
&
s
->
s_writers
.
counter
[
i
],
0
);
if
(
err
<
0
)
goto
err_out
;
lockdep_init_map
(
&
s
->
s_writers
.
lock_map
[
i
],
sb_writers_name
[
i
],
&
type
->
s_writers_key
[
i
],
0
);
}
init_waitqueue_head
(
&
s
->
s_writers
.
wait
);
init_waitqueue_head
(
&
s
->
s_writers
.
wait_unfrozen
);
return
0
;
err_out:
while
(
--
i
>=
0
)
percpu_counter_destroy
(
&
s
->
s_writers
.
counter
[
i
]);
return
err
;
}
static
void
destroy_sb_writers
(
struct
super_block
*
s
)
/**
* destroy_super - frees a superblock
* @s: superblock to free
*
* Frees a superblock.
*/
static
void
destroy_super
(
struct
super_block
*
s
)
{
int
i
;
list_lru_destroy
(
&
s
->
s_dentry_lru
);
list_lru_destroy
(
&
s
->
s_inode_lru
);
#ifdef CONFIG_SMP
free_percpu
(
s
->
s_files
);
#endif
for
(
i
=
0
;
i
<
SB_FREEZE_LEVELS
;
i
++
)
percpu_counter_destroy
(
&
s
->
s_writers
.
counter
[
i
]);
security_sb_free
(
s
);
WARN_ON
(
!
list_empty
(
&
s
->
s_mounts
));
kfree
(
s
->
s_subtype
);
kfree
(
s
->
s_options
);
kfree
(
s
);
}
/**
...
...
@@ -170,26 +164,31 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
{
struct
super_block
*
s
=
kzalloc
(
sizeof
(
struct
super_block
),
GFP_USER
);
static
const
struct
super_operations
default_op
;
int
i
;
if
(
!
s
)
return
NULL
;
if
(
s
)
{
if
(
security_sb_alloc
(
s
))
goto
out_free_sb
;
goto
fail
;
#ifdef CONFIG_SMP
s
->
s_files
=
alloc_percpu
(
struct
list_head
);
if
(
!
s
->
s_files
)
goto
err_out
;
else
{
int
i
;
goto
fail
;
for_each_possible_cpu
(
i
)
INIT_LIST_HEAD
(
per_cpu_ptr
(
s
->
s_files
,
i
));
}
#else
INIT_LIST_HEAD
(
&
s
->
s_files
);
#endif
if
(
init_sb_writers
(
s
,
type
))
goto
err_out
;
for
(
i
=
0
;
i
<
SB_FREEZE_LEVELS
;
i
++
)
{
if
(
percpu_counter_init
(
&
s
->
s_writers
.
counter
[
i
],
0
)
<
0
)
goto
fail
;
lockdep_init_map
(
&
s
->
s_writers
.
lock_map
[
i
],
sb_writers_name
[
i
],
&
type
->
s_writers_key
[
i
],
0
);
}
init_waitqueue_head
(
&
s
->
s_writers
.
wait
);
init_waitqueue_head
(
&
s
->
s_writers
.
wait_unfrozen
);
s
->
s_flags
=
flags
;
s
->
s_bdi
=
&
default_backing_dev_info
;
INIT_HLIST_NODE
(
&
s
->
s_instances
);
...
...
@@ -197,9 +196,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
INIT_LIST_HEAD
(
&
s
->
s_inodes
);
if
(
list_lru_init
(
&
s
->
s_dentry_lru
))
goto
err_out
;
goto
fail
;
if
(
list_lru_init
(
&
s
->
s_inode_lru
))
goto
err_out_dentry_lru
;
goto
fail
;
INIT_LIST_HEAD
(
&
s
->
s_mounts
);
init_rwsem
(
&
s
->
s_umount
);
...
...
@@ -237,44 +236,11 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)
s
->
s_shrink
.
count_objects
=
super_cache_count
;
s
->
s_shrink
.
batch
=
1024
;
s
->
s_shrink
.
flags
=
SHRINKER_NUMA_AWARE
;
}
out:
return
s
;
err_out_dentry_lru:
list_lru_destroy
(
&
s
->
s_dentry_lru
);
err_out:
security_sb_free
(
s
);
#ifdef CONFIG_SMP
if
(
s
->
s_files
)
free_percpu
(
s
->
s_files
);
#endif
destroy_sb_writers
(
s
);
out_free_sb:
kfree
(
s
);
s
=
NULL
;
goto
out
;
}
/**
* destroy_super - frees a superblock
* @s: superblock to free
*
* Frees a superblock.
*/
static
inline
void
destroy_super
(
struct
super_block
*
s
)
{
list_lru_destroy
(
&
s
->
s_dentry_lru
);
list_lru_destroy
(
&
s
->
s_inode_lru
);
#ifdef CONFIG_SMP
free_percpu
(
s
->
s_files
);
#endif
destroy_sb_writers
(
s
);
security_sb_free
(
s
);
WARN_ON
(
!
list_empty
(
&
s
->
s_mounts
));
kfree
(
s
->
s_subtype
);
kfree
(
s
->
s_options
);
kfree
(
s
);
fail:
destroy_super
(
s
);
return
NULL
;
}
/* Superblock refcounting */
...
...
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