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

Main rfs #2079

Merged
merged 5 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 4 additions & 1 deletion pkg/flist/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (f *flistModule) cleanUnusedMounts() error {

roTargets := make(map[int64]mountInfo)
for _, mount := range all.filter(withParentDir(f.ro)) {
if mount.FSType != fsTypeG8ufs {
if mount.FSType != fsTypeG8ufs && mount.FSType != fsTypeRfs {
// this mount type should not be under ro
// where all mounts are g8ufs.
continue
Expand All @@ -99,6 +99,9 @@ func (f *flistModule) cleanUnusedMounts() error {
case fsTypeG8ufs:
// this is a bind mount
info = mount.AsG8ufs()
case fsTypeRfs:
// this is a bind mount
info = mount.AsG8ufs()
case fsTypeOverlay:
// this is an overly mount, so g8ufs lives as a lower layer
// we get this from the list of mounts.
Expand Down
30 changes: 19 additions & 11 deletions pkg/flist/flist.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,25 +207,33 @@ func (f *flistModule) mountRO(url, storage string) (string, error) {
}

logPath := filepath.Join(f.log, hash) + ".log"
var args []string

args = append(args,
flistExt := filepath.Ext(url)
args := []string{
"--cache", f.cache,
"--meta", flistPath,
"--storage-url", storage,
"--daemon",
"--log", logPath,
// this is always read-only
"--ro",
mountpoint,
)
}

sublog.Info().Strs("args", args).Msg("starting 0-fs daemon")
cmd := f.commander.Command("g8ufs", args...)
var cmd *exec.Cmd
if flistExt == ".flist" {
sublog.Info().Strs("args", args).Msg("starting g8ufs daemon")
args = append(args,
"--storage-url", storage,
// this is always read-only
"--ro",
mountpoint,
)
cmd = f.commander.Command("g8ufs", args...)
} else if flistExt == ".fl" {
sublog.Info().Strs("args", args).Msg("starting rfs daemon")
args = append([]string{"mount"}, append(args, mountpoint)...)
cmd = f.commander.Command("rfs", args...)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add an else case here so we return an error if the url extension is unknown


var out []byte
if out, err = cmd.CombinedOutput(); err != nil {
sublog.Err(err).Str("out", string(out)).Msg("fail to start 0-fs daemon")
sublog.Err(err).Str("out", string(out)).Msg("failed to start 0-fs daemon")
return "", err
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/flist/mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
)

const (
fsTypeRfs = "fuse.rfs"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not correct, this require a change to rfs actually because it still identity itself as g8ufs (that's something that is hard coded in the code) of course we can change that in rfs itself but I don't see why would we do that right now.

the idea was to be able to tell rfs from overlay so as long as we can do that it's fine. so in other words there should be no difference in reading the rfs from g8ufs since they both use the pid as source mount

fsTypeG8ufs = "fuse.g8ufs"
fsTypeOverlay = "overlay"
)
Expand Down Expand Up @@ -116,7 +117,7 @@ func (f *flistModule) resolve(path string) (g8ufsInfo, error) {
return g8ufsInfo{}, err
}

if info.FSType == fsTypeG8ufs {
if info.FSType == fsTypeG8ufs || info.FSType == fsTypeRfs {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means this is not deeded since both are defined as fuse.g8ufs

return info.AsG8ufs(), nil
} else if info.FSType == fsTypeOverlay {
overlay := info.AsOverlay()
Expand Down
Loading