Skip to content

Commit

Permalink
Merge branch 'main' into backup-kv
Browse files Browse the repository at this point in the history
  • Loading branch information
davies authored Dec 13, 2024
2 parents 43f6c1e + 5677ffb commit 76a4daf
Show file tree
Hide file tree
Showing 38 changed files with 354 additions and 346 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Result: PASS
Aside from the POSIX features covered by pjdfstest, JuiceFS also provides:

- **Close-to-open consistency**. Once a file is written _and_ closed, it is guaranteed to view the written data in the following opens and reads from any client. Within the same mount point, all the written data can be read immediately.
- Rename and all other metadata operations are atomic, which are guaranteed by supported metadada engine transaction.
- Rename and all other metadata operations are atomic, which are guaranteed by supported metadata engine transaction.
- Opened files remain accessible after unlink from same mount point.
- Mmap (tested with FSx).
- Fallocate with punch hole support.
Expand Down
4 changes: 2 additions & 2 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func config(ctx *cli.Context) error {
}
if quota {
var totalSpace, availSpace, iused, iavail uint64
_ = m.StatFS(meta.Background, meta.RootInode, &totalSpace, &availSpace, &iused, &iavail)
_ = m.StatFS(meta.Background(), meta.RootInode, &totalSpace, &availSpace, &iused, &iavail)
usedSpace := totalSpace - availSpace
if format.Capacity > 0 && usedSpace >= format.Capacity ||
format.Inodes > 0 && iused >= format.Inodes {
Expand All @@ -297,7 +297,7 @@ func config(ctx *cli.Context) error {
}
if originDirStats && !format.DirStats {
qs := make(map[string]*meta.Quota)
err := m.HandleQuota(meta.Background, meta.QuotaList, "", qs, false, false, false)
err := m.HandleQuota(meta.Background(), meta.QuotaList, "", qs, false, false, false)
if err != nil {
return errors.Wrap(err, "list quotas")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func destroy(ctx *cli.Context) error {
logger.Fatalf("%d sessions are active, please disconnect them first:\n%s", num, printSessions(ss))
}
var totalSpace, availSpace, iused, iavail uint64
_ = m.StatFS(meta.Background, meta.RootInode, &totalSpace, &availSpace, &iused, &iavail)
_ = m.StatFS(meta.Background(), meta.RootInode, &totalSpace, &availSpace, &iused, &iavail)

fmt.Printf(" volume name: %s\n", format.Name)
fmt.Printf(" volume UUID: %s\n", format.UUID)
Expand Down
2 changes: 1 addition & 1 deletion cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func dump(ctx *cli.Context) error {
if _, err := m.Load(true); err != nil {
return err
}
if st := m.Chroot(meta.Background, metaConf.Subdir); st != 0 {
if st := m.Chroot(meta.Background(), metaConf.Subdir); st != 0 {
return st
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/fsck.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func fsck(ctx *cli.Context) error {
}
if _, err := blob.Head(objKey); err != nil {
if _, ok := brokens[inode]; !ok {
if ps := m.GetPaths(meta.Background, inode); len(ps) > 0 {
if ps := m.GetPaths(meta.Background(), inode); len(ps) > 0 {
brokens[inode] = ps[0]
} else {
brokens[inode] = fmt.Sprintf("inode:%d", inode)
Expand Down
2 changes: 1 addition & 1 deletion cmd/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func initForSvc(c *cli.Context, mp string, metaUrl, listenAddr string) (*vfs.Con
if err != nil {
logger.Fatalf("load setting: %s", err)
}
if st := metaCli.Chroot(meta.Background, metaConf.Subdir); st != 0 {
if st := metaCli.Chroot(meta.Background(), metaConf.Subdir); st != 0 {
logger.Fatalf("Chroot to %s: %s", metaConf.Subdir, st)
}
registerer, registry := wrapRegister(c, mp, format.Name)
Expand Down
2 changes: 1 addition & 1 deletion cmd/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func gc(ctx *cli.Context) error {
}
return err
})
if st := m.CompactAll(meta.Background, ctx.Int("threads"), bar); st == 0 {
if st := m.CompactAll(meta.Background(), ctx.Int("threads"), bar); st == 0 {
if progress.Quiet {
c, b := spin.Current()
logger.Infof("Compacted %d chunks (%d slices, %d bytes).", bar.Current(), c, b)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mdtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func initForMdtest(c *cli.Context, mp string, metaUrl string) *fs.FileSystem {
if err != nil {
logger.Fatalf("load setting: %s", err)
}
if st := m.Chroot(meta.Background, metaConf.Subdir); st != 0 {
if st := m.Chroot(meta.Background(), metaConf.Subdir); st != 0 {
logger.Fatalf("Chroot to %s: %s", metaConf.Subdir, st)
}
registerer, registry := wrapRegister(c, mp, format.Name)
Expand Down
2 changes: 1 addition & 1 deletion cmd/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ func mount(c *cli.Context) error {
vfsConf.StatePath = fmt.Sprintf("/tmp/state%d.json", os.Getppid())
}

if st := metaCli.Chroot(meta.Background, metaConf.Subdir); st != 0 {
if st := metaCli.Chroot(meta.Background(), metaConf.Subdir); st != 0 {
return st
}
// Wrap the default registry, all prometheus.MustRegister() calls should be afterwards
Expand Down
5 changes: 3 additions & 2 deletions cmd/quota.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package cmd

import (
"fmt"
"sort"

"github.com/dustin/go-humanize"
"github.com/juicedata/juicefs/pkg/meta"
"github.com/juicedata/juicefs/pkg/utils"
"sort"

"github.com/urfave/cli/v2"
)
Expand Down Expand Up @@ -147,7 +148,7 @@ func quota(c *cli.Context) error {
strict = c.Bool("strict")
repair = c.Bool("repair")
}
if err := m.HandleQuota(meta.Background, cmd, dpath, qs, strict, repair, c.Bool("create")); err != nil {
if err := m.HandleQuota(meta.Background(), cmd, dpath, qs, strict, repair, c.Bool("create")); err != nil {
return err
} else if len(qs) == 0 {
return nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func doRestore(m meta.Meta, hour string, putBack bool, threads int) {
}()
}
logger.Infof("restore files in %s ...", hour)
ctx := meta.Background
ctx := meta.Background()
var parent meta.Ino
var attr meta.Attr
err := m.Lookup(ctx, meta.TrashInode, hour, &parent, &attr, false)
Expand All @@ -75,7 +75,7 @@ func doRestore(m meta.Meta, hour string, putBack bool, threads int) {
return
}
var entries []*meta.Entry
err = m.Readdir(meta.Background, parent, 0, &entries)
err = m.Readdir(meta.Background(), parent, 0, &entries)
if err != 0 {
logger.Errorf("list %s: %s", hour, err)
return
Expand Down
2 changes: 1 addition & 1 deletion cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func status(ctx *cli.Context) error {

stat := &statistic{}
var totalSpace uint64
if err = m.StatFS(meta.Background, meta.RootInode, &totalSpace, &stat.AvailableSpace, &stat.UsedInodes, &stat.AvailableInodes); err != syscall.Errno(0) {
if err = m.StatFS(meta.Background(), meta.RootInode, &totalSpace, &stat.AvailableSpace, &stat.UsedInodes, &stat.AvailableInodes); err != syscall.Errno(0) {
logger.Fatalf("stat fs: %s", err)
}
stat.UsedSpace = totalSpace - stat.AvailableSpace
Expand Down
Loading

0 comments on commit 76a4daf

Please sign in to comment.