From 11fd20e2b093687b309102997c58c9c9c7c69a99 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 8 Jul 2026 14:32:04 -0700 Subject: [PATCH] s3.bucket.list: measure quota usage by logical size (#10274) Align the usage percentage with s3.bucket.quota.enforce and the admin UI, which measure quota against the live data size (size minus un-vacuumed deleted bytes). Also print the logical size so both the raw and live views stay visible. --- weed/shell/command_s3_bucket_list.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/weed/shell/command_s3_bucket_list.go b/weed/shell/command_s3_bucket_list.go index 94eb2f8ba..b000652f7 100644 --- a/weed/shell/command_s3_bucket_list.go +++ b/weed/shell/command_s3_bucket_list.go @@ -64,14 +64,15 @@ func (c *commandS3BucketList) Do(args []string, commandEnv *CommandEnv, writer i return nil } collection := getCollectionName(commandEnv, entry.Name) - var collectionSize, fileCount float64 + var collectionSize, logicalSize, fileCount float64 if collectionInfo, found := collectionInfos[collection]; found { collectionSize = collectionInfo.Size + logicalSize = collectionInfo.LogicalSize() fileCount = collectionInfo.FileCount - collectionInfo.DeleteCount } - fmt.Fprintf(writer, " %s\tsize:%.0f\tchunk:%.0f", entry.Name, collectionSize, fileCount) + fmt.Fprintf(writer, " %s\tsize:%.0f\tlogical:%.0f\tchunk:%.0f", entry.Name, collectionSize, logicalSize, fileCount) if entry.Quota > 0 { - fmt.Fprintf(writer, "\tquota:%d\tusage:%.2f%%", entry.Quota, float64(collectionSize)*100/float64(entry.Quota)) + fmt.Fprintf(writer, "\tquota:%d\tusage:%.2f%%", entry.Quota, logicalSize*100/float64(entry.Quota)) } // Show bucket owner (use %q to escape special characters) if entry.Extended != nil {