From b46bcdc5ab62756dc71c48871c03eb312282dcac Mon Sep 17 00:00:00 2001 From: slioch Date: Sat, 10 Oct 2009 23:24:15 -0700 Subject: performance optimization on commit. On successful commits (i.e. no failures) will improve performance by avoiding the piecewise priority based copy and just copy the complete configuration once. On specific test configuration performance improvement brought commit boot time down from >15 minutes to less than 10 minutes. --- src/commit2.c | 11 ++++++----- src/common/common.h | 2 +- src/common/unionfs.c | 17 +++++++++++++++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/commit2.c b/src/commit2.c index 4215ccc..42f2ce5 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -284,14 +284,15 @@ main(int argc, char** argv) } while ((trans_child_node = (GNode*)g_node_nth_child((GNode*)trans_coll,(guint)i)) != NULL); if (no_errors == TRUE) { - if (disable_partial_commit == TRUE && g_dump_actions == FALSE) { - completed_root_node_coll = g_slist_append(completed_root_node_coll,orig_node_tree); - } + // if (disable_partial_commit == TRUE && g_dump_actions == FALSE) { + // completed_root_node_coll = g_slist_append(completed_root_node_coll,orig_node_tree); + // } /* * Need to add to the following func below to clean up dangling .wh. files */ if (g_dump_actions == FALSE) { - complete(completed_root_node_coll, test_mode); + // complete(orig_node_tree, test_mode); + common_commit_copy_to_live_config(orig_node_tree, TRUE, test_mode); common_commit_clean_temp_config(orig_node_tree, test_mode); } if (g_debug == TRUE) { @@ -510,7 +511,7 @@ complete(GSList *node_coll, boolean test_mode) } } //on transactional nodes only, note to avoid calling this if a headless root - common_commit_copy_to_live_config(l->data, test_mode); + common_commit_copy_to_live_config(l->data, FALSE, test_mode); } return TRUE; } diff --git a/src/common/common.h b/src/common/common.h index 06e3a9e..8b46498 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -42,7 +42,7 @@ common_set_parent_context(char *cpath, char *dpath); * **/ void -common_commit_copy_to_live_config(GNode *root_node, boolean test_mode); +common_commit_copy_to_live_config(GNode *root_node, boolean suppress_piecewise_copy, boolean test_mode); /** * diff --git a/src/common/unionfs.c b/src/common/unionfs.c index b053d80..c428dfa 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -605,7 +605,7 @@ set_path(char *path, boolean config) * **/ void -common_commit_copy_to_live_config(GNode *node, boolean test_mode) +common_commit_copy_to_live_config(GNode *node, boolean suppress_piecewise_copy, boolean test_mode) { //first check for existence of path before committing char *path = ((struct VyattaNode*)(node->data))->_data._path; @@ -689,7 +689,20 @@ common_commit_copy_to_live_config(GNode *node, boolean test_mode) system(command); } - piecewise_copy(node, test_mode); + if (suppress_piecewise_copy) { + sprintf(command, format1, tbuf_root, abuf_root); + if (g_debug) { + printf("%s\n",command); + syslog(LOG_DEBUG,"%s\n",command); + fflush(NULL); + } + if (test_mode == FALSE) { + system(command); + } + } + else { + piecewise_copy(node, test_mode); + } sprintf(command, format8, cbuf_root,abuf_root,mbuf_root); if (g_debug) { -- cgit v1.2.3