Commit 8c85ded1 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse/nodefs: make critical section smaller for Utimens.

parent b938fedf
...@@ -11,8 +11,6 @@ import ( ...@@ -11,8 +11,6 @@ import (
func (f *loopbackFile) Allocate(off uint64, sz uint64, mode uint32) fuse.Status { func (f *loopbackFile) Allocate(off uint64, sz uint64, mode uint32) fuse.Status {
// TODO: Handle `mode` parameter. // TODO: Handle `mode` parameter.
f.lock.Lock()
// From `man fcntl` on OSX: // From `man fcntl` on OSX:
// The F_PREALLOCATE command operates on the following structure: // The F_PREALLOCATE command operates on the following structure:
// //
...@@ -54,6 +52,7 @@ func (f *loopbackFile) Allocate(off uint64, sz uint64, mode uint32) fuse.Status ...@@ -54,6 +52,7 @@ func (f *loopbackFile) Allocate(off uint64, sz uint64, mode uint32) fuse.Status
// Linux version for reference: // Linux version for reference:
// err := syscall.Fallocate(int(f.File.Fd()), mode, int64(off), int64(sz)) // err := syscall.Fallocate(int(f.File.Fd()), mode, int64(off), int64(sz))
f.lock.Lock()
_, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.File.Fd(), uintptr(syscall.F_PREALLOCATE), uintptr(unsafe.Pointer(&k))) _, _, errno := syscall.Syscall(syscall.SYS_FCNTL, f.File.Fd(), uintptr(syscall.F_PREALLOCATE), uintptr(unsafe.Pointer(&k)))
f.lock.Unlock() f.lock.Unlock()
if errno != 0 { if errno != 0 {
......
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