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: "", externalCommand: "",
autoNormalize: true, autoNormalize: true,
path: "", path: "",
useLargeBlocks: true,
}; };
$scope.localStateTotal = { $scope.localStateTotal = {

View File

@ -155,8 +155,6 @@
<div class="col-md-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> <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> <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>
<div class="col-md-6"> <div class="col-md-6">
<label for="rescanIntervalS" translate>Full Rescan Interval (s)</label> <label for="rescanIntervalS" translate>Full Rescan Interval (s)</label>

View File

@ -52,7 +52,6 @@ type FolderConfiguration struct {
Paused bool `xml:"paused" json:"paused"` 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. 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"` MarkerName string `xml:"markerName" json:"markerName"`
UseLargeBlocks bool `xml:"useLargeBlocks" json:"useLargeBlocks" default:"true"`
CopyOwnershipFromParent bool `xml:"copyOwnershipFromParent" json:"copyOwnershipFromParent"` CopyOwnershipFromParent bool `xml:"copyOwnershipFromParent" json:"copyOwnershipFromParent"`
cachedFilesystem fs.Filesystem cachedFilesystem fs.Filesystem

View File

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

View File

@ -52,8 +52,6 @@ type Config struct {
// Optional progress tick interval which defines how often FolderScanProgress // Optional progress tick interval which defines how often FolderScanProgress
// events are emitted. Negative number means disabled. // events are emitted. Negative number means disabled.
ProgressTickIntervalS int 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 // Local flags to set on scanned files
LocalFlags uint32 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 { func (w *walker) walkRegular(ctx context.Context, relPath string, info fs.FileInfo, toHashChan chan<- protocol.FileInfo) error {
curFile, hasCurFile := w.CurrentFiler.CurrentFile(relPath) curFile, hasCurFile := w.CurrentFiler.CurrentFile(relPath)
blockSize := protocol.MinBlockSize blockSize := protocol.BlockSize(info.Size())
if w.UseLargeBlocks { if hasCurFile {
blockSize = protocol.BlockSize(info.Size()) // Check if we should retain current block size.
curBlockSize := curFile.BlockSize()
if hasCurFile { if blockSize > curBlockSize && blockSize/curBlockSize <= 2 {
// Check if we should retain current block size. // New block size is larger, but not more than twice larger.
curBlockSize := curFile.BlockSize() // Retain.
if blockSize > curBlockSize && blockSize/curBlockSize <= 2 { blockSize = curBlockSize
// New block size is larger, but not more than twice larger. } else if curBlockSize > blockSize && curBlockSize/blockSize <= 2 {
// Retain. // Old block size is larger, but not more than twice larger.
blockSize = curBlockSize // Retain.
} else if curBlockSize > blockSize && curBlockSize/blockSize <= 2 { blockSize = curBlockSize
// 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 { func walkDir(fs fs.Filesystem, dir string, cfiler CurrentFiler, matcher *ignore.Matcher, localFlags uint32) []protocol.FileInfo {
fchan := Walk(context.TODO(), Config{ fchan := Walk(context.TODO(), Config{
Filesystem: fs, Filesystem: fs,
Subs: []string{dir}, Subs: []string{dir},
AutoNormalize: true, AutoNormalize: true,
Hashers: 2, Hashers: 2,
UseLargeBlocks: true, CurrentFiler: cfiler,
CurrentFiler: cfiler, Matcher: matcher,
Matcher: matcher, LocalFlags: localFlags,
LocalFlags: localFlags,
}) })
var tmp []protocol.FileInfo var tmp []protocol.FileInfo