Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226712
b: refs/heads/master
c: 61f3dee
h: refs/heads/master
v: v3
  • Loading branch information
Nick Piggin committed Jan 7, 2011
1 parent 994552b commit 329c0f7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 58db63d086790eec2ed433f9d8c4962239809cf8
refs/heads/master: 61f3dee4af09528997a970280da240577bf60721
52 changes: 23 additions & 29 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,35 +323,16 @@ void dput(struct dentry *dentry)
if (dentry->d_count == 1)
might_sleep();
spin_lock(&dentry->d_lock);
if (IS_ROOT(dentry))
parent = NULL;
else
parent = dentry->d_parent;
if (dentry->d_count == 1) {
if (!spin_trylock(&dcache_inode_lock)) {
drop2:
spin_unlock(&dentry->d_lock);
goto repeat;
}
if (parent && !spin_trylock(&parent->d_lock)) {
spin_unlock(&dcache_inode_lock);
goto drop2;
}
}
dentry->d_count--;
if (dentry->d_count) {
BUG_ON(!dentry->d_count);
if (dentry->d_count > 1) {
dentry->d_count--;
spin_unlock(&dentry->d_lock);
if (parent)
spin_unlock(&parent->d_lock);
return;
}

/*
* AV: ->d_delete() is _NOT_ allowed to block now.
*/
if (dentry->d_op && dentry->d_op->d_delete) {
if (dentry->d_op->d_delete(dentry))
goto unhash_it;
goto kill_it;
}

/* Unreachable? Get rid of it */
Expand All @@ -362,17 +343,30 @@ void dput(struct dentry *dentry)
dentry->d_flags |= DCACHE_REFERENCED;
dentry_lru_add(dentry);

spin_unlock(&dentry->d_lock);
if (parent)
spin_unlock(&parent->d_lock);
spin_unlock(&dcache_inode_lock);
dentry->d_count--;
spin_unlock(&dentry->d_lock);
return;

unhash_it:
__d_drop(dentry);
kill_it:
if (!spin_trylock(&dcache_inode_lock)) {
relock:
spin_unlock(&dentry->d_lock);
cpu_relax();
goto repeat;
}
if (IS_ROOT(dentry))
parent = NULL;
else
parent = dentry->d_parent;
if (parent && !spin_trylock(&parent->d_lock)) {
spin_unlock(&dcache_inode_lock);
goto relock;
}
dentry->d_count--;
/* if dentry was on the d_lru list delete it from there */
dentry_lru_del(dentry);
/* if it was on the hash (d_delete case), then remove it */
__d_drop(dentry);
dentry = d_kill(dentry, parent);
if (dentry)
goto repeat;
Expand Down

0 comments on commit 329c0f7

Please sign in to comment.