Commit 9334ba57 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Actually inspect canSplice setting.

parent 3d0a4381
...@@ -9,16 +9,19 @@ func (ms *MountState) systemWrite(req *request, header []byte) Status { ...@@ -9,16 +9,19 @@ func (ms *MountState) systemWrite(req *request, header []byte) Status {
} }
if req.fdData != nil { if req.fdData != nil {
if err := ms.trySplice(header, req, req.fdData); err == nil { if ms.canSplice {
req.readResult.Done() err := ms.trySplice(header, req, req.fdData)
return OK if err == nil {
} else { req.readResult.Done()
return OK
}
log.Println("trySplice:", err) log.Println("trySplice:", err)
sz := req.flatDataSize()
buf := ms.AllocOut(req, uint32(sz))
req.flatData, req.status = req.fdData.Bytes(buf)
header = req.serializeHeader(len(req.flatData))
} }
sz := req.flatDataSize()
buf := ms.AllocOut(req, uint32(sz))
req.flatData, req.status = req.fdData.Bytes(buf)
header = req.serializeHeader(len(req.flatData))
} }
_, err := Writev(int(ms.mountFile.Fd()), [][]byte{header, req.flatData}) _, err := Writev(int(ms.mountFile.Fd()), [][]byte{header, req.flatData})
......
...@@ -116,7 +116,7 @@ func (r *request) OutputDebug() string { ...@@ -116,7 +116,7 @@ func (r *request) OutputDebug() string {
} else { } else {
spl := "" spl := ""
if r.fdData != nil { if r.fdData != nil {
spl = " (splice)" spl = " (fd data)"
} }
flatStr = fmt.Sprintf(" %d bytes data%s\n", r.flatDataSize(), spl) flatStr = fmt.Sprintf(" %d bytes data%s\n", r.flatDataSize(), spl)
} }
......
...@@ -32,8 +32,9 @@ func init() { ...@@ -32,8 +32,9 @@ func init() {
content, err := ioutil.ReadFile("/proc/sys/fs/pipe-max-size") content, err := ioutil.ReadFile("/proc/sys/fs/pipe-max-size")
if err != nil { if err != nil {
maxPipeSize = DefaultPipeSize maxPipeSize = DefaultPipeSize
} else {
fmt.Sscan(string(content), &maxPipeSize)
} }
fmt.Sscan(string(content), &maxPipeSize)
r, w, err := os.Pipe() r, w, err := os.Pipe()
if err != nil { if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment