aboutsummaryrefslogtreecommitdiff
path: root/weed/mount/filehandle.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2022-04-17 20:59:31 -0700
committerGitHub <noreply@github.com>2022-04-17 20:59:31 -0700
commit61af76c3bb03bf40e3444c50724c8d5a1a2eafb4 (patch)
treee7bbc83368c814afa3d6c81c808738f91e32afd4 /weed/mount/filehandle.go
parentb597baf488fa4449d41ac2b78d421751f65f909e (diff)
parent89eb87c1d16640030927af242b34eba47a149427 (diff)
downloadseaweedfs-61af76c3bb03bf40e3444c50724c8d5a1a2eafb4.tar.xz
seaweedfs-61af76c3bb03bf40e3444c50724c8d5a1a2eafb4.zip
Merge pull request #2929 from leyou240/slices.SortFunc
enhancement: replace sort.Slice with slices.SortFunc to reduce reflection
Diffstat (limited to 'weed/mount/filehandle.go')
-rw-r--r--weed/mount/filehandle.go6
1 files changed, 3 insertions, 3 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))