Alexander Neumann
200f09522d
Add more error checks
2021-01-30 20:02:37 +01:00
Alexander Neumann
82ae942965
backup: Keep mountpoints for --one-file-system
...
When a file system is mounted at a directory, lstat() returns attributes
of the root node of the mounted file system, including the device ID of
the other file system. The previous code used when --one-file-system is
specified excluded the directory itself because of that.
This commit changes the code so that mountpoints are kept as empty
directories, its attributes set to the root note of the mounted file
system. The behavior mimics `tar`, which does the same.
2020-11-28 17:00:31 +01:00
Alexander Neumann
037f0a4c91
Refactor device ID checking
2020-11-28 17:00:31 +01:00
Alexander Neumann
21ba15577e
Return an error for invalid sizes
2020-11-03 11:53:49 +01:00
Michael Eischer
bcc3bddcf4
filter: only check whether a child path could match when necessary
...
When checking excludes there is no need to test whether a child path
could also match the pattern, as it is by definition excluded.
Previously childMayMatch was calculated but then discarded. For simple
absolute paths this can account for half the time spent for checking
pattern matches.
name old time/op new time/op delta
FilterPatterns/Relative-4 23.3ms ± 9% 21.7ms ± 6% -6.68% (p=0.004 n=10+10)
FilterPatterns/Absolute-4 13.9ms ± 7% 10.0ms ± 5% -27.61% (p=0.000 n=10+10)
FilterPatterns/Wildcard-4 51.4ms ± 7% 47.0ms ± 7% -8.51% (p=0.001 n=9+9)
FilterPatterns/ManyNoMatch-4 551ms ± 9% 190ms ± 1% -65.41% (p=0.000 n=10+8)
name old alloc/op new alloc/op delta
FilterPatterns/Relative-4 3.57MB ± 0% 3.57MB ± 0% ~ (p=0.665 n=10+9)
FilterPatterns/Absolute-4 3.57MB ± 0% 3.57MB ± 0% ~ (p=0.480 n=9+10)
FilterPatterns/Wildcard-4 14.3MB ± 0% 14.3MB ± 0% ~ (p=0.431 n=9+10)
FilterPatterns/ManyNoMatch-4 3.57MB ± 0% 3.57MB ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
FilterPatterns/Relative-4 22.2k ± 0% 22.2k ± 0% ~ (all equal)
FilterPatterns/Absolute-4 22.2k ± 0% 22.2k ± 0% ~ (all equal)
FilterPatterns/Wildcard-4 88.7k ± 0% 88.7k ± 0% ~ (all equal)
FilterPatterns/ManyNoMatch-4 22.2k ± 0% 22.2k ± 0% ~ (all equal)
2020-10-07 20:47:52 +02:00
Michael Eischer
375c2a56de
filter: Parse filter patterns only once
...
name old time/op new time/op delta
FilterPatterns/Relative-4 30.3ms ±10% 23.6ms ±20% -22.12% (p=0.000 n=10+10)
FilterPatterns/Absolute-4 49.0ms ± 3% 32.3ms ± 8% -33.94% (p=0.000 n=8+10)
FilterPatterns/Wildcard-4 345ms ± 9% 334ms ±17% ~ (p=0.315 n=10+10)
FilterPatterns/ManyNoMatch-4 3.93s ± 2% 0.71s ± 7% -81.98% (p=0.000 n=9+10)
name old alloc/op new alloc/op delta
FilterPatterns/Relative-4 4.63MB ± 0% 3.57MB ± 0% -22.98% (p=0.000 n=9+9)
FilterPatterns/Absolute-4 8.54MB ± 0% 3.57MB ± 0% -58.20% (p=0.000 n=10+10)
FilterPatterns/Wildcard-4 146MB ± 0% 141MB ± 0% -2.93% (p=0.000 n=9+9)
FilterPatterns/ManyNoMatch-4 907MB ± 0% 4MB ± 0% -99.61% (p=0.000 n=9+9)
name old allocs/op new allocs/op delta
FilterPatterns/Relative-4 66.6k ± 0% 22.2k ± 0% -66.67% (p=0.000 n=10+10)
FilterPatterns/Absolute-4 88.7k ± 0% 22.2k ± 0% -75.00% (p=0.000 n=10+10)
FilterPatterns/Wildcard-4 1.70M ± 0% 1.63M ± 0% -3.92% (p=0.000 n=10+10)
FilterPatterns/ManyNoMatch-4 4.46M ± 0% 0.02M ± 0% -99.50% (p=0.000 n=10+10)
2020-10-07 20:47:27 +02:00
greatroar
c4e2203e45
Check error in archiver before calling Select
...
The archiver first called the Select function for a path before checking
whether the Lstat on that path actually worked. The RejectFuncs in
exclude.go worked around this by checking whether they received a nil
os.FileInfo. Checking first is more obvious and requires less code.
2020-10-05 11:11:04 +02:00
yoshiera
3cf29a777d
Fix nil check in rejectBySize
2020-09-21 19:20:24 +08:00
yoshiera
ac4b8c98ac
Support excluding files by size
2020-09-19 19:52:09 +08:00
Michael Eischer
49b6aac3fa
Use !bytes.Equal instead of bytes.Compare !=0 to check for inequality
2020-09-05 10:06:23 +02:00
Martin Michlmayr
5cc1760fdf
Fix typos
2020-05-16 14:05:26 +08:00
Johannes Hertenstein
cdc287a7f6
Store reference to reject function for insensitive pattern rejection
2019-01-19 11:08:13 +00:00
Johannes Hertenstein
db82e6b80c
Add iexclude option to backup command
2018-11-25 13:32:16 +01:00
Andreas Skielboe
b07bb3d8c3
Reject files excluded by name before calling lstat to improve scan speed
...
Adds a SelectByName method to the archive and scanner which only require
the filename as input, and can thus be run before calling lstat on the
file. Can speed up scanning significantly if a lot of filename excludes
are used.
2018-08-12 17:51:12 +02:00
Mikael Berthe
a868a30f4d
Fix restic backup --one-file-system /
...
This patch should fix the following panic when trying to backup the
root filesystem with thre --one-file-system flag:
% restic backup --one-file-system /
(...)
panic: item /, device id 2082 not found, allowedDevs: map[/:2082]
2018-05-16 13:44:14 +02:00
Alexander Neumann
ef7747313d
backup: Use absolute paths for allowed devices
2018-05-11 21:32:44 +02:00
Alexander Neumann
18d4ac2fd9
backup: Always use cleaned path for excludes
2018-05-11 21:32:41 +02:00
Fabian Wickborn
1ea518d5ef
cmd/restic: Use a dedicated cache for each rejectIfPresent
2017-11-27 17:33:53 +01:00
Fabian Wickborn
f0f17db847
Cache evaluated directories in isExcludedByFile
...
Fixes #1271 .
2017-10-06 22:11:22 +02:00
Alexander Neumann
610b676444
Automatically exclude current restic cache
2017-09-24 21:54:53 +02:00
Alexander Neumann
a8aa4eb06c
Rename parameter filename -> path
2017-09-10 20:28:21 +02:00
Alexander Neumann
2fdca5d310
Improve debug message
2017-09-10 15:16:05 +02:00
Alexander Neumann
e117f613af
Move device test into new RejectFunc
2017-09-10 15:13:40 +02:00
Alexander Neumann
0dfdf02885
Rework pattern excludes
2017-09-10 14:34:28 +02:00
Alexander Neumann
4a0129fc2b
Rename excludeByFile -> rejectIfPresent
2017-09-10 14:25:58 +02:00
Alexander Neumann
a9c705009c
Move reject functions to new file
2017-09-10 14:25:25 +02:00