Skip to content

Commit

Permalink
Revert "vfs: Delete the associated dentry when deleting a file"
Browse files Browse the repository at this point in the history
This reverts commit 681ce86.

We gave it a try, but it turns out the kernel test robot did in fact
find performance regressions for it, so we'll have to look at the more
involved alternative fixes for Yafang Shao's Elasticsearch load issue.

There were several alternatives discussed, they just weren't as simple
as this first attempt.

The report is of a -7.4% regression of filebench.sum_operations/s, which
appears significant enough to trigger my "this patch may get reverted if
somebody finds a performance regression on some other load" rule.

So it's still the case that we should end up deleting dentries more
aggressively - or just be better at pruning them later - but it needs a
bit more finesse than this simple thing.

Link: https://lore.kernel.org/all/202405291318.4dfbb352-oliver.sang@intel.com/
Cc: Yafang Shao <laoar.shao@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Linus Torvalds committed May 29, 2024
1 parent 397a83a commit 4a4be1a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -2360,17 +2360,19 @@ EXPORT_SYMBOL(d_hash_and_lookup);
* - unhash this dentry and free it.
*
* Usually, we want to just turn this into
* a negative dentry, but certain workloads can
* generate a large number of negative dentries.
* Therefore, it would be better to simply
* unhash it.
* a negative dentry, but if anybody else is
* currently using the dentry or the inode
* we can't do that and we fall back on removing
* it from the hash queues and waiting for
* it to be deleted later when it has no users
*/

/**
* d_delete - delete a dentry
* @dentry: The dentry to delete
*
* Remove the dentry from the hash queues so it can be deleted later.
* Turn the dentry into a negative dentry if possible, otherwise
* remove it from the hash queues so it can be deleted later
*/

void d_delete(struct dentry * dentry)
Expand All @@ -2379,15 +2381,14 @@ void d_delete(struct dentry * dentry)

spin_lock(&inode->i_lock);
spin_lock(&dentry->d_lock);
__d_drop(dentry);

/*
* Are we the only user?
*/
if (dentry->d_lockref.count == 1) {
dentry->d_flags &= ~DCACHE_CANT_MOUNT;
dentry_unlink_inode(dentry);
} else {
__d_drop(dentry);
spin_unlock(&dentry->d_lock);
spin_unlock(&inode->i_lock);
}
Expand Down

0 comments on commit 4a4be1a

Please sign in to comment.