administrative functions for rev-cache, and start of integration into git
PATCH 4/6 administrative functions for rev-cache, and start of integration into git
This patch, fourth, contains miscellaneous (maintenance) features:
- support for cache slice fusion, index regeneration and object size caching
- non-commit object generation refactored to take advantage of 'size' field
- porcelain updated to support feature additions
The beginnings of integration into git are present in this patch, mainly centered on caching object size; the object generation is refactored to more elegantly exploit this. Fusion allows smaller (incremental) slices to be coagulated into a larger slice, reducing overhead, while index regeneration enables repair or cleaning of the cache index.
Note that tests for these features are included in the following patch, as they take advantage of the rev-cache's integration into the revision walker.
--- builtin-gc.c | 9 + builtin-rev-cache.c | 77 ++++++- rev-cache.c | 725 +++++++++++++++++++++++++++++++++++++++++++++------ rev-cache.h | 8 +- revision.h | 16 +- 5 files changed, 751 insertions(+), 84 deletions(-)
builtin-gc.c +9 -0
@@ -22,6 +22,7 @@ static const char * const builtin_gc_usage[] = { NULL }; +static char do_rev_cache =0 ;static int pack_refs =1 ;static int aggressive_window =250 ;static int gc_auto_threshold =6700 ;
@@ -34,9 +35,14 @@ static const char *argv_reflog[] = {"reflog", "expire", "--all", NULL};static const char *argv_repack[MAX_ADD ] = {"repack" ,"-d" ,"-l" ,NULL };static const char *argv_prune[] = {"prune" ,"--expire" ,NULL ,NULL };static const char *argv_rerere[] = {"rerere" ,"gc" ,NULL }; +static const char *argv_rev_cache[] = {"rev-cache" ,"fuse" ,"--all" ,"--ignore-size" ,NULL };static int gc_config (const char *var,const char *value,void *cb) { +if (!strcmp (var,"gc.revcache" )) { + do_rev_cache =1 ; +return 0 ; + }if (!strcmp (var,"gc.packrefs" )) {if (value && !strcmp (value,"notbare" )) pack_refs =-1 ;
@@ -244,6 +250,9 @@ int cmd_gc(int argc, const char **argv, const char *prefix)if (run_command_v_opt (argv_rerere,RUN_GIT_CMD ))return error (FAILED_RUN , argv_rerere[0 ]); +if (do_rev_cache &&run_command_v_opt (argv_rev_cache,RUN_GIT_CMD )) +return error (FAILED_RUN , argv_rev_cache[0 ]); +if (auto_gc &&too_many_loose_objects ())warning ("There are too many unreachable loose objects; " "run 'git prune' to remove them." );
builtin-rev-cache.c +76 -1
115 lines not on this page · raw message
rev-cache.c +644 -81
926 lines not on this page · raw message
rev-cache.h +7 -1
@@ -3,6 +3,7 @@#define SUPPORTED_REVCACHE_VERSION 1#define SUPPORTED_REVINDEX_VERSION 1 +#define SUPPORTED_REVCOPTR_VERSION 1#define RC_PATH_WIDTH sizeof(uint16_t)#define RC_PATH_SIZE (x) (RC_PATH_WIDTH * (x))
@@ -14,6 +15,7 @@#define RC_IE_CAST (p) ((struct rc_index_entry *)(p))#define RC_ACTUAL_OBJECT_ENTRY_SIZE (e) (RC_OE_SIZE + RC_PATH_SIZE((e)->merge_nr + (e)->split_nr) + (e)->size_size) +#define RC_ENTRY_SIZE_OFFSET (e) (RC_ACTUAL_OBJECT_ENTRY_SIZE(e) - (e)->size_size)/* single index maps objects to cache files */ struct rc_index_header {
@@ -72,6 +74,7 @@ struct rc_object_entry {extern unsigned char *get_cache_slice (struct commit *commit); +extern int open_cache_slice (unsigned char *sha1,int flags); extern int traverse_cache_slice(struct rev_info *revs, unsigned char *cache_sha1, struct commit *commit, unsigned long *date_so_far, int *slop_so_far,
@@ -84,6 +87,9 @@ extern int make_cache_slice(struct rev_cache_info *rci,extern int make_cache_index (struct rev_cache_info *rci,unsigned char *cache_sha1,int fd,unsigned int size); -extern void starts_from_slices (struct rev_info *revs,unsigned int flags); +extern void starts_from_slices (struct rev_info *revs,unsigned int flags,unsigned char *which,int n); +extern int fuse_cache_slices (struct rev_cache_info *rci,struct rev_info *revs); +extern int regenerate_cache_index (struct rev_cache_info *rci); +extern int make_cache_slice_pointer (struct rev_cache_info *rci,const char *slice_path);#endif
revision.h +15 -1
@@ -19,17 +19,31 @@struct rev_info ;struct log_info ; +struct rev_cache_slice_map { +unsigned char *map; +int size; +int last_index; +}; +struct rev_cache_info {/* generation flags */ unsigned objects :1 , legs :1 , - make_index :1 ; + make_index :1 , + fuse_me :1 ; + +/* index inclusion */ +unsigned overwrite_all :1 ;/* traversal flags */ unsigned add_to_pending :1 ;/* fuse options */ unsigned int ignore_size; + +/* reserved */ +struct rev_cache_slice_map *maps, + *last_map; };struct rev_info {
Signature · 1 line
tg: (228530c..) t/revcache/misc (depends on: t/revcache/objects)