From f4d04ded98f4e77d5e36146ce6e785923af69ab2 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Mon, 14 Aug 2023 13:08:42 +0200 Subject: [PATCH] overlay: Diffsize: avoid naive diff Computing the diff size for the rootful overlay storage driver used the naive diff. The reasoning was that we have made use of rootful copy-up. The downside is a mind-blowing performance penalty in comparison to the rootless case. Hence, drop the naive diff and only compute the size of the directory which is absolutely sufficient for the motivating use case of podman-system-df. This drops the execution of system-df from 19.3s to 0.11s listing 5 containers and 1 image. Fixes: github.com/containers/podman/issues/19467 Signed-off-by: Valentin Rothberg --- drivers/overlay/overlay.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/overlay/overlay.go b/drivers/overlay/overlay.go index 6b6f20637d..7e91dd1617 100644 --- a/drivers/overlay/overlay.go +++ b/drivers/overlay/overlay.go @@ -2162,10 +2162,6 @@ func (d *Driver) getLowerDiffPaths(id string) ([]string, error) { // and its parent and returns the size in bytes of the changes // relative to its base filesystem directory. func (d *Driver) DiffSize(id string, idMappings *idtools.IDMappings, parent string, parentMappings *idtools.IDMappings, mountLabel string) (size int64, err error) { - if d.options.mountProgram == "" && (d.useNaiveDiff() || !d.isParent(id, parent)) { - return d.naiveDiff.DiffSize(id, idMappings, parent, parentMappings, mountLabel) - } - p, err := d.getDiffPath(id) if err != nil { return 0, err