Merge pull request #971 from jeffhostetler/jeffhostetler/add_preload_fscache

add: use preload-index and fscache for performance
This commit is contained in:
Johannes Schindelin
2018-06-08 18:34:57 +02:00
committed by Jameson Miller
3 changed files with 7 additions and 4 deletions

View File

@@ -461,6 +461,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
die_path_inside_submodule(&the_index, &pathspec);
enable_fscache(1);
/* We do not really re-read the index but update the up-to-date flags */
preload_index(&the_index, &pathspec);
if (add_new_files) {
int baselen;

View File

@@ -659,6 +659,7 @@ extern int daemonize(void);
/* Initialize and use the cache information */
struct lock_file;
extern int read_index(struct index_state *);
extern void preload_index(struct index_state *, const struct pathspec *pathspec);
extern int read_index_preload(struct index_state *, const struct pathspec *pathspec);
extern int do_read_index(struct index_state *istate, const char *path,
int must_exist); /* for testting only! */

View File

@@ -7,8 +7,7 @@
#include "fsmonitor.h"
#ifdef NO_PTHREADS
static void preload_index(struct index_state *index,
const struct pathspec *pathspec)
void preload_index(struct index_state *index, const struct pathspec *pathspec)
{
; /* nothing */
}
@@ -73,8 +72,7 @@ static void *preload_thread(void *_data)
return NULL;
}
static void preload_index(struct index_state *index,
const struct pathspec *pathspec)
void preload_index(struct index_state *index, const struct pathspec *pathspec)
{
int threads, i, work, offset;
struct thread_data data[MAX_PARALLEL];