Don't use ByteWindows when checking pack file headers/footers
commit65cf2f453ff227765df6cf3758cb1d3126222cd6
authorShawn O. Pearce <spearce@spearce.org>
Wed, 29 Apr 2009 18:54:45 +0000 (29 11:54 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Wed, 29 Apr 2009 23:49:07 +0000 (30 01:49 +0200)
treef2a6eeacd808f73a57e2dde6b8d190db43e9d580
parent66e01bfd5a1567b9e4f749da4a51dc63132a8fb3
Don't use ByteWindows when checking pack file headers/footers

Its highly unlikely we need the 8 KiB surrounding the pack file header
or footer immediately after opening the pack file.  Reading those as
full blocks and registering them in the WindowCache is probably just
churning garbage through the cache.  Instead, read the header with a
single 12 byte read, and the footer with a single 20 byte read, and
bypass the cache altogether.

This nicely removes a deadlock condition we had previously where the
WindowCache was recursively calling itself during the pack file open,
and got stuck on its own locks.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
org.spearce.jgit/src/org/spearce/jgit/lib/PackFile.java
org.spearce.jgit/src/org/spearce/jgit/util/NB.java