mirror of
https://github.com/minio/minio.git
synced 2025-11-13 15:21:36 -05:00
Preallocate (safe) slices when we know the size (#10459)
This commit is contained in:
@@ -502,13 +502,13 @@ func (fs *FSObjects) ListBuckets(ctx context.Context) ([]BucketInfo, error) {
|
||||
atomic.AddInt64(&fs.activeIOCount, -1)
|
||||
}()
|
||||
|
||||
var bucketInfos []BucketInfo
|
||||
entries, err := readDir(fs.fsPath)
|
||||
if err != nil {
|
||||
logger.LogIf(ctx, errDiskNotFound)
|
||||
return nil, toObjectErr(errDiskNotFound)
|
||||
}
|
||||
|
||||
bucketInfos := make([]BucketInfo, 0, len(entries))
|
||||
for _, entry := range entries {
|
||||
// Ignore all reserved bucket names and invalid bucket names.
|
||||
if isReservedOrInvalidBucket(entry, false) {
|
||||
|
||||
Reference in New Issue
Block a user