Merge pull request #9421 from ThomasWaldmann/fuse-fixes-master
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OmniOS, false, omnios, r151056) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run

mount: fuse fs performance fix, docstring
This commit is contained in:
TW 2026-02-28 09:31:03 +01:00 committed by GitHub
commit 7092d7715d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,3 +1,19 @@
"""
FUSE filesystem implementation for `borg mount`.
IMPORTANT
=========
This code is only safe for single-threaded and synchronous (non-async) usage.
- llfuse is synchronous and used with workers=1, so there is only 1 thread,
and we are safe.
- pyfuse3 uses Trio, which only uses 1 thread, but could use this code in an
asynchronous manner. However, as long as we do not use any asynchronous
operations (like using "await") in this code, it is still de facto
synchronous, and we are safe.
"""
import errno
import functools
import io
@ -177,7 +193,7 @@ class ItemCache:
for key, (csize, data) in zip(archive_item_ids, self.decrypted_repository.get_many(archive_item_ids)):
# Store the chunk ID in the meta-array
if write_offset + 32 >= len(meta):
self.meta = meta = meta + bytes(self.GROW_META_BY)
meta.extend(bytes(self.GROW_META_BY))
meta[write_offset : write_offset + 32] = key
current_id_offset = write_offset
write_offset += 32
@ -215,7 +231,7 @@ class ItemCache:
msgpacked_bytes = b""
if write_offset + 9 >= len(meta):
self.meta = meta = meta + bytes(self.GROW_META_BY)
meta.extend(bytes(self.GROW_META_BY))
# item entries in the meta-array come in two different flavours, both nine bytes long.
# (1) for items that span chunks: