From 55e060cf619d07f47c0fa1f6e7bf74f94130edec Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 9 May 2021 15:28:54 -0700 Subject: [PATCH] refactor --- weed/filesys/dirty_page.go | 4 ++++ weed/filesys/filehandle.go | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/weed/filesys/dirty_page.go b/weed/filesys/dirty_page.go index ab191a07a..25f1d31c2 100644 --- a/weed/filesys/dirty_page.go +++ b/weed/filesys/dirty_page.go @@ -144,3 +144,7 @@ func min(x, y int64) int64 { func (pages *ContinuousDirtyPages) ReadDirtyDataAt(data []byte, startOffset int64) (maxStop int64) { return pages.intervals.ReadDataAt(data, startOffset) } + +func (pages *ContinuousDirtyPages) GetStorageOptions() (collection, replication string) { + return pages.collection, pages.replication +} diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go index 3e0567dee..3ccd996ae 100644 --- a/weed/filesys/filehandle.go +++ b/weed/filesys/filehandle.go @@ -267,8 +267,7 @@ func (fh *FileHandle) doFlush(ctx context.Context, header fuse.Header) error { } entry.Attributes.Mtime = time.Now().Unix() entry.Attributes.FileMode = uint32(os.FileMode(entry.Attributes.FileMode) &^ fh.f.wfs.option.Umask) - entry.Attributes.Collection = fh.dirtyPages.collection - entry.Attributes.Replication = fh.dirtyPages.replication + entry.Attributes.Collection, entry.Attributes.Replication = fh.dirtyPages.GetStorageOptions() } request := &filer_pb.CreateEntryRequest{