summaryrefslogtreecommitdiff
path: root/lib/ntdb/io.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-19 12:42:12 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-19 05:38:07 +0200
commit9133a98c4425085dd86695bed1a48ec750a52430 (patch)
treeb1195c6b7a1970ed71b8cca2770ea940b8cb79b2 /lib/ntdb/io.c
parentd938c0b591d9c4aff9c92ae5eedd26ed97455f42 (diff)
downloadsamba-9133a98c4425085dd86695bed1a48ec750a52430.tar.gz
samba-9133a98c4425085dd86695bed1a48ec750a52430.tar.bz2
samba-9133a98c4425085dd86695bed1a48ec750a52430.zip
ntdb: inline oob check
The simple "is it in range" check can be inline; complex cases can be handed through to the normal or transaction handler. NTDB speed: Adding 10000 records: 4111-9983(9149) ns (815528 bytes) Finding 10000 records: 1667-4464(3810) ns (815528 bytes) Missing 10000 records: 1511-3992(3546) ns (815528 bytes) Traversing 10000 records: 1698-4254(3724) ns (815528 bytes) Deleting 10000 records: 3608-7998(7358) ns (815528 bytes) Re-adding 10000 records: 3259-8504(7805) ns (815528 bytes) Appending 10000 records: 5393-13579(12356) ns (1274312 bytes) Churning 10000 records: 6966-17813(16136) ns (1274312 bytes) NTDB speed in transaction: Adding 10000 records: 916-2230(2004) ns (815528 bytes) Finding 10000 records: 330-866(770) ns (815528 bytes) Missing 10000 records: 196-520(471) ns (815528 bytes) Traversing 10000 records: 356-879(800) ns (815528 bytes) Deleting 10000 records: 505-1267(1108) ns (815528 bytes) Re-adding 10000 records: 658-1681(1477) ns (815528 bytes) Appending 10000 records: 1088-2827(2498) ns (1274312 bytes) Churning 10000 records: 1636-4267(3785) ns (1274312 bytes) smbtorture results: ntdb speed 85588-189430(157110) ops/sec
Diffstat (limited to 'lib/ntdb/io.c')
-rw-r--r--lib/ntdb/io.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/ntdb/io.c b/lib/ntdb/io.c
index b20141cc8f..138a405dda 100644
--- a/lib/ntdb/io.c
+++ b/lib/ntdb/io.c
@@ -92,8 +92,9 @@ enum NTDB_ERROR ntdb_mmap(struct ntdb_context *ntdb)
If probe is true, len being too large isn't a failure.
*/
-static enum NTDB_ERROR ntdb_oob(struct ntdb_context *ntdb,
- ntdb_off_t off, ntdb_len_t len, bool probe)
+static enum NTDB_ERROR ntdb_normal_oob(struct ntdb_context *ntdb,
+ ntdb_off_t off, ntdb_len_t len,
+ bool probe)
{
struct stat st;
enum NTDB_ERROR ecode;
@@ -112,8 +113,6 @@ static enum NTDB_ERROR ntdb_oob(struct ntdb_context *ntdb,
(long long)off, (long long)len);
}
- if (len + off <= ntdb->file->map_size)
- return NTDB_SUCCESS;
if (ntdb->flags & NTDB_INTERNAL) {
if (probe)
return NTDB_SUCCESS;
@@ -271,7 +270,7 @@ static enum NTDB_ERROR ntdb_write(struct ntdb_context *ntdb, ntdb_off_t off,
"Write to read-only database");
}
- ecode = ntdb->io->oob(ntdb, off, len, false);
+ ecode = ntdb_oob(ntdb, off, len, false);
if (ecode != NTDB_SUCCESS) {
return ecode;
}
@@ -305,7 +304,7 @@ static enum NTDB_ERROR ntdb_read(struct ntdb_context *ntdb, ntdb_off_t off,
{
enum NTDB_ERROR ecode;
- ecode = ntdb->io->oob(ntdb, off, len, false);
+ ecode = ntdb_oob(ntdb, off, len, false);
if (ecode != NTDB_SUCCESS) {
return ecode;
}
@@ -639,7 +638,7 @@ void ntdb_inc_seqnum(struct ntdb_context *ntdb)
static const struct ntdb_methods io_methods = {
ntdb_read,
ntdb_write,
- ntdb_oob,
+ ntdb_normal_oob,
ntdb_expand_file,
ntdb_direct,
};