mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
tdb: Speed up tdb_oob()
This is common between both implementations of tdb_oob(). It's faster if we don't have to dereference function pointers. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
5a388453e0
commit
897bffa816
@ -150,6 +150,11 @@ static int tdb_notrans_oob(
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* This duplicates functionality from tdb_oob(). Don't remove:
|
||||
* we still have direct callers of tdb->methods->tdb_oob()
|
||||
* inside transaction.c.
|
||||
*/
|
||||
if (off + len <= tdb->map_size)
|
||||
return 0;
|
||||
if (tdb->flags & TDB_INTERNAL) {
|
||||
@ -664,7 +669,13 @@ int tdb_expand(struct tdb_context *tdb, tdb_off_t size)
|
||||
|
||||
int tdb_oob(struct tdb_context *tdb, tdb_off_t off, tdb_len_t len, int probe)
|
||||
{
|
||||
int ret = tdb->methods->tdb_oob(tdb, off, len, probe);
|
||||
int ret;
|
||||
|
||||
if (likely((off + len >= off) && (off + len <= tdb->map_size))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = tdb->methods->tdb_oob(tdb, off, len, probe);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -378,6 +378,11 @@ static void transaction_next_hash_chain(struct tdb_context *tdb, uint32_t *chain
|
||||
static int transaction_oob(struct tdb_context *tdb, tdb_off_t off,
|
||||
tdb_len_t len, int probe)
|
||||
{
|
||||
/*
|
||||
* This duplicates functionality from tdb_oob(). Don't remove:
|
||||
* we still have direct callers of tdb->methods->tdb_oob()
|
||||
* inside transaction.c.
|
||||
*/
|
||||
if (off + len >= off && off + len <= tdb->map_size) {
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user