Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 4a4be1a

Browse files
committed
Revert "vfs: Delete the associated dentry when deleting a file"
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>
1 parent 397a83a commit 4a4be1a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

fs/dcache.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,17 +2360,19 @@ EXPORT_SYMBOL(d_hash_and_lookup);
23602360
* - unhash this dentry and free it.
23612361
*
23622362
* Usually, we want to just turn this into
2363-
* a negative dentry, but certain workloads can
2364-
* generate a large number of negative dentries.
2365-
* Therefore, it would be better to simply
2366-
* unhash it.
2363+
* a negative dentry, but if anybody else is
2364+
* currently using the dentry or the inode
2365+
* we can't do that and we fall back on removing
2366+
* it from the hash queues and waiting for
2367+
* it to be deleted later when it has no users
23672368
*/
23682369

23692370
/**
23702371
* d_delete - delete a dentry
23712372
* @dentry: The dentry to delete
23722373
*
2373-
* Remove the dentry from the hash queues so it can be deleted later.
2374+
* Turn the dentry into a negative dentry if possible, otherwise
2375+
* remove it from the hash queues so it can be deleted later
23742376
*/
23752377

23762378
void d_delete(struct dentry * dentry)
@@ -2379,15 +2381,14 @@ void d_delete(struct dentry * dentry)
23792381

23802382
spin_lock(&inode->i_lock);
23812383
spin_lock(&dentry->d_lock);
2382-
__d_drop(dentry);
2383-
23842384
/*
23852385
* Are we the only user?
23862386
*/
23872387
if (dentry->d_lockref.count == 1) {
23882388
dentry->d_flags &= ~DCACHE_CANT_MOUNT;
23892389
dentry_unlink_inode(dentry);
23902390
} else {
2391+
__d_drop(dentry);
23912392
spin_unlock(&dentry->d_lock);
23922393
spin_unlock(&inode->i_lock);
23932394
}

0 commit comments

Comments
 (0)