diff --git a/cmd/fsck.go b/cmd/fsck.go index aed50d35e8a5..cdb900e7f6b3 100644 --- a/cmd/fsck.go +++ b/cmd/fsck.go @@ -20,9 +20,7 @@ import ( "fmt" "sort" "strings" - "time" - "github.com/juicedata/juicefs/pkg/chunk" "github.com/juicedata/juicefs/pkg/meta" "github.com/juicedata/juicefs/pkg/object" osync "github.com/juicedata/juicefs/pkg/sync" @@ -91,15 +89,8 @@ func fsck(ctx *cli.Context) error { return m.Check(c, p, ctx.Bool("repair"), ctx.Bool("recursive"), ctx.Bool("sync-dir-stat")) } - chunkConf := chunk.Config{ - BlockSize: format.BlockSize * 1024, - Compress: format.Compression, - GetTimeout: time.Second * 60, - PutTimeout: time.Second * 60, - MaxUpload: 20, - BufferSize: 300 << 20, - CacheDir: "memory", - } + chunkConf := *getDefaultChunkConf(format) + chunkConf.CacheDir = "memory" blob, err := createStorage(*format) if err != nil { diff --git a/cmd/gc.go b/cmd/gc.go index 30e7d9740f88..df7114dcec69 100644 --- a/cmd/gc.go +++ b/cmd/gc.go @@ -84,15 +84,8 @@ func gc(ctx *cli.Context) error { logger.Fatalf("load setting: %s", err) } - chunkConf := chunk.Config{ - BlockSize: format.BlockSize * 1024, - Compress: format.Compression, - GetTimeout: time.Second * 60, - PutTimeout: time.Second * 60, - MaxUpload: 20, - BufferSize: 300 << 20, - CacheDir: "memory", - } + chunkConf := *getDefaultChunkConf(format) + chunkConf.CacheDir = "memory" blob, err := createStorage(*format) if err != nil { diff --git a/cmd/gc_test.go b/cmd/gc_test.go index 83c2c7412a93..7c8990de9046 100644 --- a/cmd/gc_test.go +++ b/cmd/gc_test.go @@ -68,7 +68,7 @@ func getFileCount(dir string) int { func TestGc(t *testing.T) { var bucket string - mountTemp(t, &bucket, []string{"--trash-days=0"}, nil) + mountTemp(t, &bucket, []string{"--trash-days=0", "--hash-prefix"}, nil) defer umountTemp(t) if err := writeSmallBlocks(testMountPoint); err != nil {