diff --git a/xl-erasure-v1-common.go b/xl-erasure-v1-common.go index f1093ad3c..249b4adef 100644 --- a/xl-erasure-v1-common.go +++ b/xl-erasure-v1-common.go @@ -36,7 +36,7 @@ func highestInt(intSlice []int64) (highestInteger int64) { } // Extracts file versions from partsMetadata slice and returns version slice. -func listFileVersions(partsMetadata []xlMetaV1, errs []error) (versions []int64, err error) { +func listFileVersions(partsMetadata []xlMetaV1, errs []error) (versions []int64) { versions = make([]int64, len(partsMetadata)) for index, metadata := range partsMetadata { if errs[index] == nil { @@ -45,7 +45,7 @@ func listFileVersions(partsMetadata []xlMetaV1, errs []error) (versions []int64, versions[index] = -1 } } - return versions, nil + return versions } // Returns slice of online disks needed. @@ -73,14 +73,7 @@ func (xl XL) listOnlineDisks(volume, path string) (onlineDisks []StorageAPI, mda highestVersion := int64(0) onlineDisks = make([]StorageAPI, len(xl.storageDisks)) // List all the file versions from partsMetadata list. - versions, err := listFileVersions(partsMetadata, errs) - if err != nil { - log.WithFields(logrus.Fields{ - "volume": volume, - "path": path, - }).Errorf("Extracting file versions failed with %s", err) - return nil, xlMetaV1{}, false, err - } + versions := listFileVersions(partsMetadata, errs) // Get highest file version. highestVersion = highestInt(versions) diff --git a/xl-erasure-v1-createfile.go b/xl-erasure-v1-createfile.go index c7a43d09e..74208b0c6 100644 --- a/xl-erasure-v1-createfile.go +++ b/xl-erasure-v1-createfile.go @@ -79,8 +79,9 @@ func (xl XL) writeErasure(volume, path string, reader *io.PipeReader, wcloser *w } } + var err error // List all the file versions on existing files. - versions, err := listFileVersions(partsMetadata, errs) + versions := listFileVersions(partsMetadata, errs) // Get highest file version. higherVersion := highestInt(versions) // Increment to have next higher version. diff --git a/xl-erasure-v1.go b/xl-erasure-v1.go index a70aa3365..8dcbbd083 100644 --- a/xl-erasure-v1.go +++ b/xl-erasure-v1.go @@ -554,8 +554,10 @@ func (xl XL) DeleteFile(volume, path string) error { partsMetadata, errs := xl.getPartsMetadata(volume, path) nsMutex.RUnlock(volume, path) + var err error + // List all the file versions on existing files. - versions, err := listFileVersions(partsMetadata, errs) + versions := listFileVersions(partsMetadata, errs) // Get highest file version. higherVersion := highestInt(versions)