summaryrefslogtreecommitdiff
path: root/src/pack.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a mutex leak in pack.cPhilip Kelley2013-01-261-0/+1
|
* pack: evict all of the pages at onceCarlos Martín Nieto2013-01-141-31/+4
| | | | | | Somewhat surprisingly, this can increase the speed considerably, as we don't bother trying to decide what to evict, and the most used entries are quickly back into the cache.
* pack: evict objects from the cache in groups of eightCarlos Martín Nieto2013-01-141-11/+33
| | | | | This drops the cache eviction below libcrypto and zlib in the perf output. The number has been chosen empirically.
* pack: fixes to the cacheCarlos Martín Nieto2013-01-121-3/+8
| | | | | The offset should be git_off_t, and we should check the return value of the mutex lock function.
* indexer: properly free the packfile resourcesCarlos Martín Nieto2013-01-121-1/+1
| | | | | | | | The indexer needs to call the packfile's free function so it takes care of freeing the caches. We still need to close the mwf descriptor manually so we can rename the packfile into its final name on Windows.
* Revert "pack: packfile_free -> git_packfile_free and use it in the indexers"Carlos Martín Nieto2013-01-111-1/+1
| | | | | | This reverts commit f289f886cb81bb570bed747053d5ebf8aba6bef7, which makes the tests fail on Windows. Revert until we can figure out a solution.
* Fix MSVC compilation warningsnulltoken2013-01-111-1/+1
|
* pack: packfile_free -> git_packfile_free and use it in the indexersCarlos Martín Nieto2013-01-111-1/+1
| | | | | It turns out the indexers have been ignoring the pack's free function and leaking data. Plug that.
* pack: limit the amount of memory the base delta cache can useCarlos Martín Nieto2013-01-111-2/+34
| | | | | Currently limited to 16MB (like git) and to objects up to 1MB in size.
* pack: abstract out the cache into its own functionsCarlos Martín Nieto2013-01-111-52/+81
|
* pack: refcount entries and add a mutex around cache accessCarlos Martín Nieto2013-01-111-9/+33
|
* pack: introduce a delta base cacheCarlos Martín Nieto2013-01-111-17/+78
| | | | | | | | Many delta bases are re-used. Cache them to avoid inflating the same data repeatedly. This version doesn't limit the amount of entries to store, so it can end up using a considerable amound of memory.
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Merge pull request #1091 from carlosmn/stream-objectVicent Martí2012-12-071-0/+66
|\ | | | | Indexer speedup with large objects
| * pack: introduce a streaming API for raw objectsCarlos Martín Nieto2012-11-301-0/+66
| | | | | | | | | | This allows us to take objects from the packfile as a stream instead of having to keep it all in memory.
* | pack: add git_packfile_resolve_headerDavid Michael Barr2012-12-031-0/+50
|/ | | | | | | | | | | | | | | | | | To paraphrase @peff: You can get both size and type from a packed object reasonably cheaply. If you have: * An object that is not a delta; both type and size are available in the packfile header. * An object that is a delta. The packfile type will be OBJ_*_DELTA, and you have to resolve back to the base to find the real type. That means potentially a lot of packfile index lookups, but each one is relatively cheap. For the size, you inflate the first few bytes of the delta, whose header will tell you the resulting size of applying the delta to the base. For simplicity, we just decompress the whole delta for now.
* Make git_odb_foreach_cb take const paramRussell Belfer2012-11-271-1/+1
| | | | | This makes the first OID param of the ODB callback a const pointer and also propogates that change all the way to the backends.
* Set p->mwf.fd to -1 on errorSven Strickroth2012-11-241-2/+4
| | | | | | If p->mwf.fd is e.g. -2 then it is closed in packfile_free and an exception might be thrown. Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Remove use of English expletivesMartin Woodward2012-11-231-1/+1
| | | | | | Remove words such as fuck, crap, shit etc. Remove other potentially offensive words from comments. Tidy up other geopolicital terms in comments.
* pack: iterate objects in offset orderDavid Michael Barr2012-09-141-12/+36
| | | | Compute the ordering on demand and persist until the index is freed.
* Merge remote-tracking branch 'arrbee/tree-walk-fixes' into developmentVicent Marti2012-08-061-5/+6
|\ | | | | | | | | | | | | | | | | Conflicts: src/notes.c src/transports/git.c src/transports/http.c src/transports/local.c tests-clar/odb/foreach.c
| * Update iterators for consistency across libraryRussell Belfer2012-08-031-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This updates all the `foreach()` type functions across the library that take callbacks from the user to have a consistent behavior. The rules are: * A callback terminates the loop by returning any non-zero value * Once the callback returns non-zero, it will not be called again (i.e. the loop stops all iteration regardless of state) * If the callback returns non-zero, the parent fn returns GIT_EUSER * Although the parent returns GIT_EUSER, no error will be set in the library and `giterr_last()` will return NULL if called. This commit makes those changes across the library and adds tests for most of the iteration APIs to make sure that they follow the above rules.
* | portability: Improve x86/amd64 compatibilitynulltoken2012-07-241-3/+3
|/
* odb: add git_odb_foreach()Carlos Martín Nieto2012-07-031-0/+43
| | | | | Go through each backend and list every objects that exists in them. This allows fsck-like uses.
* mwindow: allow memory-window files to deregisterCarlos Martin Nieto2012-06-281-0/+1
| | | | | | | | | Once a file is registered, there is no way to deregister it, even after the structure that contains it is no longer needed and has been freed. This may be the source of #624. Allow and use the deregister function to remove our file from the global list.
* Actually do the mmap... unsurprisingly, this makes the indexer work on SFSChris Young2012-06-121-3/+3
| | | | | On RAM: the .idx and .pack files become links to a .lock and the original download respectively. Assume some feature (such as record locking) supported by SFS but not JXFS or RAM: is required.
* Basic mmap/munmap compatiblityChris Young2012-06-101-2/+2
|
* errors: Rename error codesbreaking-changesVicent Martí2012-05-181-7/+7
|
* errors: Rename the generic return codesVicent Martí2012-05-181-7/+7
|
* Fix valgrind issuesRussell Belfer2012-05-041-6/+19
| | | | | | | There are three changes here: - correctly propogate error code from failed object lookups - make zlib inflate use our allocators - add OID to notfound error in ODB lookups
* Merge pull request #632 from arrbee/win64-cleanupVicent Martí2012-04-231-2/+7
|\ | | | | Code clean up, including fixing warnings on Windows 64-bit build
| * Fix warnings on 64-bit windows buildsRussell Belfer2012-04-171-2/+7
| | | | | | | | | | This fixes all the warnings on win64 except those in deps, which come from the regex code.
* | pack: signal a short buffer when neededCarlos Martín Nieto2012-04-131-11/+38
|/
* Convert attr, ignore, mwindow, status to new errorsRussell Belfer2012-03-161-1/+1
| | | | | Also cleaned up some previously converted code that still had little things to polish.
* Migrate ODB files to new error handlingRussell Belfer2012-03-121-145/+135
| | | | | | | | | | | | | | This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to the new style of error handling. Also got the unix and win32 versions of map.c. There are some minor changes to other files but no others were completely converted. This also contains an update to filebuf so that a zeroed out filebuf will not think that the fd (== 0) is actually open (and inadvertently call close() on fd 0 if cleaned up). Lastly, this was built and tested on win32 and contains a bunch of fixes for the win32 build which was pretty broken.
* error-handling: ReferencesVicent Martí2012-03-061-1/+1
| | | | | Yes, this is error handling solely for `refs.c`, but some of the abstractions leak all ofer the code base.
* zlib: Remove custom `git2/zlib.h` headerVicent Martí2012-02-151-1/+1
| | | | | | This is legacy compat stuff for when `deflateBound` is not defined, but we're not embedding zlib and that function is always available. Kill that with fire.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* Move path related functions from fileops to pathRussell Belfer2012-01-171-1/+1
| | | | | | | | | | | This takes all of the functions that look up simple data about paths (such as `git_futils_isdir`) and moves them over to path.h (becoming `git_path_isdir`). This leaves fileops.h just with functions that actually manipulate the filesystem or look at the file contents in some way. As part of this, the dir.h header which is really just for win32 support was moved into win32 (with some minor changes).
* Fix #534: 64-bit issues in WindowsVicent Martí2012-01-151-8/+1
| | | | | | | | | | | | off_t is always 32 bits in Windows, which is beyond stupid, but we just don't care anymore because we're using `git_off_t` which is assured to be 64 bits on all platforms, regardless of compilation mode. Just ensure that no casts to `off_t` are performed. Also, the check for `off_t` overflows has been dropped, once again, because the size of our offsets is always 64 bits on all platforms. Fixes #534
* threads: Fix the shared global state with TLSVicent Marti2011-11-161-1/+3
| | | | | | | See `global.c` for a description of what we're doing. When libgit2 is built with GIT_THREADS support, the threading system must be explicitly initialized with `git_threads_init()`.
* global: Properly use `git__` memory wrappersVicent Marti2011-10-281-10/+10
| | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* odb_pack: don't do ambiguity checks for fully qualified SHA1 hashesBrodie Rao2011-10-121-1/+1
| | | | | | | | This makes libgit2 more closely match Git, which only checks for ambiguous pack entries when given short hashes. Note that the only time this is ever relevant is when a pack has the same object more than once (it's happened in the wild, I promise).
* Tabify everythingVicent Marti2011-09-191-21/+21
| | | | | | There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
* Cleanup legal dataVicent Marti2011-09-191-21/+3
| | | | | | | | | | 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
* Add casts to get rid of some warnings when filling zlib structuresSebastian Schuberth2011-09-081-1/+1
|
* Drop STRLEN() macrosKirill A. Shutemov2011-08-251-2/+2
| | | | | | | There is no need in STRLEN macros. Compilers can do this trivial optimization on its own. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* Implement cooperative cachingCarlos Martín Nieto2011-08-181-0/+12
| | | | | | | | | When indexing a file with ref deltas, a temporary cache for the offsets has to be built, as we don't have an index file yet. If the user takes the responsiblity for filling the cache, the packing code will look there first when it finds a ref delta. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Rethrow pack entry offset errorCarlos Martín Nieto2011-08-181-1/+1
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Check for error calculating the delta baseCarlos Martín Nieto2011-08-041-0/+2
| | | | | | Don't assume that it's always going to work. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>