diff options
author | Jakob Unterwurzacher | 2017-05-01 21:57:18 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2017-05-01 21:57:18 +0200 |
commit | fb3cc6ea407b83e4e1acf4e1a80e3b7d09c5b1db (patch) | |
tree | 9a766eed46d7d27f8681193b22e9b42939d7fbfe /internal/fusefrontend/file_allocate_truncate.go | |
parent | f322ee87e31a6ceb04c25fa62dcde4df6e45f92a (diff) |
openfiletable: rename WriteLock to ContentLock
...and IDLock to HeaderLock. This matches what the locks actually
protect.
Diffstat (limited to 'internal/fusefrontend/file_allocate_truncate.go')
-rw-r--r-- | internal/fusefrontend/file_allocate_truncate.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/fusefrontend/file_allocate_truncate.go b/internal/fusefrontend/file_allocate_truncate.go index acde76f..85ed11c 100644 --- a/internal/fusefrontend/file_allocate_truncate.go +++ b/internal/fusefrontend/file_allocate_truncate.go @@ -50,8 +50,8 @@ func (f *file) Allocate(off uint64, sz uint64, mode uint32) fuse.Status { if f.released { return fuse.EBADF } - f.fileTableEntry.WriteLock.Lock() - defer f.fileTableEntry.WriteLock.Unlock() + f.fileTableEntry.ContentLock.Lock() + defer f.fileTableEntry.ContentLock.Unlock() blocks := f.contentEnc.ExplodePlainRange(off, sz) firstBlock := blocks[0] @@ -100,8 +100,8 @@ func (f *file) Truncate(newSize uint64) fuse.Status { tlog.Warn.Printf("ino%d fh%d: Truncate on released file", f.qIno.Ino, f.intFd()) return fuse.EBADF } - f.fileTableEntry.WriteLock.Lock() - defer f.fileTableEntry.WriteLock.Unlock() + f.fileTableEntry.ContentLock.Lock() + defer f.fileTableEntry.ContentLock.Unlock() var err error // Common case first: Truncate to zero if newSize == 0 { @@ -111,9 +111,9 @@ func (f *file) Truncate(newSize uint64) fuse.Status { return fuse.ToStatus(err) } // Truncate to zero kills the file header - f.fileTableEntry.IDLock.Lock() + f.fileTableEntry.HeaderLock.Lock() f.fileTableEntry.ID = nil - f.fileTableEntry.IDLock.Unlock() + f.fileTableEntry.HeaderLock.Unlock() return fuse.OK } // We need the old file size to determine if we are growing or shrinking @@ -206,8 +206,8 @@ func (f *file) truncateGrowFile(oldPlainSz uint64, newPlainSz uint64) fuse.Statu if newPlainSz%f.contentEnc.PlainBS() == 0 { // The file was empty, so it did not have a header. Create one. if oldPlainSz == 0 { - f.fileTableEntry.IDLock.Lock() - defer f.fileTableEntry.IDLock.Unlock() + f.fileTableEntry.HeaderLock.Lock() + defer f.fileTableEntry.HeaderLock.Unlock() id, err := f.createHeader() if err != nil { return fuse.ToStatus(err) |