diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-07-06 04:06:23 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-07-08 02:38:36 +0300 |
commit | 609b8656910eccbb409b58050c306798be22a078 (patch) | |
tree | 200d54114b2ef8c53e0224da96fca7ab35fbc53b /source4/dsdb | |
parent | 0c4bbb7106cc2d49052eb85f995dc991b578d885 (diff) | |
download | samba-609b8656910eccbb409b58050c306798be22a078.tar.gz samba-609b8656910eccbb409b58050c306798be22a078.tar.bz2 samba-609b8656910eccbb409b58050c306798be22a078.zip |
s4-dsdb/util: Reorder DSDB_FLAG_* checks
On good thing about having more clear function interfaces
(and forcing callers to specify clearly what they want)
is that now I can execute following search:
git grep DSDB_FLAG_NEXT_MODULE | wc -l
This showed that DSDB_FLAG_NEXT_MODULE flag is about 6 times
more frequently used than DSDB_FLAG_OWN_MODULE.
So this should reduce branch prediction by six times
in this part of the code, right :)
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/util.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index 8797b106e7..bf260f99e4 100644 --- a/source4/dsdb/samdb/ldb_modules/util.c +++ b/source4/dsdb/samdb/ldb_modules/util.c @@ -72,14 +72,14 @@ int dsdb_module_search_dn(struct ldb_module *module, } /* Run the new request */ - if (dsdb_flags & DSDB_FLAG_OWN_MODULE) { - const struct ldb_module_ops *ops = ldb_module_get_ops(module); - ret = ops->modify(module, req); + if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) { + ret = ldb_next_request(module, req); } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) { ret = ldb_request(ldb_module_get_ctx(module), req); } else { - SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE); - ret = ldb_next_request(module, req); + const struct ldb_module_ops *ops = ldb_module_get_ops(module); + SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE); + ret = ops->modify(module, req); } if (ret == LDB_SUCCESS) { ret = ldb_wait(req->handle, LDB_WAIT_ALL); @@ -162,14 +162,14 @@ int dsdb_module_search(struct ldb_module *module, return ret; } - if (dsdb_flags & DSDB_FLAG_OWN_MODULE) { - const struct ldb_module_ops *ops = ldb_module_get_ops(module); - ret = ops->search(module, req); + if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) { + ret = ldb_next_request(module, req); } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) { ret = ldb_request(ldb_module_get_ctx(module), req); } else { - SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE); - ret = ldb_next_request(module, req); + const struct ldb_module_ops *ops = ldb_module_get_ops(module); + SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE); + ret = ops->search(module, req); } if (ret == LDB_SUCCESS) { ret = ldb_wait(req->handle, LDB_WAIT_ALL); @@ -292,14 +292,14 @@ int dsdb_module_modify(struct ldb_module *module, } /* Run the new request */ - if (dsdb_flags & DSDB_FLAG_OWN_MODULE) { - const struct ldb_module_ops *ops = ldb_module_get_ops(module); - ret = ops->modify(module, mod_req); + if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) { + ret = ldb_next_request(module, mod_req); } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) { ret = ldb_request(ldb_module_get_ctx(module), mod_req); } else { - SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE); - ret = ldb_next_request(module, mod_req); + const struct ldb_module_ops *ops = ldb_module_get_ops(module); + SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE); + ret = ops->modify(module, mod_req); } if (ret == LDB_SUCCESS) { ret = ldb_wait(mod_req->handle, LDB_WAIT_ALL); @@ -350,14 +350,14 @@ int dsdb_module_rename(struct ldb_module *module, } /* Run the new request */ - if (dsdb_flags & DSDB_FLAG_OWN_MODULE) { - const struct ldb_module_ops *ops = ldb_module_get_ops(module); - ret = ops->rename(module, req); + if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) { + ret = ldb_next_request(module, req); } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) { ret = ldb_request(ldb_module_get_ctx(module), req); } else { - SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE); - ret = ldb_next_request(module, req); + const struct ldb_module_ops *ops = ldb_module_get_ops(module); + SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE); + ret = ops->rename(module, req); } if (ret == LDB_SUCCESS) { ret = ldb_wait(req->handle, LDB_WAIT_ALL); @@ -405,14 +405,14 @@ int dsdb_module_add(struct ldb_module *module, } /* Run the new request */ - if (dsdb_flags & DSDB_FLAG_OWN_MODULE) { - const struct ldb_module_ops *ops = ldb_module_get_ops(module); - ret = ops->add(module, req); + if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) { + ret = ldb_next_request(module, req); } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) { ret = ldb_request(ldb_module_get_ctx(module), req); } else { - SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE); - ret = ldb_next_request(module, req); + const struct ldb_module_ops *ops = ldb_module_get_ops(module); + SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE); + ret = ops->add(module, req); } if (ret == LDB_SUCCESS) { ret = ldb_wait(req->handle, LDB_WAIT_ALL); @@ -460,14 +460,14 @@ int dsdb_module_del(struct ldb_module *module, } /* Run the new request */ - if (dsdb_flags & DSDB_FLAG_OWN_MODULE) { - const struct ldb_module_ops *ops = ldb_module_get_ops(module); - ret = ops->del(module, req); + if (dsdb_flags & DSDB_FLAG_NEXT_MODULE) { + ret = ldb_next_request(module, req); } else if (dsdb_flags & DSDB_FLAG_TOP_MODULE) { ret = ldb_request(ldb_module_get_ctx(module), req); } else { - SMB_ASSERT(dsdb_flags & DSDB_FLAG_NEXT_MODULE); - ret = ldb_next_request(module, req); + const struct ldb_module_ops *ops = ldb_module_get_ops(module); + SMB_ASSERT(dsdb_flags & DSDB_FLAG_OWN_MODULE); + ret = ops->del(module, req); } if (ret == LDB_SUCCESS) { ret = ldb_wait(req->handle, LDB_WAIT_ALL); |