aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys
diff options
context:
space:
mode:
Diffstat (limited to 'weed/filesys')
-rw-r--r--weed/filesys/file.go4
-rw-r--r--weed/filesys/wfs.go11
2 files changed, 5 insertions, 10 deletions
diff --git a/weed/filesys/file.go b/weed/filesys/file.go
index 48a024f20..8028d3912 100644
--- a/weed/filesys/file.go
+++ b/weed/filesys/file.go
@@ -72,8 +72,8 @@ func (file *File) Attr(ctx context.Context, attr *fuse.Attr) (err error) {
attr.Mtime = time.Unix(entry.Attributes.Mtime, 0)
attr.Gid = entry.Attributes.Gid
attr.Uid = entry.Attributes.Uid
- attr.Blocks = attr.Size/blockSize + 1
- attr.BlockSize = uint32(file.wfs.option.ChunkSizeLimit)
+ attr.BlockSize = blockSize
+ attr.Blocks = (attr.Size + blockSize - 1) / blockSize
if entry.HardLinkCounter > 0 {
attr.Nlink = uint32(entry.HardLinkCounter)
}
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 54eb9064b..6c91246c1 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -8,7 +8,6 @@ import (
"math/rand"
"os"
"path"
- "path/filepath"
"sync"
"time"
@@ -58,8 +57,7 @@ type Option struct {
Cipher bool // whether encrypt data on volume server
UidGidMapper *meta_cache.UidGidMapper
- uniqueCacheDir string
- uniqueCacheTempPageDir string
+ uniqueCacheDir string
}
var _ = fs.FS(&WFS{})
@@ -127,6 +125,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
})
grace.OnInterrupt(func() {
wfs.metaCache.Shutdown()
+ os.RemoveAll(option.getUniqueCacheDir())
})
wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs, id: 1}
@@ -303,13 +302,9 @@ func (wfs *WFS) getCurrentFiler() pb.ServerAddress {
func (option *Option) setupUniqueCacheDirectory() {
cacheUniqueId := util.Md5String([]byte(option.MountDirectory + string(option.FilerAddresses[0]) + option.FilerMountRootPath + util.Version()))[0:8]
option.uniqueCacheDir = path.Join(option.CacheDir, cacheUniqueId)
- option.uniqueCacheTempPageDir = filepath.Join(option.uniqueCacheDir, "sw")
- os.MkdirAll(option.uniqueCacheTempPageDir, os.FileMode(0777)&^option.Umask)
+ os.MkdirAll(option.uniqueCacheDir, os.FileMode(0777)&^option.Umask)
}
-func (option *Option) getTempFilePageDir() string {
- return option.uniqueCacheTempPageDir
-}
func (option *Option) getUniqueCacheDir() string {
return option.uniqueCacheDir
}