Skip to content

Commit

Permalink
fuse: fold systemWrite and write together
Browse files Browse the repository at this point in the history
Change-Id: Iddf69afb97c1437b874d9cb0220bada5072b7f63
  • Loading branch information
hanwen committed Nov 1, 2024
1 parent 9574542 commit ce18045
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions fuse/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,15 +612,11 @@ func (ms *Server) handleRequest(req *requestAlloc) Status {
req.outPayload = ms.buffers.AllocBuffer(uint32(outPayloadSize))
}
ms.innerHandleRequest(h, &req.request)
code = ms.write(&req.request)
return code
}

func (ms *Server) write(req *request) Status {
if req.suppressReply {
return OK
}
errno := ms.systemWrite(req)

errno := ms.write(&req.request)
if errno != 0 {
// Ignore ENOENT for INTERRUPT responses which
// indicates that the referred request is no longer
Expand Down Expand Up @@ -703,7 +699,7 @@ func (ms *Server) notifyWrite(req *request) Status {

// Protect against concurrent close.
ms.writeMu.Lock()
result := ms.systemWrite(req)
result := ms.write(req)
ms.writeMu.Unlock()

if ms.opts.Debug {
Expand Down
2 changes: 1 addition & 1 deletion fuse/server_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

const useSingleReader = false

func (ms *Server) systemWrite(req *request) Status {
func (ms *Server) write(req *request) Status {
if req.outPayloadSize() == 0 {
err := handleEINTR(func() error {
_, err := syscall.Write(ms.mountFd, req.outputBuf)
Expand Down
2 changes: 1 addition & 1 deletion fuse/server_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// do not error-out, meaning that unmount will hang.
const useSingleReader = true

func (ms *Server) systemWrite(req *request) Status {
func (ms *Server) write(req *request) Status {
if req.outPayloadSize() == 0 {
err := handleEINTR(func() error {
_, err := unix.Write(ms.mountFd, req.outputBuf)
Expand Down

0 comments on commit ce18045

Please sign in to comment.