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

Actually inspect canSplice setting.

parent 3d0a4381
...@@ -9,17 +9,20 @@ func (ms *MountState) systemWrite(req *request, header []byte) Status { ...@@ -9,17 +9,20 @@ 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 {
err := ms.trySplice(header, req, req.fdData)
if err == nil {
req.readResult.Done() req.readResult.Done()
return OK return OK
} else { }
log.Println("trySplice:", err) log.Println("trySplice:", err)
}
sz := req.flatDataSize() sz := req.flatDataSize()
buf := ms.AllocOut(req, uint32(sz)) buf := ms.AllocOut(req, uint32(sz))
req.flatData, req.status = req.fdData.Bytes(buf) req.flatData, req.status = req.fdData.Bytes(buf)
header = req.serializeHeader(len(req.flatData)) 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})
if req.readResult != nil { if req.readResult != nil {
......
...@@ -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