diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-19 12:42:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-19 05:38:07 +0200 |
commit | f986554b1e38d8dd40b4bf4748d4aeb470e27d2e (patch) | |
tree | 717cd724500741d6fb98c3fced30427ff6f7173a /lib/ntdb/transaction.c | |
parent | 9133a98c4425085dd86695bed1a48ec750a52430 (diff) | |
download | samba-f986554b1e38d8dd40b4bf4748d4aeb470e27d2e.tar.gz samba-f986554b1e38d8dd40b4bf4748d4aeb470e27d2e.tar.bz2 samba-f986554b1e38d8dd40b4bf4748d4aeb470e27d2e.zip |
ntdb: special accessor functions for read/write of an offset.
We also split off the NTDB_CONVERT case (where the ntdb is of a
different endian) into its own io function.
NTDB speed:
Adding 10000 records: 3894-9951(8553) ns (815528 bytes)
Finding 10000 records: 1644-4294(3580) ns (815528 bytes)
Missing 10000 records: 1497-4018(3303) ns (815528 bytes)
Traversing 10000 records: 1585-4225(3505) ns (815528 bytes)
Deleting 10000 records: 3088-8154(6927) ns (815528 bytes)
Re-adding 10000 records: 3192-8308(7089) ns (815528 bytes)
Appending 10000 records: 5187-13307(11365) ns (1274312 bytes)
Churning 10000 records: 6772-17567(15078) ns (1274312 bytes)
NTDB speed in transaction:
Adding 10000 records: 1602-2404(2214) ns (815528 bytes)
Finding 10000 records: 456-871(778) ns (815528 bytes)
Missing 10000 records: 393-522(503) ns (815528 bytes)
Traversing 10000 records: 729-1015(945) ns (815528 bytes)
Deleting 10000 records: 1065-1476(1374) ns (815528 bytes)
Re-adding 10000 records: 1397-1930(1819) ns (815528 bytes)
Appending 10000 records: 2927-3351(3184) ns (1274312 bytes)
Churning 10000 records: 3921-4697(4378) ns (1274312 bytes)
smbtorture results:
ntdb speed 86581-191518(175666) ops/sec
Applying patch..increase-top-level.patch
Diffstat (limited to 'lib/ntdb/transaction.c')
-rw-r--r-- | lib/ntdb/transaction.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/ntdb/transaction.c b/lib/ntdb/transaction.c index a265252174..9608be43e8 100644 --- a/lib/ntdb/transaction.c +++ b/lib/ntdb/transaction.c @@ -393,12 +393,35 @@ static void *transaction_direct(struct ntdb_context *ntdb, ntdb_off_t off, return ntdb->transaction->io_methods->direct(ntdb, off, len, false); } +static ntdb_off_t transaction_read_off(struct ntdb_context *ntdb, + ntdb_off_t off) +{ + ntdb_off_t ret; + enum NTDB_ERROR ecode; + + ecode = transaction_read(ntdb, off, &ret, sizeof(ret)); + ntdb_convert(ntdb, &ret, sizeof(ret)); + if (ecode != NTDB_SUCCESS) { + return NTDB_ERR_TO_OFF(ecode); + } + return ret; +} + +static enum NTDB_ERROR transaction_write_off(struct ntdb_context *ntdb, + ntdb_off_t off, ntdb_off_t val) +{ + ntdb_convert(ntdb, &val, sizeof(val)); + return transaction_write(ntdb, off, &val, sizeof(val)); +} + static const struct ntdb_methods transaction_methods = { transaction_read, transaction_write, transaction_oob, transaction_expand_file, transaction_direct, + transaction_read_off, + transaction_write_off, }; /* |