all: Remove "large blocks" config (#5763)

We now always use large / variable blocks.
This commit is contained in:
Jakob Borg 2019-06-06 16:57:38 +02:00 committed by Audrius Butkevicius
parent ca2fa8de4e
commit 997bb5e7e1
6 changed files with 19 additions and 31 deletions

View File

@ -78,7 +78,6 @@ angular.module('syncthing.core')
externalCommand: "",
autoNormalize: true,
path: "",
useLargeBlocks: true,
};
$scope.localStateTotal = {

View File

@ -155,8 +155,6 @@
<div class="col-md-6">
<input type="checkbox" ng-model="currentFolder.fsWatcherEnabled" ng-change="fsWatcherToggled()" tooltip data-original-title="{{'Use notifications from the filesystem to detect changed items.' | translate }}">&nbsp;<span translate>Watch for Changes</span>
<p translate class="help-block">Watching for changes discovers most changes without periodic scanning.</p>
<input type="checkbox" ng-model="currentFolder.useLargeBlocks"> <span translate>Variable Size Blocks</span>
<p translate class="help-block">Variable size blocks (also "large blocks") are more efficient for large files.</p>
</div>
<div class="col-md-6">
<label for="rescanIntervalS" translate>Full Rescan Interval (s)</label>

View File

@ -52,7 +52,6 @@ type FolderConfiguration struct {
Paused bool `xml:"paused" json:"paused"`
WeakHashThresholdPct int `xml:"weakHashThresholdPct" json:"weakHashThresholdPct"` // Use weak hash if more than X percent of the file has changed. Set to -1 to always use weak hash.
MarkerName string `xml:"markerName" json:"markerName"`
UseLargeBlocks bool `xml:"useLargeBlocks" json:"useLargeBlocks" default:"true"`
CopyOwnershipFromParent bool `xml:"copyOwnershipFromParent" json:"copyOwnershipFromParent"`
cachedFilesystem fs.Filesystem

View File

@ -349,7 +349,6 @@ func (f *folder) scanSubdirs(subDirs []string) error {
Hashers: f.model.numHashers(f.ID),
ShortID: f.shortID,
ProgressTickIntervalS: f.ScanProgressIntervalS,
UseLargeBlocks: f.UseLargeBlocks,
LocalFlags: f.localFlags,
})

View File

@ -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
}
}

View File

@ -467,14 +467,13 @@ func TestWalkReceiveOnly(t *testing.T) {
func walkDir(fs fs.Filesystem, dir string, cfiler CurrentFiler, matcher *ignore.Matcher, localFlags uint32) []protocol.FileInfo {
fchan := Walk(context.TODO(), Config{
Filesystem: fs,
Subs: []string{dir},
AutoNormalize: true,
Hashers: 2,
UseLargeBlocks: true,
CurrentFiler: cfiler,
Matcher: matcher,
LocalFlags: localFlags,
Filesystem: fs,
Subs: []string{dir},
AutoNormalize: true,
Hashers: 2,
CurrentFiler: cfiler,
Matcher: matcher,
LocalFlags: localFlags,
})
var tmp []protocol.FileInfo