mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 07:01:59 +00:00
Merge pull request #4497 from ThomasWaldmann/simple-stat-only-once
create: only run stat_simple_attrs() once
This commit is contained in:
commit
df5641ad27
1 changed files with 2 additions and 3 deletions
|
@ -1195,6 +1195,7 @@ def process_file(self, *, path, parent_fd, name, st, cache, flags=flags_normal):
|
||||||
with OsOpen(path=path, parent_fd=parent_fd, name=name, flags=flags, noatime=True) as fd:
|
with OsOpen(path=path, parent_fd=parent_fd, name=name, flags=flags, noatime=True) as fd:
|
||||||
with backup_io('fstat'):
|
with backup_io('fstat'):
|
||||||
st = stat_update_check(st, os.fstat(fd))
|
st = stat_update_check(st, os.fstat(fd))
|
||||||
|
item.update(self.metadata_collector.stat_simple_attrs(st))
|
||||||
is_special_file = is_special(st.st_mode)
|
is_special_file = is_special(st.st_mode)
|
||||||
if not hardlinked or hardlink_master:
|
if not hardlinked or hardlink_master:
|
||||||
if not is_special_file:
|
if not is_special_file:
|
||||||
|
@ -1219,7 +1220,6 @@ def process_file(self, *, path, parent_fd, name, st, cache, flags=flags_normal):
|
||||||
else:
|
else:
|
||||||
status = 'M' if known else 'A' # regular file, modified or added
|
status = 'M' if known else 'A' # regular file, modified or added
|
||||||
item.hardlink_master = hardlinked
|
item.hardlink_master = hardlinked
|
||||||
item.update(self.metadata_collector.stat_simple_attrs(st))
|
|
||||||
# Only chunkify the file if needed
|
# Only chunkify the file if needed
|
||||||
if chunks is not None:
|
if chunks is not None:
|
||||||
item.chunks = chunks
|
item.chunks = chunks
|
||||||
|
@ -1244,8 +1244,7 @@ def process_file(self, *, path, parent_fd, name, st, cache, flags=flags_normal):
|
||||||
# changed while we backed it up.
|
# changed while we backed it up.
|
||||||
cache.memorize_file(path_hash, st, [c.id for c in item.chunks])
|
cache.memorize_file(path_hash, st, [c.id for c in item.chunks])
|
||||||
self.stats.nfiles += 1
|
self.stats.nfiles += 1
|
||||||
md = self.metadata_collector.stat_attrs(st, path, fd=fd)
|
item.update(self.metadata_collector.stat_ext_attrs(st, path, fd=fd))
|
||||||
item.update(md)
|
|
||||||
item.get_size(memorize=True)
|
item.get_size(memorize=True)
|
||||||
if is_special_file:
|
if is_special_file:
|
||||||
# we processed a special file like a regular file. reflect that in mode,
|
# we processed a special file like a regular file. reflect that in mode,
|
||||||
|
|
Loading…
Reference in a new issue