fetch submodules in parallel and a preview on parallel "submodule update"
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v4 Latest14 patches 10 repliesIn review
- v313 patches 34 repliesSuperseded
- v110 patches 26 repliesSuperseded
Patches in v4 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | submodule: Send "Fetching submodule <foo>" to standard errorsubmodule.c t/ | +27 | 0 replies | |
| 2/14 | xread: poll on non blocking fdswrapper.c | +11 | 0 replies | |
| 3/14 | xread_nonblock: add functionality to read from fds without blockinggit-compat-util.h wrapper.c | +23 | 0 replies | |
| 4/14 | strbuf: add strbuf_read_once to read without blockingstrbuf.c strbuf.h | +20 | 0 replies | |
| 5/14 | run-command: factor out return value computationrun-command.c | +34 | 0 replies | |
| 6/14 | run-command: add an asynchronous parallel child processorrun-command.c run-command.h t/ +1 more | +344 | 23 replies | |
| 7/14 | fetch_populated_submodules: use new parallel job processingsubmodule.c | +85 | 0 replies | |
| 8/14 | submodules: allow parallel fetching, add tests and documentationDocumentation/ builtin/ builtin/ +3 more | +39 | 0 replies | |
| 9/14 | submodule-config: Untangle logic in parse_configsubmodule-config.c | +29 | 0 replies | |
| 10/14 | submodule config: keep update strategy aroundsubmodule-config.c submodule-config.h | +12 | 0 replies | |
| 11/14 | git submodule update: cmd_update_recursivegit-submodule.sh | +26 | 0 replies | |
| 12/14 | git submodule update: cmd_update_clonegit-submodule.sh | +20 | 1 reply | |
| 13/14 | git submodule update: cmd_update_fetchgit-submodule.sh | +84 | 0 replies | |
| 14/14 | Rewrite submodule update in Cbuiltin/ git-submodule.sh | +254 | 0 replies |
Reviews trailers per patch
None of the 14 patches has a Reviewed-by or Acked-by.
| Patch | Jacob Keller | Jeff King | Junio C Hamano |
|---|---|---|---|
| 1/14 | |||
| 2/14 | |||
| 3/14 | Helped-by | Helped-by | Helped-by |
| 4/14 | |||
| 5/14 | |||
| 6/14 | |||
| 7/14 | |||
| 8/14 | |||
| 9/14 | |||
| 10/14 | |||
| 11/14 | |||
| 12/14 | |||
| 13/14 | |||
| 14/14 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCHv4 00/14] fetch submodules in parallel and a preview on parallel "submodule update"
Today there was lots of discussion on the correct way of reading the strbufs as well as some discussion on the structure of the asynchronous parallel process loop.
Patches 1-8 bring parallel fetching of submodules, and have had some good exposure to review and feedback is incorporated.
Patches 9-14 bring parallel submodule updates.
Patch 14 is not ready yet (i.e. test suite failures), but the cleanups before in patch 9-13 can be reviewed without wasting time.
Any feedback welcome,
Thanks,
Stefan
Diff to v3 below. The patches can also be found at [1]
[1] https://github.com/stefanbeller/git/tree/submodulec_nonthreaded_parallel_4
Jonathan Nieder (1):
submodule: Send "Fetching submodule <foo>" to standard error
Stefan Beller (13):
xread: poll on non blocking fds
xread_nonblock: add functionality to read from fds without blocking
strbuf: add strbuf_read_once to read without blocking
run-command: factor out return value computation
run-command: add an asynchronous parallel child processor fetch_populated_submodules: use new parallel job processing
submodules: allow parallel fetching, add tests and documentation
submodule-config: Untangle logic in parse_config submodule config: keep update strategy around
git submodule update: cmd_update_recursive
git submodule update: cmd_update_clone
git submodule update: cmd_update_fetch
Rewrite submodule update in C
Documentation/fetch-options.txt | 7 + builtin/fetch.c | 6 +- builtin/pull.c | 6 + builtin/submodule--helper.c | 251 +++++++++++++++++++++++++++++ git-compat-util.h | 1 + git-submodule.sh | 339 ++++++++++++++-------------------------- run-command.c | 320 ++++++++++++++++++++++++++++++++++--- run-command.h | 36 +++++ strbuf.c | 11 ++ strbuf.h | 9 ++ submodule-config.c | 85 +++++----- submodule-config.h | 1 + submodule.c | 120 +++++++++----- submodule.h | 2 +- t/t0061-run-command.sh | 20 +++ t/t5526-fetch-submodules.sh | 70 ++++++--- test-run-command.c | 24 +++ wrapper.c | 35 ++++- 18 files changed, 987 insertions(+), 356 deletions(-)
builtin/submodule--helper.c +4 -0
@@ -382,10 +382,14 @@ static int update_next_task(void *data,argv_array_pushf (&cp->env_array,"sm_path=%s" , sub->path);argv_array_pushf (&cp->env_array,"name=%s" , sub->name);argv_array_pushf (&cp->env_array,"url=%s" , sub->url); +argv_array_pushf (&cp->env_array,"sha1=%s" ,sha1_to_hex (ce->sha1));argv_array_pushf (&cp->env_array,"update_module=%s" , update_module); cp->git_cmd =1 ; + cp->no_stdin =1 ; cp->stdout_to_stderr =1 ; + cp->err =-1 ; +argv_array_init (&cp->args);argv_array_push (&cp->args,"submodule" );if (!file_exists (sm_gitdir))argv_array_push (&cp->args,"update_clone" );
run-command.c +38 -47
179 lines not on this page · raw message
run-command.h +0 -2
@@ -155,6 +155,4 @@ int run_processes_parallel(int n, void *data, start_failure_fn, return_value_fn); -void run_processes_parallel_schedule_error (struct strbuf *err); -#endif
strbuf.h +5 -2
@@ -367,8 +367,11 @@ extern size_t strbuf_fread(struct strbuf *, size_t, FILE *);extern ssize_t strbuf_read (struct strbuf *,int fd,size_t hint);/** -* Same as strbuf_read, just returns non-blockingly by ignoring EAGAIN. -* The fd must have set O_NONBLOCK. +* Read from a file descriptor that is marked as O_NONBLOCK without +* blocking. Returns the number of new bytes appended to the sb. +* Negative return value signals there was an error returned from +* underlying read(2), in which case the caller should check errno. +* e.g. errno == EAGAIN when the read may have blocked. */ extern ssize_t strbuf_read_once (struct strbuf *,int fd,size_t hint);
submodule-config.c +35 -56
128 lines not on this page · raw message
submodule.c +3 -2
@@ -650,10 +650,12 @@ int fetch_populated_submodules(const struct argv_array *options, {int i;struct submodule_parallel_fetch spf =SPF_INIT ; + spf.work_tree =get_git_work_tree (); spf.command_line_option = command_line_option; spf.quiet = quiet; spf.prefix = prefix; +if (!spf.work_tree) goto out;
@@ -738,12 +740,11 @@ int get_next_submodule(void *data, struct child_process *cp,if (is_directory (git_dir)) {child_process_init (cp); cp->dir =strbuf_detach (&submodule_path,NULL ); + cp->env = local_repo_env; cp->git_cmd =1 ; - cp->no_stdout =1 ; cp->no_stdin =1 ; cp->stdout_to_stderr =1 ; cp->err =-1 ; - cp->env = local_repo_env;if (!spf->quiet)strbuf_addf (err,"Fetching submodule %s%s\n" , spf->prefix, ce->name);
wrapper.c +4 -10
@@ -206,16 +206,10 @@ ssize_t xread(int fd, void *buf, size_t len)continue ;if (errno ==EAGAIN || errno ==EWOULDBLOCK ) {struct pollfd pfd; -int i; pfd.events =POLLIN ; pfd.fd = fd; - i =poll (&pfd,1 ,100 ); -if (i <0 ) { -if (errno ==EINTR || errno ==ENOMEM ) -continue ; -else -die_errno ("poll" ); - } +/* We deliberately ignore the return value */ +poll (&pfd,1 ,-1 ); } }return nr;
@@ -225,13 +219,13 @@ ssize_t xread(int fd, void *buf, size_t len)/* * xread_nonblock() is the same a read(), but it automatically restarts read() * interrupted operations (EINTR). xread_nonblock() DOES NOT GUARANTEE that -* "len" bytes is read even if the data is available. +* "len" bytes is read. EWOULDBLOCK is turned into EAGAIN. */ ssize_t xread_nonblock (int fd,void *buf,size_t len) {ssize_t nr;if (len >MAX_IO_SIZE ) - len =MAX_IO_SIZE ; + len =MAX_IO_SIZE ;while (1 ) { nr =read (fd, buf, len);if (nr <0 ) {
Signature · 1 line
2.5.0.272.ga84127c.dirty