[ARVADOS] updated: 082c741b4e1a3b82a71d73e001a3ee7aec638d1d
Git user
git at public.curoverse.com
Wed Sep 21 15:51:38 EDT 2016
Summary of changes:
services/fuse/arvados_fuse/__init__.py | 14 +++++---------
services/fuse/arvados_fuse/fresh.py | 1 -
2 files changed, 5 insertions(+), 10 deletions(-)
via 082c741b4e1a3b82a71d73e001a3ee7aec638d1d (commit)
from 232cace27f60dbac0f46a9113a4b19a561689f4c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 082c741b4e1a3b82a71d73e001a3ee7aec638d1d
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Wed Sep 21 15:51:34 2016 -0400
10117: OrderedDict preserves insertion order, use use inode as key instead of cache_priority.
diff --git a/services/fuse/arvados_fuse/__init__.py b/services/fuse/arvados_fuse/__init__.py
index ba70959..e286525 100644
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@ -134,7 +134,6 @@ class InodeCache(object):
def __init__(self, cap, min_entries=4):
self._entries = collections.OrderedDict()
self._by_uuid = {}
- self._counter = itertools.count(0)
self.cap = cap
self._total = 0
self.min_entries = min_entries
@@ -153,7 +152,7 @@ class InodeCache(object):
return False
obj.clear()
self._total -= obj.cache_size
- del self._entries[obj.cache_priority]
+ del self._entries[obj.inode]
if obj.cache_uuid:
self._by_uuid[obj.cache_uuid].remove(obj)
if not self._by_uuid[obj.cache_uuid]:
@@ -165,16 +164,15 @@ class InodeCache(object):
def cap_cache(self):
if self._total > self.cap:
- for key in list(self._entries.keys()):
+ for key in self._entries.keys():
if self._total < self.cap or len(self._entries) < self.min_entries:
break
self._remove(self._entries[key], True)
def manage(self, obj):
if obj.persisted():
- obj.cache_priority = next(self._counter)
obj.cache_size = obj.objsize()
- self._entries[obj.cache_priority] = obj
+ self._entries[obj.inode] = obj
obj.cache_uuid = obj.uuid()
if obj.cache_uuid:
if obj.cache_uuid not in self._by_uuid:
@@ -185,17 +183,15 @@ class InodeCache(object):
self._total += obj.objsize()
_logger.debug("InodeCache touched inode %i (size %i) (uuid %s) total now %i", obj.inode, obj.objsize(), obj.cache_uuid, self._total)
self.cap_cache()
- else:
- obj.cache_priority = None
def touch(self, obj):
if obj.persisted():
- if obj.cache_priority in self._entries:
+ if obj.inode in self._entries:
self._remove(obj, False)
self.manage(obj)
def unmanage(self, obj):
- if obj.persisted() and obj.cache_priority in self._entries:
+ if obj.persisted() and obj.inode in self._entries:
self._remove(obj, True)
def find_by_uuid(self, uuid):
diff --git a/services/fuse/arvados_fuse/fresh.py b/services/fuse/arvados_fuse/fresh.py
index 532f110..43f53c9 100644
--- a/services/fuse/arvados_fuse/fresh.py
+++ b/services/fuse/arvados_fuse/fresh.py
@@ -64,7 +64,6 @@ class FreshBase(object):
self.use_count = 0
self.ref_count = 0
self.dead = False
- self.cache_priority = None
self.cache_size = 0
self.cache_uuid = None
self.allow_attr_cache = True
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list