Skip to content

Commit 997bb5e

Browse files
calmhAudriusButkevicius
authored andcommitted
all: Remove "large blocks" config (syncthing#5763)
We now always use large / variable blocks.
1 parent ca2fa8d commit 997bb5e

File tree

6 files changed

+20
-32
lines changed

6 files changed

+20
-32
lines changed

gui/default/syncthing/core/syncthingController.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ angular.module('syncthing.core')
7878
externalCommand: "",
7979
autoNormalize: true,
8080
path: "",
81-
useLargeBlocks: true,
8281
};
8382

8483
$scope.localStateTotal = {

gui/default/syncthing/folder/editFolderModalView.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@
155155
<div class="col-md-6">
156156
<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>
157157
<p translate class="help-block">Watching for changes discovers most changes without periodic scanning.</p>
158-
<input type="checkbox" ng-model="currentFolder.useLargeBlocks"> <span translate>Variable Size Blocks</span>
159-
<p translate class="help-block">Variable size blocks (also "large blocks") are more efficient for large files.</p>
160158
</div>
161159
<div class="col-md-6">
162160
<label for="rescanIntervalS" translate>Full Rescan Interval (s)</label>

lib/config/folderconfiguration.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ type FolderConfiguration struct {
5252
Paused bool `xml:"paused" json:"paused"`
5353
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.
5454
MarkerName string `xml:"markerName" json:"markerName"`
55-
UseLargeBlocks bool `xml:"useLargeBlocks" json:"useLargeBlocks" default:"true"`
5655
CopyOwnershipFromParent bool `xml:"copyOwnershipFromParent" json:"copyOwnershipFromParent"`
5756

5857
cachedFilesystem fs.Filesystem

lib/model/folder.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ func (f *folder) scanSubdirs(subDirs []string) error {
349349
Hashers: f.model.numHashers(f.ID),
350350
ShortID: f.shortID,
351351
ProgressTickIntervalS: f.ScanProgressIntervalS,
352-
UseLargeBlocks: f.UseLargeBlocks,
353352
LocalFlags: f.localFlags,
354353
})
355354

lib/scanner/walk.go

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ type Config struct {
5252
// Optional progress tick interval which defines how often FolderScanProgress
5353
// events are emitted. Negative number means disabled.
5454
ProgressTickIntervalS int
55-
// Whether to use large blocks for large files or the old standard of 128KiB for everything.
56-
UseLargeBlocks bool
5755
// Local flags to set on scanned files
5856
LocalFlags uint32
5957
}
@@ -326,23 +324,19 @@ func (w *walker) handleItem(ctx context.Context, path string, toHashChan chan<-
326324
func (w *walker) walkRegular(ctx context.Context, relPath string, info fs.FileInfo, toHashChan chan<- protocol.FileInfo) error {
327325
curFile, hasCurFile := w.CurrentFiler.CurrentFile(relPath)
328326

329-
blockSize := protocol.MinBlockSize
330-
331-
if w.UseLargeBlocks {
332-
blockSize = protocol.BlockSize(info.Size())
333-
334-
if hasCurFile {
335-
// Check if we should retain current block size.
336-
curBlockSize := curFile.BlockSize()
337-
if blockSize > curBlockSize && blockSize/curBlockSize <= 2 {
338-
// New block size is larger, but not more than twice larger.
339-
// Retain.
340-
blockSize = curBlockSize
341-
} else if curBlockSize > blockSize && curBlockSize/blockSize <= 2 {
342-
// Old block size is larger, but not more than twice larger.
343-
// Retain.
344-
blockSize = curBlockSize
345-
}
327+
blockSize := protocol.BlockSize(info.Size())
328+
329+
if hasCurFile {
330+
// Check if we should retain current block size.
331+
curBlockSize := curFile.BlockSize()
332+
if blockSize > curBlockSize && blockSize/curBlockSize <= 2 {
333+
// New block size is larger, but not more than twice larger.
334+
// Retain.
335+
blockSize = curBlockSize
336+
} else if curBlockSize > blockSize && curBlockSize/blockSize <= 2 {
337+
// Old block size is larger, but not more than twice larger.
338+
// Retain.
339+
blockSize = curBlockSize
346340
}
347341
}
348342

lib/scanner/walk_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -467,14 +467,13 @@ func TestWalkReceiveOnly(t *testing.T) {
467467

468468
func walkDir(fs fs.Filesystem, dir string, cfiler CurrentFiler, matcher *ignore.Matcher, localFlags uint32) []protocol.FileInfo {
469469
fchan := Walk(context.TODO(), Config{
470-
Filesystem: fs,
471-
Subs: []string{dir},
472-
AutoNormalize: true,
473-
Hashers: 2,
474-
UseLargeBlocks: true,
475-
CurrentFiler: cfiler,
476-
Matcher: matcher,
477-
LocalFlags: localFlags,
470+
Filesystem: fs,
471+
Subs: []string{dir},
472+
AutoNormalize: true,
473+
Hashers: 2,
474+
CurrentFiler: cfiler,
475+
Matcher: matcher,
476+
LocalFlags: localFlags,
478477
})
479478

480479
var tmp []protocol.FileInfo

0 commit comments

Comments
 (0)