erasure: allocate buffer only for non-nil disk (#1811)

master
Bala FA 8 years ago committed by Harshavardhana
parent 89f65333fb
commit db2fdbf38d
  1. 5
      erasure-readfile.go

@ -34,12 +34,11 @@ func (e erasure) ReadFile(volume, path string, startOffset int64, buffer []byte)
// Read from all the disks.
for index, disk := range e.storageDisks {
blockIndex := e.distribution[index] - 1
// Initialize shard slice and fill the data from each parts.
enBlocks[blockIndex] = make([]byte, curEncBlockSize)
if disk == nil {
enBlocks[blockIndex] = nil
continue
}
// Initialize shard slice and fill the data from each parts.
enBlocks[blockIndex] = make([]byte, curEncBlockSize)
// Read the necessary blocks.
_, err := disk.ReadFile(volume, path, offsetEncOffset, enBlocks[blockIndex])
if err != nil {

Loading…
Cancel
Save