mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-28 02:38:43 +00:00
Merge pull request #5106 from ThomasWaldmann/fuse-opts
FUSE micro opt, removal of unneeded code
This commit is contained in:
commit
b6a31be8c3
1 changed files with 8 additions and 24 deletions
|
@ -8,7 +8,6 @@
|
||||||
import time
|
import time
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from signal import SIGINT
|
from signal import SIGINT
|
||||||
from distutils.version import LooseVersion
|
|
||||||
|
|
||||||
import llfuse
|
import llfuse
|
||||||
|
|
||||||
|
@ -25,17 +24,10 @@
|
||||||
from .lrucache import LRUCache
|
from .lrucache import LRUCache
|
||||||
from .remote import RemoteRepository
|
from .remote import RemoteRepository
|
||||||
|
|
||||||
# Does this version of llfuse support ns precision?
|
|
||||||
have_fuse_xtime_ns = hasattr(llfuse.EntryAttributes, 'st_mtime_ns')
|
|
||||||
|
|
||||||
fuse_version = LooseVersion(getattr(llfuse, '__version__', '0.1'))
|
def fuse_main():
|
||||||
if fuse_version >= '0.42':
|
return llfuse.main(workers=1)
|
||||||
def fuse_main():
|
|
||||||
return llfuse.main(workers=1)
|
|
||||||
else:
|
|
||||||
def fuse_main():
|
|
||||||
llfuse.main(single=True)
|
|
||||||
return None
|
|
||||||
|
|
||||||
# size of some LRUCaches (1 element per simultaneously open file)
|
# size of some LRUCaches (1 element per simultaneously open file)
|
||||||
# note: _inode_cache might have rather large elements - Item.chunks can be large!
|
# note: _inode_cache might have rather large elements - Item.chunks can be large!
|
||||||
|
@ -362,8 +354,7 @@ def file_version(item, path):
|
||||||
file_id = blake2b_128(path)
|
file_id = blake2b_128(path)
|
||||||
current_version, previous_id = self.versions_index.get(file_id, (0, None))
|
current_version, previous_id = self.versions_index.get(file_id, (0, None))
|
||||||
|
|
||||||
chunk_ids = [chunk_id for chunk_id, _, _ in item.chunks]
|
contents_id = blake2b_128(b''.join(chunk_id for chunk_id, _, _ in item.chunks))
|
||||||
contents_id = blake2b_128(b''.join(chunk_ids))
|
|
||||||
|
|
||||||
if contents_id != previous_id:
|
if contents_id != previous_id:
|
||||||
current_version += 1
|
current_version += 1
|
||||||
|
@ -567,17 +558,10 @@ def getattr(self, inode, ctx=None):
|
||||||
entry.st_blksize = 512
|
entry.st_blksize = 512
|
||||||
entry.st_blocks = (entry.st_size + entry.st_blksize - 1) // entry.st_blksize
|
entry.st_blocks = (entry.st_size + entry.st_blksize - 1) // entry.st_blksize
|
||||||
# note: older archives only have mtime (not atime nor ctime)
|
# note: older archives only have mtime (not atime nor ctime)
|
||||||
mtime_ns = item.mtime
|
entry.st_mtime_ns = mtime_ns = item.mtime
|
||||||
if have_fuse_xtime_ns:
|
entry.st_atime_ns = item.get('atime', mtime_ns)
|
||||||
entry.st_mtime_ns = mtime_ns
|
entry.st_ctime_ns = item.get('ctime', mtime_ns)
|
||||||
entry.st_atime_ns = item.get('atime', mtime_ns)
|
entry.st_birthtime_ns = item.get('birthtime', mtime_ns)
|
||||||
entry.st_ctime_ns = item.get('ctime', mtime_ns)
|
|
||||||
entry.st_birthtime_ns = item.get('birthtime', mtime_ns)
|
|
||||||
else:
|
|
||||||
entry.st_mtime = mtime_ns / 1e9
|
|
||||||
entry.st_atime = item.get('atime', mtime_ns) / 1e9
|
|
||||||
entry.st_ctime = item.get('ctime', mtime_ns) / 1e9
|
|
||||||
entry.st_birthtime = item.get('birthtime', mtime_ns) / 1e9
|
|
||||||
return entry
|
return entry
|
||||||
|
|
||||||
def listxattr(self, inode, ctx=None):
|
def listxattr(self, inode, ctx=None):
|
||||||
|
|
Loading…
Reference in a new issue