xl: remove unused err return in listFileVersions() (#1434)

master
Bala FA 9 years ago committed by Harshavardhana
parent ac2933c799
commit d5df8b8b8d
  1. 13
      xl-erasure-v1-common.go
  2. 3
      xl-erasure-v1-createfile.go
  3. 4
      xl-erasure-v1.go

@ -36,7 +36,7 @@ func highestInt(intSlice []int64) (highestInteger int64) {
} }
// Extracts file versions from partsMetadata slice and returns version slice. // 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)) versions = make([]int64, len(partsMetadata))
for index, metadata := range partsMetadata { for index, metadata := range partsMetadata {
if errs[index] == nil { if errs[index] == nil {
@ -45,7 +45,7 @@ func listFileVersions(partsMetadata []xlMetaV1, errs []error) (versions []int64,
versions[index] = -1 versions[index] = -1
} }
} }
return versions, nil return versions
} }
// Returns slice of online disks needed. // Returns slice of online disks needed.
@ -73,14 +73,7 @@ func (xl XL) listOnlineDisks(volume, path string) (onlineDisks []StorageAPI, mda
highestVersion := int64(0) highestVersion := int64(0)
onlineDisks = make([]StorageAPI, len(xl.storageDisks)) onlineDisks = make([]StorageAPI, len(xl.storageDisks))
// List all the file versions from partsMetadata list. // List all the file versions from partsMetadata list.
versions, err := listFileVersions(partsMetadata, errs) versions := 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
}
// Get highest file version. // Get highest file version.
highestVersion = highestInt(versions) highestVersion = highestInt(versions)

@ -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. // List all the file versions on existing files.
versions, err := listFileVersions(partsMetadata, errs) versions := listFileVersions(partsMetadata, errs)
// Get highest file version. // Get highest file version.
higherVersion := highestInt(versions) higherVersion := highestInt(versions)
// Increment to have next higher version. // Increment to have next higher version.

@ -554,8 +554,10 @@ func (xl XL) DeleteFile(volume, path string) error {
partsMetadata, errs := xl.getPartsMetadata(volume, path) partsMetadata, errs := xl.getPartsMetadata(volume, path)
nsMutex.RUnlock(volume, path) nsMutex.RUnlock(volume, path)
var err error
// List all the file versions on existing files. // List all the file versions on existing files.
versions, err := listFileVersions(partsMetadata, errs) versions := listFileVersions(partsMetadata, errs)
// Get highest file version. // Get highest file version.
higherVersion := highestInt(versions) higherVersion := highestInt(versions)

Loading…
Cancel
Save