mirror of
https://github.com/minio/minio.git
synced 2025-03-31 17:53:43 -04:00
erasure: allocate buffer only for non-nil disk (#1811)
This commit is contained in:
parent
89f65333fb
commit
db2fdbf38d
@ -34,12 +34,11 @@ func (e erasure) ReadFile(volume, path string, startOffset int64, buffer []byte)
|
|||||||
// Read from all the disks.
|
// Read from all the disks.
|
||||||
for index, disk := range e.storageDisks {
|
for index, disk := range e.storageDisks {
|
||||||
blockIndex := e.distribution[index] - 1
|
blockIndex := e.distribution[index] - 1
|
||||||
// Initialize shard slice and fill the data from each parts.
|
|
||||||
enBlocks[blockIndex] = make([]byte, curEncBlockSize)
|
|
||||||
if disk == nil {
|
if disk == nil {
|
||||||
enBlocks[blockIndex] = nil
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// Initialize shard slice and fill the data from each parts.
|
||||||
|
enBlocks[blockIndex] = make([]byte, curEncBlockSize)
|
||||||
// Read the necessary blocks.
|
// Read the necessary blocks.
|
||||||
_, err := disk.ReadFile(volume, path, offsetEncOffset, enBlocks[blockIndex])
|
_, err := disk.ReadFile(volume, path, offsetEncOffset, enBlocks[blockIndex])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user