From 4c0cb37c50c66b03be43063d77a52b74f24ec9f7 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 29 May 2016 13:46:47 +0200 Subject: [PATCH] fusefrontend: remove unused "forgotten" variable The functionality has long been replaced by the fd < 0 check. --- internal/fusefrontend/file.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go index ac00b1d..ce806b6 100644 --- a/internal/fusefrontend/file.go +++ b/internal/fusefrontend/file.go @@ -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)