mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-23 08:16:54 +00:00
Merge pull request #3963 from ThomasWaldmann/chunker-fd-only
Chunker: give os-level fd only
This commit is contained in:
commit
20abc9d687
1 changed files with 9 additions and 7 deletions
|
@ -1151,13 +1151,15 @@ def process_file(self, path, st, cache):
|
|||
else:
|
||||
with backup_io('open'):
|
||||
fh = Archive._open_rb(path)
|
||||
with os.fdopen(fh, 'rb') as fd:
|
||||
self.process_file_chunks(item, cache, self.stats, self.show_progress, backup_io_iter(self.chunker.chunkify(fd, fh)))
|
||||
md = self.metadata_collector.stat_attrs(st, path, fd=fh)
|
||||
if not is_special_file:
|
||||
# we must not memorize special files, because the contents of e.g. a
|
||||
# block or char device will change without its mtime/size/inode changing.
|
||||
cache.memorize_file(path_hash, st, [c.id for c in item.chunks])
|
||||
try:
|
||||
self.process_file_chunks(item, cache, self.stats, self.show_progress, backup_io_iter(self.chunker.chunkify(None, fh)))
|
||||
md = self.metadata_collector.stat_attrs(st, path, fd=fh)
|
||||
finally:
|
||||
os.close(fh)
|
||||
if not is_special_file:
|
||||
# we must not memorize special files, because the contents of e.g. a
|
||||
# block or char device will change without its mtime/size/inode changing.
|
||||
cache.memorize_file(path_hash, st, [c.id for c in item.chunks])
|
||||
self.stats.nfiles += 1
|
||||
if md is None:
|
||||
fh = Archive._open_rb(path)
|
||||
|
|
Loading…
Reference in a new issue