diff options
Diffstat (limited to 'weed/mount')
| -rw-r--r-- | weed/mount/filehandle.go | 6 | ||||
| -rw-r--r-- | weed/mount/weedfs_attr.go | 9 |
2 files changed, 7 insertions, 8 deletions
diff --git a/weed/mount/filehandle.go b/weed/mount/filehandle.go index 86fbabfa7..8ce31a078 100644 --- a/weed/mount/filehandle.go +++ b/weed/mount/filehandle.go @@ -5,8 +5,8 @@ import ( "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/util" + "golang.org/x/exp/slices" "io" - "sort" "sync" ) @@ -76,8 +76,8 @@ func (fh *FileHandle) addChunks(chunks []*filer_pb.FileChunk) { } // sort incoming chunks - sort.Slice(chunks, func(i, j int) bool { - return lessThan(chunks[i], chunks[j]) + slices.SortFunc(chunks, func(a, b *filer_pb.FileChunk) bool { + return lessThan(a, b) }) glog.V(4).Infof("%s existing %d chunks adds %d more", fh.FullPath(), len(fh.entry.Chunks), len(chunks)) diff --git a/weed/mount/weedfs_attr.go b/weed/mount/weedfs_attr.go index 55a29542a..cb935d0e4 100644 --- a/weed/mount/weedfs_attr.go +++ b/weed/mount/weedfs_attr.go @@ -98,15 +98,14 @@ func (wfs *WFS) SetAttr(cancel <-chan struct{}, input *fuse.SetAttrIn, out *fuse } } - if mtime, ok := input.GetMTime(); ok { - entry.Attributes.Mtime = mtime.Unix() - } - if atime, ok := input.GetATime(); ok { entry.Attributes.Mtime = atime.Unix() } - entry.Attributes.Mtime = time.Now().Unix() + if mtime, ok := input.GetMTime(); ok { + entry.Attributes.Mtime = mtime.Unix() + } + out.AttrValid = 1 wfs.setAttrByPbEntry(&out.Attr, input.NodeId, entry) |
