Skip to content

Commit

Permalink
Activate the flusher on every write
Browse files Browse the repository at this point in the history
There's still room for optimisations: now flusher scans all inodes
and tries to flush any of them and it wastes a lot of time scanning.
A queue of "ready to flush" items could be much better.
  • Loading branch information
vitalif committed Sep 6, 2021
1 parent 955db05 commit 137c003
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/file.go
Expand Up @@ -374,9 +374,9 @@ func (fh *FileHandle) WriteFile(offset int64, data []byte, copyData bool) (err e
fh.inode.lastWriteEnd = end
if fh.inode.CacheState == ST_CACHED {
fh.inode.SetCacheState(ST_MODIFIED)
// FIXME: Don't activate the flusher immediately for small writes
fh.inode.fs.WakeupFlusher()
}
// FIXME: Don't activate the flusher immediately for small writes
fh.inode.fs.WakeupFlusher()
fh.inode.Attributes.Mtime = time.Now()

fh.inode.mu.Unlock()
Expand Down
4 changes: 4 additions & 0 deletions internal/goofys.go
Expand Up @@ -469,6 +469,10 @@ func (fs *Goofys) WakeupFlusher() {
// 3) Fsync triggered => intermediate full flush (same algorithm)
// 4) Dirty memory limit reached => without on-disk cache we have to flush the whole object.
// With on-disk cache we can unload some dirty buffers to disk.
//
// FIXME There's still room for optimisations: now flusher scans all inodes
// and tries to flush any of them and it wastes a lot of time scanning.
// A queue of "ready to flush" items could be much better.
func (fs *Goofys) Flusher() {
var inodes []fuseops.InodeID
again := false
Expand Down

0 comments on commit 137c003

Please sign in to comment.