diff options
author | Michael Adam <obnox@samba.org> | 2009-02-26 02:59:07 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-02-26 13:22:56 +0100 |
commit | 2f4b8213206aebd7b101b9623f7cd0786a65f310 (patch) | |
tree | d29869e4141189f38bfaf768d303075a7437855d /source3/registry | |
parent | 270ab5544b9e2a26e00ccb4e27e24996bf2e9238 (diff) | |
download | samba-2f4b8213206aebd7b101b9623f7cd0786a65f310.tar.gz samba-2f4b8213206aebd7b101b9623f7cd0786a65f310.tar.bz2 samba-2f4b8213206aebd7b101b9623f7cd0786a65f310.zip |
s3:registry: tighten the subkey loop in reg_deletekey_recursive()
and loop from the end to the beginning so that we don't need
to rehash the subkeys...
This gets "net conf drop" with 2000 shares down to 14 seconds
on my box.
Michael
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_api.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 3dc3bae6fe..67767a2e56 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -1062,6 +1062,7 @@ static WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx, WERROR werr = WERR_OK; struct registry_key *key; char *subkey_name = NULL; + uint32 i; mem_ctx = talloc_new(ctx); if (mem_ctx == NULL) { @@ -1075,25 +1076,21 @@ static WERROR reg_deletekey_recursive_internal(TALLOC_CTX *ctx, goto done; } - while (W_ERROR_IS_OK(werr = reg_enumkey(mem_ctx, key, 0, - &subkey_name, NULL))) - { + werr = fill_subkey_cache(key); + W_ERROR_NOT_OK_GOTO_DONE(werr); + + /* + * loop from top to bottom for perfomance: + * this way, we need to rehash the regsubkey containers less + */ + for (i = regsubkey_ctr_numkeys(key->subkeys) ; i > 0; i--) { + subkey_name = regsubkey_ctr_specific_key(key->subkeys, i-1); werr = reg_deletekey_recursive_internal(mem_ctx, key, - subkey_name, - true); - if (!W_ERROR_IS_OK(werr)) { - goto done; - } - } - if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { - DEBUG(1, ("reg_deletekey_recursive_internal: " - "Error enumerating subkeys: %s\n", - win_errstr(werr))); - goto done; + subkey_name, + true); + W_ERROR_NOT_OK_GOTO_DONE(werr); } - werr = WERR_OK; - if (del_key) { /* now delete the actual key */ werr = reg_deletekey(parent, path); |