Skip to content

Commit

Permalink
Make juicefs block size configurable (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-lombardi authored May 22, 2024
1 parent 702f5f3 commit 6ececc8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/common/config.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ storage:
awsS3Bucket: http://localstack.beta9:4566/juicefs
awsAccessKey: test
awsSecretKey: test
blockSize: 4096
cacheSize: 0
gateway:
host: beta9-gateway.beta9
externalURL: http://localhost:1994
Expand Down
6 changes: 6 additions & 0 deletions pkg/storage/juicefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,17 @@ func (s *JuiceFsStorage) Mount(localPath string) error {
}

func (s *JuiceFsStorage) Format(fsName string) error {
blockSize := strconv.FormatInt(s.config.BlockSize, 10)
if s.config.BlockSize <= 0 {
blockSize = "4096"
}

cmd := exec.Command(
"juicefs",
"format",
"--storage", "s3",
"--bucket", s.config.AWSS3Bucket,
"--block-size", blockSize,
s.config.RedisURI,
fsName,
"--no-update",
Expand Down
1 change: 1 addition & 0 deletions pkg/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ type JuiceFSConfig struct {
AWSAccessKey string `key:"awsAccessKey" json:"aws_access_key"`
AWSSecretKey string `key:"awsSecretKey" json:"aws_secret_key"`
CacheSize int64 `key:"cacheSize" json:"cache_size"`
BlockSize int64 `key:"blockSize" json:"block_size"`
}

type MountPointConfig struct {
Expand Down

0 comments on commit 6ececc8

Please sign in to comment.