SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
refactor
Chris Lu93e84a12f25e
diff --git a/weed/filesys/dirty_page.go b/weed/filesys/dirty_page.goindex 1719d68e64..0332629adc 100644--- a/weed/filesys/dirty_page.go+++ b/weed/filesys/dirty_page.go@@ -2,6 +2,7 @@ package filesysimport ("bytes"+ "fmt""io""sync""time"@@ -58,6 +59,16 @@ func (pages *ContinuousDirtyPages) flushAndSave(offset int64, data []byte) {return}+func (pages *ContinuousDirtyPages) FlushData() error {++ pages.saveExistingPagesToStorage()+ pages.writeWaitGroup.Wait()+ if pages.lastErr != nil {+ return fmt.Errorf("flush data: %v", pages.lastErr)+ }+ return nil+}+func (pages *ContinuousDirtyPages) saveExistingPagesToStorage() {for pages.saveExistingLargestPageToStorage() {}diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.goindex 8cbaf6fd24..e66e340b3f 100644--- a/weed/filesys/filehandle.go+++ b/weed/filesys/filehandle.go@@ -239,12 +239,8 @@ func (fh *FileHandle) doFlush(ctx context.Context, header fuse.Header) error {// send the data to the OSglog.V(4).Infof("doFlush %s fh %d", fh.f.fullpath(), fh.handle)- fh.dirtyPages.saveExistingPagesToStorage()-- fh.dirtyPages.writeWaitGroup.Wait()-- if fh.dirtyPages.lastErr != nil {- glog.Errorf("%v doFlush last err: %v", fh.f.fullpath(), fh.dirtyPages.lastErr)+ if err := fh.dirtyPages.FlushData(); err != nil {+ glog.Errorf("%v doFlush: %v", fh.f.fullpath(), err)return fuse.EIO}