From 46a28b8819b96deecf2aae7a19cb4bd6da29012b Mon Sep 17 00:00:00 2001 From: chrislu Date: Sun, 6 Mar 2022 17:22:49 -0800 Subject: [PATCH] mount: adjust disk space based on quota --- weed/mount/weedfs_stats.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/weed/mount/weedfs_stats.go b/weed/mount/weedfs_stats.go index 0da41ab0b..21f664889 100644 --- a/weed/mount/weedfs_stats.go +++ b/weed/mount/weedfs_stats.go @@ -57,6 +57,13 @@ func (wfs *WFS) StatFs(cancel <-chan struct{}, in *fuse.InHeader, out *fuse.Stat usedDiskSize := wfs.stats.UsedSize actualFileCount := wfs.stats.FileCount + if wfs.option.Quota > 0 && totalDiskSize > uint64(wfs.option.Quota) { + totalDiskSize = uint64(wfs.option.Quota) + if usedDiskSize > totalDiskSize { + totalDiskSize = usedDiskSize + } + } + // Compute the total number of available blocks out.Blocks = totalDiskSize / blockSize