Skip to content

Commit c0f897f

Browse files
set alignsize to 4096 on all platforms
1 parent ec78863 commit c0f897f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cmd/cmd.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"path/filepath"
2626

2727
"github.com/dustin/go-humanize"
28-
"github.com/ncw/directio"
2928
"github.com/spf13/cobra"
3029
"github.com/spf13/viper"
3130

@@ -37,6 +36,9 @@ import (
3736
// Version version string for dperf
3837
var Version = "dev"
3938

39+
// O_DIRECT align size.
40+
const alignSize = 4096
41+
4042
// flags
4143
var (
4244
serial = false
@@ -73,11 +75,11 @@ $ dperf --serial /mnt/drive{1..6}
7375
return fmt.Errorf("Invalid blocksize format: %v", err)
7476
}
7577

76-
if bs < directio.AlignSize {
78+
if bs < alignSize {
7779
return fmt.Errorf("Invalid blocksize must greater than 4k: %d", bs)
7880
}
7981

80-
if bs%directio.AlignSize != 0 {
82+
if bs%alignSize != 0 {
8183
return fmt.Errorf("Invalid blocksize must be multiples of 4k: %d", bs)
8284
}
8385

@@ -86,11 +88,11 @@ $ dperf --serial /mnt/drive{1..6}
8688
return fmt.Errorf("Invalid filesize format: %v", err)
8789
}
8890

89-
if fs < directio.AlignSize {
91+
if fs < alignSize {
9092
return fmt.Errorf("Invalid filesize must greater than 4k: %d", fs)
9193
}
9294

93-
if fs%directio.AlignSize != 0 {
95+
if fs%alignSize != 0 {
9496
return fmt.Errorf("Invalid filesize must multiples of 4k: %d", fs)
9597
}
9698

0 commit comments

Comments
 (0)