fs: fold _d_rehash into d_rehash
PATCH 1/1 fs: fold _d_rehash into d_rehash
Signed-off-by Christoph Hellwig <[email protected]>
--- fs/dcache.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
fs/dcache.c +1 -6
@@ -2325,11 +2325,6 @@ static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b)hlist_bl_unlock (b); } -static void _d_rehash (struct dentry * entry) -{ -__d_rehash (entry,d_hash (entry->d_parent, entry->d_name.hash)); -} -/** * d_rehash - add an entry back to the hash * @entry: dentry to add to the hash
@@ -2340,7 +2335,7 @@ static void _d_rehash(struct dentry * entry)void d_rehash (struct dentry * entry) {spin_lock (&entry->d_lock); -_d_rehash (entry); +__d_rehash (entry,d_hash (entry->d_parent, entry->d_name.hash));spin_unlock (&entry->d_lock); }EXPORT_SYMBOL (d_rehash);
Signature · 1 line
1.9.1
Al Viro
maintainerOn Thu, Oct 02, 2014 at 07:34:24PM +0200, Christoph Hellwig wrote:
FWIW, I already have something stronger in my tree. Look: the only reason to have separate __d_rehash() is doing it early in __d_move(). Move that past the place where we change names and locations and you get this:
fs/dcache.c +6 -12
@@ -2345,8 +2345,9 @@ again: }EXPORT_SYMBOL (d_delete); -static void __d_rehash (struct dentry * entry,struct hlist_bl_head *b) +static void __d_rehash (struct dentry *entry) { +struct hlist_bl_head *b =d_hash (entry->d_parent, entry->d_name.hash);BUG_ON (!d_unhashed (entry));hlist_bl_lock (b); entry->d_flags |=DCACHE_RCUACCESS ;
@@ -2354,11 +2355,6 @@ static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b)hlist_bl_unlock (b); } -static void _d_rehash (struct dentry * entry) -{ -__d_rehash (entry,d_hash (entry->d_parent, entry->d_name.hash)); -} -/** * d_rehash - add an entry back to the hash * @entry: dentry to add to the hash
@@ -2369,7 +2365,7 @@ static void _d_rehash(struct dentry * entry)void d_rehash (struct dentry * entry) {spin_lock (&entry->d_lock); -_d_rehash (entry); +__d_rehash (entry);spin_unlock (&entry->d_lock); }EXPORT_SYMBOL (d_rehash);
@@ -2545,17 +2541,12 @@ static void __d_move(struct dentry *dentry, struct dentry *target,* for the same hash queue because of how unlikely it is. */ __d_drop (dentry); -__d_rehash (dentry,d_hash (target->d_parent, target->d_name.hash));/* * Unhash the target (d_delete() is not usable here). If exchanging * the two dentries, then rehash onto the other's hash queue. */ __d_drop (target); -if (exchange) { -__d_rehash (target, -d_hash (dentry->d_parent, dentry->d_name.hash)); - }/* Switch the names.. */ if (exchange)
@@ -2579,6 +2570,9 @@ static void __d_move(struct dentry *dentry, struct dentry *target,fsnotify_d_move (target);fsnotify_d_move (dentry); } +__d_rehash (dentry); +if (exchange) +__d_rehash (target);write_seqcount_end (&target->d_seq);write_seqcount_end (&dentry->d_seq);