From 21a8aea19da35d35d0b624743e6b067da8ea1df3 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 4 Jun 2023 11:23:22 +0300 Subject: [PATCH] Remove goofys-fuse StatFS dependency from cluster code (add some copy-paste!) --- internal/cluster_fs_fuse.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/internal/cluster_fs_fuse.go b/internal/cluster_fs_fuse.go index 1aef662e..3807b0be 100644 --- a/internal/cluster_fs_fuse.go +++ b/internal/cluster_fs_fuse.go @@ -5,6 +5,7 @@ import ( iofs "io/fs" "fmt" "syscall" + "sync/atomic" "github.com/yandex-cloud/geesefs/api/common" "github.com/jacobsa/fuse" @@ -24,7 +25,21 @@ type ClusterFsFuse struct { // fs func (fs *ClusterFsFuse) StatFS(ctx context.Context, op *fuseops.StatFSOp) error { - return fs.Goofys.StatFS(ctx, op) + atomic.AddInt64(&fs.Goofys.stats.metadataReads, 1) + + const BLOCK_SIZE = 4096 + const TOTAL_SPACE = 1 * 1024 * 1024 * 1024 * 1024 * 1024 // 1PB + const TOTAL_BLOCKS = TOTAL_SPACE / BLOCK_SIZE + const INODES = 1 * 1000 * 1000 * 1000 // 1 billion + op.BlockSize = BLOCK_SIZE + op.Blocks = TOTAL_BLOCKS + op.BlocksFree = TOTAL_BLOCKS + op.BlocksAvailable = TOTAL_BLOCKS + op.IoSize = 1 * 1024 * 1024 // 1MB + op.Inodes = INODES + op.InodesFree = INODES + + return nil } // file