mirror of
https://github.com/containers/podman.git
synced 2025-10-18 03:33:32 +08:00
libpod/Container.rootFsSize(): use recorded image sizes
In rootFsSize(), instead of calculating the size of the diff for every layer of the container's base image, ask the storage library for the sum of the values it recorded when it first wrote those layers. In a similar fashion, teach rwSize() to use the library's ContainerSize() method instead of trying to roll its own. Replace calls to pkg/util.SizeOfPath() with calls to github.com/containers/storage/pkg/directory.Size(), which does the same thing. Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
@ -6,7 +6,7 @@ import (
|
||||
"github.com/containers/podman/v4/libpod/define"
|
||||
"github.com/containers/podman/v4/libpod/lock"
|
||||
"github.com/containers/podman/v4/libpod/plugin"
|
||||
"github.com/containers/podman/v4/pkg/util"
|
||||
"github.com/containers/storage/pkg/directory"
|
||||
)
|
||||
|
||||
// Volume is a libpod named volume.
|
||||
@ -109,7 +109,8 @@ func (v *Volume) Name() string {
|
||||
|
||||
// Returns the size on disk of volume
|
||||
func (v *Volume) Size() (uint64, error) {
|
||||
return util.SizeOfPath(v.config.MountPoint)
|
||||
size, err := directory.Size(v.config.MountPoint)
|
||||
return uint64(size), err
|
||||
}
|
||||
|
||||
// Driver retrieves the volume's driver.
|
||||
|
Reference in New Issue
Block a user