Share packs across repository instances

Opening the same repository multiple times will currently open the same
file multiple times, as well as map the same region of the file multiple
times. This is not necessary, as the packfile data is immutable.

Instead of opening and closing packfiles directly, introduce an
indirection and allocate packfiles globally. This does mean locking on
each packfile open, but we already use this lock for the global mwindow
list so it doesn't introduce a new contention point.

--- 

We probably want to add a test to actually make sure we're allocating the right number of packs, but I wanted to get some early feedback.

One thing that this means is that once you have the pack open, we won't check for permissions anymore, so if you open a repo as root and then drop to a normal user, we would still have it open as root, not that anybody should be doing anything of the sort.

/cc @vmg 
Can we set an error message here so if this does fail it won't return an error without a message?