Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 42888
b: refs/heads/master
c: b342341
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and Linus Torvalds committed Dec 7, 2006
1 parent b192171 commit 1bd80e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 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: d18de5a2721f84ffd6a5d637915746ed47becc1c
refs/heads/master: b3423415fbc2e5461605826317da1c8dbbf21f97
16 changes: 12 additions & 4 deletions trunk/fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,19 @@ struct dentry_stat_t dentry_stat = {
.age_limit = 45,
};

static void d_callback(struct rcu_head *head)
static void __d_free(struct dentry *dentry)
{
struct dentry * dentry = container_of(head, struct dentry, d_u.d_rcu);

if (dname_external(dentry))
kfree(dentry->d_name.name);
kmem_cache_free(dentry_cache, dentry);
}

static void d_callback(struct rcu_head *head)
{
struct dentry * dentry = container_of(head, struct dentry, d_u.d_rcu);
__d_free(dentry);
}

/*
* no dcache_lock, please. The caller must decrement dentry_stat.nr_dentry
* inside dcache_lock.
Expand All @@ -85,7 +89,11 @@ static void d_free(struct dentry *dentry)
{
if (dentry->d_op && dentry->d_op->d_release)
dentry->d_op->d_release(dentry);
call_rcu(&dentry->d_u.d_rcu, d_callback);
/* if dentry was never inserted into hash, immediate free is OK */
if (dentry->d_hash.pprev == NULL)
__d_free(dentry);
else
call_rcu(&dentry->d_u.d_rcu, d_callback);
}

/*
Expand Down

0 comments on commit 1bd80e8

Please sign in to comment.