Skip to content

Commit

Permalink
new helper: dentry_free()
Browse files Browse the repository at this point in the history
The part of old d_free() is that dealt with actual freeing of dentry.
Taken out of dentry_kill() into a separate function.

Git-repo: https://github.com/torvalds/linux.git
Git-commit: b4f0354e968f5fabd39bc85b99fedae4a97589fe
Change-Id: I4b16554b6f6acc558d299ca3282eebf93612d8a9
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Ankit Jain <jankit@codeaurora.org>
  • Loading branch information
Al Viro authored and Gerrit - the friendly Code Review server committed Jun 25, 2018
1 parent d780ee8 commit 127763c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@ static void __d_free(struct rcu_head *head)
kmem_cache_free(dentry_cache, dentry);
}

static void dentry_free(struct dentry *dentry)
{
/* if dentry was never visible to RCU, immediate free is OK */
if (!(dentry->d_flags & DCACHE_RCUACCESS))
__d_free(&dentry->d_u.d_rcu);
else
call_rcu(&dentry->d_u.d_rcu, __d_free);
}

/*
* no locks, please.
*/
Expand All @@ -234,11 +243,7 @@ static void d_free(struct dentry *dentry)
if (dentry->d_op && dentry->d_op->d_release)
dentry->d_op->d_release(dentry);

/* if dentry was never visible to RCU, immediate free is OK */
if (!(dentry->d_flags & DCACHE_RCUACCESS))
__d_free(&dentry->d_u.d_rcu);
else
call_rcu(&dentry->d_u.d_rcu, __d_free);
dentry_free(dentry);
}

/**
Expand Down

0 comments on commit 127763c

Please sign in to comment.