Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java
index 871a2c5034..bd68ae520d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsBlockCache.java
@@ -115,8 +115,12 @@ public final class DfsBlockCache {
DfsBlockCache oc = cache;
cache = nc;
- if (oc != null && oc.readAheadService != null)
- oc.readAheadService.shutdown();
+ if (oc != null) {
+ if (oc.readAheadService != null)
+ oc.readAheadService.shutdown();
+ for (DfsPackFile pack : oc.getPackFiles())
+ pack.key.cachedSize.set(0);
+ }
}
/** @return the currently active DfsBlockCache. */
@@ -343,6 +347,7 @@ public final class DfsBlockCache {
e2 = table.get(slot);
}
+ key.cachedSize.addAndGet(v.size());
Ref<DfsBlock> ref = new Ref<DfsBlock>(key, position, v.size(), v);
ref.hot = true;
for (;;) {
@@ -389,6 +394,7 @@ public final class DfsBlockCache {
dead.next = null;
dead.value = null;
live -= dead.size;
+ dead.pack.cachedSize.addAndGet(-dead.size);
statEvict++;
} while (maxBytes < live);
clockHand = prev;
@@ -438,6 +444,7 @@ public final class DfsBlockCache {
}
}
+ key.cachedSize.addAndGet(size);
ref = new Ref<T>(key, pos, size, v);
ref.hot = true;
for (;;) {

Back to the top