all: Remove "large blocks" config (#5763)
We now always use large / variable blocks.
This commit is contained in:
committed by
Audrius Butkevicius
parent
ca2fa8de4e
commit
997bb5e7e1
@@ -52,8 +52,6 @@ type Config struct {
|
||||
// Optional progress tick interval which defines how often FolderScanProgress
|
||||
// events are emitted. Negative number means disabled.
|
||||
ProgressTickIntervalS int
|
||||
// Whether to use large blocks for large files or the old standard of 128KiB for everything.
|
||||
UseLargeBlocks bool
|
||||
// Local flags to set on scanned files
|
||||
LocalFlags uint32
|
||||
}
|
||||
@@ -326,23 +324,19 @@ func (w *walker) handleItem(ctx context.Context, path string, toHashChan chan<-
|
||||
func (w *walker) walkRegular(ctx context.Context, relPath string, info fs.FileInfo, toHashChan chan<- protocol.FileInfo) error {
|
||||
curFile, hasCurFile := w.CurrentFiler.CurrentFile(relPath)
|
||||
|
||||
blockSize := protocol.MinBlockSize
|
||||
blockSize := protocol.BlockSize(info.Size())
|
||||
|
||||
if w.UseLargeBlocks {
|
||||
blockSize = protocol.BlockSize(info.Size())
|
||||
|
||||
if hasCurFile {
|
||||
// Check if we should retain current block size.
|
||||
curBlockSize := curFile.BlockSize()
|
||||
if blockSize > curBlockSize && blockSize/curBlockSize <= 2 {
|
||||
// New block size is larger, but not more than twice larger.
|
||||
// Retain.
|
||||
blockSize = curBlockSize
|
||||
} else if curBlockSize > blockSize && curBlockSize/blockSize <= 2 {
|
||||
// Old block size is larger, but not more than twice larger.
|
||||
// Retain.
|
||||
blockSize = curBlockSize
|
||||
}
|
||||
if hasCurFile {
|
||||
// Check if we should retain current block size.
|
||||
curBlockSize := curFile.BlockSize()
|
||||
if blockSize > curBlockSize && blockSize/curBlockSize <= 2 {
|
||||
// New block size is larger, but not more than twice larger.
|
||||
// Retain.
|
||||
blockSize = curBlockSize
|
||||
} else if curBlockSize > blockSize && curBlockSize/blockSize <= 2 {
|
||||
// Old block size is larger, but not more than twice larger.
|
||||
// Retain.
|
||||
blockSize = curBlockSize
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user