Skip to content

Commit

Permalink
Fix local variables (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
vadmeste authored and harshavardhana committed Oct 31, 2023
1 parent 2b54e73 commit 4a3314e
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 @@ -716,13 +716,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 @@ -836,18 +831,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 4a3314e

Please sign in to comment.