mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 10:06:14 +00:00
storage: fallocate return interrupt err try again
Call fallocate, return code Interrupt error, should try again Signed-off-by: YankunLi <liyankun01@58.com>
This commit is contained in:
parent
239cdf31b3
commit
c5a63ed8a2
@ -14,8 +14,23 @@
|
||||
|
||||
package storage
|
||||
|
||||
import "syscall"
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"github.com/cubefs/cubefs/util"
|
||||
)
|
||||
|
||||
func fallocate(fd int, mode uint32, off int64, len int64) (err error) {
|
||||
return syscall.Fallocate(fd, mode, off, len)
|
||||
var tryCnt int
|
||||
for {
|
||||
err = syscall.Fallocate(fd, mode, off, len)
|
||||
if err == syscall.EINTR {
|
||||
tryCnt++
|
||||
if tryCnt >= util.SyscallTryMaxTimes {
|
||||
return
|
||||
}
|
||||
continue
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
15
util/unit.go
15
util/unit.go
@ -32,13 +32,14 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
BlockCount = 1024
|
||||
BlockSize = 65536 * 2
|
||||
ReadBlockSize = BlockSize
|
||||
PerBlockCrcSize = 4
|
||||
ExtentSize = BlockCount * BlockSize
|
||||
PacketHeaderSize = 57
|
||||
BlockHeaderSize = 4096
|
||||
BlockCount = 1024
|
||||
BlockSize = 65536 * 2
|
||||
ReadBlockSize = BlockSize
|
||||
PerBlockCrcSize = 4
|
||||
ExtentSize = BlockCount * BlockSize
|
||||
PacketHeaderSize = 57
|
||||
BlockHeaderSize = 4096
|
||||
SyscallTryMaxTimes = 3
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user