fusefrontend: remove unused "forgotten" variable

The functionality has long been replaced by the fd < 0
check.
This commit is contained in:
Jakob Unterwurzacher 2016-05-29 13:46:47 +02:00
parent b5ae3dcc4e
commit 4c0cb37c50
1 changed files with 1 additions and 7 deletions

View File

@ -39,8 +39,6 @@ type file struct {
// File header
header *contentenc.FileHeader
forgotten bool
}
func NewFile(fd *os.File, writeOnly bool, contentEnc *contentenc.ContentEnc) nodefs.File {
@ -310,7 +308,6 @@ func (f *file) Release() {
f.fdLock.Unlock()
wlock.unregister(f.ino)
f.forgotten = true
}
// Flush - FUSE call
@ -343,15 +340,12 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
defer f.fdLock.RUnlock()
if f.fd.Fd() < 0 {
// The file descriptor has been closed concurrently.
toggledlog.Warn.Printf("ino%d fh%d: Truncate on forgotten file", f.ino, f.intFd())
return fuse.EBADF
}
wlock.lock(f.ino)
defer wlock.unlock(f.ino)
if f.forgotten {
toggledlog.Warn.Printf("ino%d fh%d: Truncate on forgotten file", f.ino, f.intFd())
}
// Common case first: Truncate to zero
if newSize == 0 {
err := syscall.Ftruncate(int(f.fd.Fd()), 0)