Message ID | 20150603001914.GA21606@mew (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On Tue, Jun 02, 2015 at 05:19:14PM -0700, Omar Sandoval wrote: > I also can't figure out what that shrink_dcache_sb() is doing there. > d_invalidate() already prunes the dentry cache under the deleted > subvolume, but this clears the dcache for the whole filesystem, which > could incur unnecessary overhead. Correct analysis and the penalty is noticeable. In a directory where the new/deleted subvolume flux is high. A 'ls' can take very long because all the cached dentries are forcibly dropped and the metadata blocks have to be read again. > The call was added by efefb1438be2 > ("Btrfs: remove negative dentry when deleting subvolumne"), which fixes > a problem in btrfs_dentry_delete(), but the commit message doesn't > explain what shrink_dcache_sb() had to do with it. I'll send in an > updated version with d_invalidate() moved and shrink_dcache_sb() removed > and see if anyone can enlighten me. I think it's a material for a separate patch. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 1c22c6518504..5a225cd0af65 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2413,8 +2413,6 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, goto out_unlock_inode; } - d_invalidate(dentry); - down_write(&root->fs_info->subvol_sem); err = may_destroy_subvol(dest); @@ -2508,6 +2506,7 @@ out_up_write: out_unlock_inode: mutex_unlock(&inode->i_mutex); if (!err) { + d_invalidate(dentry); shrink_dcache_sb(root->fs_info->sb); btrfs_invalidate_inodes(dest); d_delete(dentry);