aboutsummaryrefslogtreecommitdiff
path: root/weed/filer/filechunks.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2023-01-06 01:03:29 -0800
committerchrislu <chris.lu@gmail.com>2023-01-06 01:03:29 -0800
commit296fdc296c8bd672d86c9aef19e9f568dab1b8a0 (patch)
tree259a6be7e3c958cbe057a14c4e0226a11ccfd452 /weed/filer/filechunks.go
parent49b84d5866db9da6fb99526a1f2230b8071e6ef6 (diff)
downloadseaweedfs-296fdc296c8bd672d86c9aef19e9f568dab1b8a0.tar.xz
seaweedfs-296fdc296c8bd672d86c9aef19e9f568dab1b8a0.zip
mount: faster add chunks
Diffstat (limited to 'weed/filer/filechunks.go')
-rw-r--r--weed/filer/filechunks.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/weed/filer/filechunks.go b/weed/filer/filechunks.go
index d872bd22d..480478fd7 100644
--- a/weed/filer/filechunks.go
+++ b/weed/filer/filechunks.go
@@ -86,6 +86,17 @@ func SeparateGarbageChunks(visibles *IntervalList[*VisibleInterval], chunks []*f
return compacted, garbage
}
+func FindGarbageChunks(visibles *IntervalList[*VisibleInterval], start int64, stop int64) (garbageFileId []string) {
+ for x := visibles.Front(); x != nil; x = x.Next {
+ interval := x.Value
+ offset := interval.start - interval.offsetInChunk
+ if start <= offset && offset+int64(interval.chunkSize) <= stop {
+ garbageFileId = append(garbageFileId, interval.fileId)
+ }
+ }
+ return
+}
+
func MinusChunks(lookupFileIdFn wdclient.LookupFileIdFunctionType, as, bs []*filer_pb.FileChunk) (delta []*filer_pb.FileChunk, err error) {
aData, aMeta, aErr := ResolveChunkManifest(lookupFileIdFn, as, 0, math.MaxInt64)