Skip to content

Commit

Permalink
Fix local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Anis Elleuch committed Oct 24, 2023
1 parent 7b02b04 commit c9dce25
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions cmd/erasure-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,13 +713,8 @@ func readAllXL(ctx context.Context, disks []StorageAPI, bucket, object string, r
return pickLatestQuorumFilesInfo(ctx, rawFileInfos, errs, bucket, object, readData, inclFreeVers, allParts)
}

func (er erasureObjects) getObjectFileInfo(ctx context.Context, bucket, object string, opts ObjectOptions, readData bool) (fi FileInfo, onlineMeta []FileInfo, onlineDisks []StorageAPI, err error) {
var (
modTime time.Time
etag string

mu sync.Mutex
)
func (er erasureObjects) getObjectFileInfo(ctx context.Context, bucket, object string, opts ObjectOptions, readData bool) (FileInfo, []FileInfo, []StorageAPI, error) {
var mu sync.Mutex

rawArr := make([]RawFileInfo, er.setDriveCount)
metaArr := make([]FileInfo, er.setDriveCount)
Expand Down Expand Up @@ -833,18 +828,27 @@ func (er erasureObjects) getObjectFileInfo(ctx context.Context, bucket, object s
if err != nil {
return FileInfo{}, nil, nil, time.Time{}, "", err
}
onlineDisks, modTime, etag = listOnlineDisks(disks, metaArr, errs, readQuorum)
fi, err = pickValidFileInfo(ctx, metaArr, modTime, etag, readQuorum)
onlineDisks, modTime, etag := listOnlineDisks(disks, metaArr, errs, readQuorum)
fi, err := pickValidFileInfo(ctx, metaArr, modTime, etag, readQuorum)
if err != nil {
return FileInfo{}, nil, nil, time.Time{}, "", err
}

onlineMeta = make([]FileInfo, len(metaArr))
onlineMeta := make([]FileInfo, len(metaArr))
copy(onlineMeta, metaArr)

return fi, onlineMeta, onlineDisks, modTime, etag, nil
}

var (
modTime time.Time
etag string
fi FileInfo
onlineMeta []FileInfo
onlineDisks []StorageAPI
err error
)

for success := range done {
totalResp++
if success {
Expand Down

0 comments on commit c9dce25

Please sign in to comment.