Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mount: change readahead unit to block #5704

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ func addCategory(f cli.Flag, cat string) {
ff.Category = cat
case *cli.IntFlag:
ff.Category = cat
case *cli.UintFlag:
ff.Category = cat
case *cli.Int64Flag:
ff.Category = cat
case *cli.Uint64Flag:
Expand Down Expand Up @@ -177,9 +179,10 @@ func dataCacheFlags() []cli.Flag {
Value: "300M",
Usage: "total read/write buffering in MiB",
},
&cli.StringFlag{
Name: "max-readahead",
Usage: "max buffering for read ahead in MiB per read session",
&cli.UintFlag{
Name: "max-readahead-blocks",
Value: 8,
Usage: "max buffering blocks for read ahead per read session",
},
&cli.IntFlag{
Name: "prefetch",
Expand Down
2 changes: 1 addition & 1 deletion cmd/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func getChunkConf(c *cli.Context, format *meta.Format) *chunk.Config {
Writeback: c.Bool("writeback"),
Prefetch: c.Int("prefetch"),
BufferSize: utils.ParseBytes(c, "buffer-size", 'M'),
Readahead: int(utils.ParseBytes(c, "max-readahead", 'M')),
Readahead: int(c.Uint("max-readahead-blocks")) * format.BlockSize * 1024,
UploadLimit: utils.ParseMbps(c, "upload-limit") * 1e6 / 8,
DownloadLimit: utils.ParseMbps(c, "download-limit") * 1e6 / 8,
UploadDelay: utils.Duration(c.String("upload-delay")),
Expand Down
5 changes: 1 addition & 4 deletions pkg/vfs/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -704,13 +704,10 @@ type dataReader struct {

func NewDataReader(conf *Config, m meta.Meta, store chunk.ChunkStore) DataReader {
var readAheadTotal = 256 << 20
var readAheadMax = conf.Chunk.BlockSize * 8
if conf.Chunk.BufferSize > 0 {
readAheadTotal = int(conf.Chunk.BufferSize / 10 * 8) // 80% of total buffer
}
if conf.Chunk.Readahead > 0 {
readAheadMax = utils.Min(conf.Chunk.Readahead, readAheadTotal)
}
readAheadMax := utils.Min(conf.Chunk.Readahead, readAheadTotal)
r := &dataReader{
m: m,
store: store,
Expand Down
Loading