From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: [PATCH 02/10] fs: simplify __d_free Date: Sun, 10 Oct 2010 05:36:22 -0400 Message-ID: <20101010093720.562471644@canuck.infradead.org> References: <20101010093620.416498597@canuck.infradead.org> Cc: eparis@redhat.com, linux-fsdevel@vger.kernel.org To: viro@zeniv.linux.org.uk Return-path: Received: from canuck.infradead.org ([134.117.69.58]:40674 "EHLO canuck.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754304Ab0JJJhc (ORCPT ); Sun, 10 Oct 2010 05:37:32 -0400 Content-Disposition: inline; filename=cleanup-d_free Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Remove d_callback and always call __d_free with a RCU head. Signed-off-by: Christoph Hellwig Index: linux-2.6/fs/dcache.c =================================================================== --- linux-2.6.orig/fs/dcache.c 2010-10-09 10:20:46.650004474 +0200 +++ linux-2.6/fs/dcache.c 2010-10-09 10:24:36.806004683 +0200 @@ -67,20 +67,16 @@ struct dentry_stat_t dentry_stat = { .age_limit = 45, }; -static void __d_free(struct dentry *dentry) +static void __d_free(struct rcu_head *head) { + struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); + WARN_ON(!list_empty(&dentry->d_alias)); 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. @@ -91,9 +87,9 @@ static void d_free(struct dentry *dentry dentry->d_op->d_release(dentry); /* if dentry was never inserted into hash, immediate free is OK */ if (hlist_unhashed(&dentry->d_hash)) - __d_free(dentry); + __d_free(&dentry->d_u.d_rcu); else - call_rcu(&dentry->d_u.d_rcu, d_callback); + call_rcu(&dentry->d_u.d_rcu, __d_free); } /*