summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-02-07 13:26:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:48 -0500
commit08bf58d8fcd69f58489f8d3932d60dbd44d6d662 (patch)
treec382d4c1db04defd283c1bcaa6024449aded547c /source3/registry
parent0854e562282acde8d78fee1609f1291fecdf5755 (diff)
downloadsamba-08bf58d8fcd69f58489f8d3932d60dbd44d6d662.tar.gz
samba-08bf58d8fcd69f58489f8d3932d60dbd44d6d662.tar.bz2
samba-08bf58d8fcd69f58489f8d3932d60dbd44d6d662.zip
r21219: Speed up the initial startup time of smbd on systems with loaded disk
subsystems. See the comment in the diff. Volker (This used to be commit 92fdb1193de8e7c857603e4fcd4a92b9a0a0f3bd)
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_db.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c
index 345193716e..57a8e6ce0d 100644
--- a/source3/registry/reg_db.c
+++ b/source3/registry/reg_db.c
@@ -98,6 +98,20 @@ static BOOL init_registry_data( void )
int i;
const char *p, *p2;
UNISTR2 data;
+
+ /*
+ * There are potentially quite a few store operations which are all
+ * indiviually wrapped in tdb transactions. Wrapping them in a single
+ * transaction gives just a single transaction_commit() to actually do
+ * its fsync()s. See tdb/common/transaction.c for info about nested
+ * transaction behaviour.
+ */
+
+ if ( tdb_transaction_start( tdb_reg ) == -1 ) {
+ DEBUG(0, ("init_registry_data: tdb_transaction_start "
+ "failed\n"));
+ return False;
+ }
/* loop over all of the predefined paths and add each component */
@@ -137,14 +151,14 @@ static BOOL init_registry_data( void )
if ( !(subkeys = TALLOC_ZERO_P( NULL, REGSUBKEY_CTR )) ) {
DEBUG(0,("talloc() failure!\n"));
- return False;
+ goto fail;
}
regdb_fetch_keys( base, subkeys );
if ( *subkeyname )
regsubkey_ctr_addkey( subkeys, subkeyname );
if ( !regdb_store_keys( base, subkeys ))
- return False;
+ goto fail;
TALLOC_FREE( subkeys );
}
@@ -155,7 +169,7 @@ static BOOL init_registry_data( void )
for ( i=0; builtin_registry_values[i].path != NULL; i++ ) {
if ( !(values = TALLOC_ZERO_P( NULL, REGVAL_CTR )) ) {
DEBUG(0,("talloc() failure!\n"));
- return False;
+ goto fail;
}
regdb_fetch_values( builtin_registry_values[i].path, values );
@@ -192,7 +206,22 @@ static BOOL init_registry_data( void )
TALLOC_FREE( values );
}
+ if (tdb_transaction_commit( tdb_reg ) == -1) {
+ DEBUG(0, ("init_registry_data: Could not commit "
+ "transaction\n"));
+ return False;
+ }
+
return True;
+
+ fail:
+
+ if (tdb_transaction_cancel( tdb_reg ) == -1) {
+ smb_panic("init_registry_data: tdb_transaction_cancel "
+ "failed\n");
+ }
+
+ return False;
}
/***********************************************************************