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
a338579f
Commit
a338579f
authored
Feb 23, 2018
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dput(): consolidate the "do we need to retain it?" into an inlined helper
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
8b987a46
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
fs/dcache.c
fs/dcache.c
+23
-19
No files found.
fs/dcache.c
View file @
a338579f
...
...
@@ -626,6 +626,24 @@ static inline struct dentry *lock_parent(struct dentry *dentry)
return
__lock_parent
(
dentry
);
}
static
inline
bool
retain_dentry
(
struct
dentry
*
dentry
)
{
WARN_ON
(
d_in_lookup
(
dentry
));
/* Unreachable? Get rid of it */
if
(
unlikely
(
d_unhashed
(
dentry
)))
return
false
;
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_DISCONNECTED
))
return
false
;
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_OP_DELETE
))
{
if
(
dentry
->
d_op
->
d_delete
(
dentry
))
return
false
;
}
return
true
;
}
/*
* Finish off a dentry we've decided to kill.
* dentry->d_lock must be held, returns with it unlocked.
...
...
@@ -804,27 +822,13 @@ void dput(struct dentry *dentry)
/* Slow case: now with the dentry lock held */
rcu_read_unlock
();
WARN_ON
(
d_in_lookup
(
dentry
));
/* Unreachable? Get rid of it */
if
(
unlikely
(
d_unhashed
(
dentry
)))
goto
kill_it
;
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_DISCONNECTED
))
goto
kill_it
;
if
(
unlikely
(
dentry
->
d_flags
&
DCACHE_OP_DELETE
))
{
if
(
dentry
->
d_op
->
d_delete
(
dentry
))
goto
kill_it
;
if
(
likely
(
retain_dentry
(
dentry
)))
{
dentry_lru_add
(
dentry
);
dentry
->
d_lockref
.
count
--
;
spin_unlock
(
&
dentry
->
d_lock
);
return
;
}
dentry_lru_add
(
dentry
);
dentry
->
d_lockref
.
count
--
;
spin_unlock
(
&
dentry
->
d_lock
);
return
;
kill_it:
dentry
=
dentry_kill
(
dentry
);
if
(
dentry
)
{
cond_resched
();
...
...
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