Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/dperf/perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"sync"

"github.com/google/uuid"
"github.com/ncw/directio"
)

// DrivePerf options
Expand Down Expand Up @@ -55,7 +54,7 @@ func (d *DrivePerf) runTests(ctx context.Context, path string, testUUID string)
dataBuffers := make([][]byte, d.IOPerDrive)
for i := 0; i < d.IOPerDrive; i++ {
// Read Aligned block upto a multiple of BlockSize
dataBuffers[i] = directio.AlignedBlock(int(d.BlockSize))
dataBuffers[i] = alignedBlock(int(d.BlockSize))
}

testUUIDPath := filepath.Join(path, testUUID)
Expand Down
5 changes: 5 additions & 0 deletions pkg/dperf/run_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ func (d *DrivePerf) runReadTest(ctx context.Context, path string, data []byte) (
return uint64(throughputInSeconds), nil
}

// alignedBlock - pass through to directio implementation.
func alignedBlock(blockSize int) []byte {
return directio.AlignedBlock(blockSize)
}

// fdatasync - fdatasync() is similar to fsync(), but does not flush modified metadata
// unless that metadata is needed in order to allow a subsequent data retrieval
// to be correctly handled. For example, changes to st_atime or st_mtime
Expand Down
4 changes: 4 additions & 0 deletions pkg/dperf/run_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ func (d *DrivePerf) runReadTest(ctx context.Context, path string, _ []byte) (uin
func (d *DrivePerf) runWriteTest(ctx context.Context, path string, _ []byte) (uint64, error) {
return 0, ErrNotImplemented
}

func alignedBlock(blockSize int) []byte {
return make([]byte, 0)
}