mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
vendor: update reedsolomon package with new perm improvements. (#1422)
This commit is contained in:
parent
4e34e03dd4
commit
a9935f886c
5
vendor/github.com/klauspost/reedsolomon/matrix.go
generated
vendored
5
vendor/github.com/klauspost/reedsolomon/matrix.go
generated
vendored
@ -178,10 +178,7 @@ func (m matrix) SwapRows(r1, r2 int) error {
|
||||
// IsSquare will return true if the matrix is square
|
||||
// and nil if the matrix is square
|
||||
func (m matrix) IsSquare() bool {
|
||||
if len(m) != len(m[0]) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
return len(m) == len(m[0])
|
||||
}
|
||||
|
||||
// errSingular is returned if the matrix is singular and cannot be inversed
|
||||
|
47
vendor/github.com/klauspost/reedsolomon/reedsolomon.go
generated
vendored
47
vendor/github.com/klauspost/reedsolomon/reedsolomon.go
generated
vendored
@ -189,7 +189,7 @@ func (r reedSolomon) Verify(shards [][]byte) (bool, error) {
|
||||
// number of matrix rows used, is determined by
|
||||
// outputCount, which is the number of outputs to compute.
|
||||
func (r reedSolomon) codeSomeShards(matrixRows, inputs, outputs [][]byte, outputCount, byteCount int) {
|
||||
if runtime.GOMAXPROCS(0) > 1 && len(inputs[0]) > splitSize {
|
||||
if runtime.GOMAXPROCS(0) > 1 && len(inputs[0]) > minSplitSize {
|
||||
r.codeSomeShardsP(matrixRows, inputs, outputs, outputCount, byteCount)
|
||||
return
|
||||
}
|
||||
@ -205,24 +205,24 @@ func (r reedSolomon) codeSomeShards(matrixRows, inputs, outputs [][]byte, output
|
||||
}
|
||||
}
|
||||
|
||||
// How many bytes per goroutine.
|
||||
const splitSize = 512
|
||||
const (
|
||||
minSplitSize = 512 // min split size per goroutine
|
||||
maxGoroutines = 50 // max goroutines number for encoding & decoding
|
||||
)
|
||||
|
||||
// Perform the same as codeSomeShards, but split the workload into
|
||||
// several goroutines.
|
||||
func (r reedSolomon) codeSomeShardsP(matrixRows, inputs, outputs [][]byte, outputCount, byteCount int) {
|
||||
var wg sync.WaitGroup
|
||||
left := byteCount
|
||||
do := byteCount / maxGoroutines
|
||||
if do < minSplitSize {
|
||||
do = minSplitSize
|
||||
}
|
||||
start := 0
|
||||
for {
|
||||
do := left
|
||||
if do > splitSize {
|
||||
do = splitSize
|
||||
for start < byteCount {
|
||||
if start+do > byteCount {
|
||||
do = byteCount - start
|
||||
}
|
||||
if do == 0 {
|
||||
break
|
||||
}
|
||||
left -= do
|
||||
wg.Add(1)
|
||||
go func(start, stop int) {
|
||||
for c := 0; c < r.DataShards; c++ {
|
||||
@ -246,22 +246,19 @@ func (r reedSolomon) codeSomeShardsP(matrixRows, inputs, outputs [][]byte, outpu
|
||||
// except this will check values and return
|
||||
// as soon as a difference is found.
|
||||
func (r reedSolomon) checkSomeShards(matrixRows, inputs, toCheck [][]byte, outputCount, byteCount int) bool {
|
||||
var wg sync.WaitGroup
|
||||
left := byteCount
|
||||
start := 0
|
||||
|
||||
same := true
|
||||
var mu sync.RWMutex // For above
|
||||
|
||||
for {
|
||||
do := left
|
||||
if do > splitSize {
|
||||
do = splitSize
|
||||
var wg sync.WaitGroup
|
||||
do := byteCount / maxGoroutines
|
||||
if do < minSplitSize {
|
||||
do = minSplitSize
|
||||
}
|
||||
start := 0
|
||||
for start < byteCount {
|
||||
if start+do > byteCount {
|
||||
do = byteCount - start
|
||||
}
|
||||
if do == 0 {
|
||||
break
|
||||
}
|
||||
left -= do
|
||||
wg.Add(1)
|
||||
go func(start, do int) {
|
||||
defer wg.Done()
|
||||
@ -283,7 +280,7 @@ func (r reedSolomon) checkSomeShards(matrixRows, inputs, toCheck [][]byte, outpu
|
||||
}
|
||||
|
||||
for i, calc := range outputs {
|
||||
if bytes.Compare(calc, toCheck[i][start:start+do]) != 0 {
|
||||
if !bytes.Equal(calc, toCheck[i][start:start+do]) {
|
||||
mu.Lock()
|
||||
same = false
|
||||
mu.Unlock()
|
||||
|
4
vendor/vendor.json
vendored
4
vendor/vendor.json
vendored
@ -64,8 +64,8 @@
|
||||
},
|
||||
{
|
||||
"path": "github.com/klauspost/reedsolomon",
|
||||
"revision": "d1fe8adc280ef4cd7883943f15a1b5b085a5cced",
|
||||
"revisionTime": "2016-01-11T14:44:57+01:00"
|
||||
"revision": "0b630aea2793158b43d0e18f2f50280bfb27c4b4",
|
||||
"revisionTime": "2016-04-29T14:00:48-07:00"
|
||||
},
|
||||
{
|
||||
"path": "github.com/mattn/go-colorable",
|
||||
|
Loading…
Reference in New Issue
Block a user