r14763: Add a new tuning parameter, open files database hash size,
authorJeremy Allison <jra@samba.org>
Wed, 29 Mar 2006 22:19:01 +0000 (22:19 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:15:46 +0000 (11:15 -0500)
this allows us to experiment with ensuring the tdb hash
size for our open files and locking db are appropriately
sized. Make the hash size larger by default (10007 instead
of 1049) and make the locking db hash size the same as the
open file db hash size.
Jeremy.
(This used to be commit e7225f7e813423c3e2a94af6a9d7ce8a1b50a166)

source3/include/local.h
source3/locking/brlock.c
source3/locking/locking.c
source3/param/loadparm.c

index 916fb6e46d309703f6396ee67a496e9a2a670bfa..fb9319763626363d55027df410a0f6b9ecbef4e3 100644 (file)
 #define MAX_LDAP_REPLICATION_SLEEP_TIME 5000 /* In milliseconds. */
 
 /* tdb hash size for the open database. */
-#define SMB_OPEN_DATABASE_TDB_HASH_SIZE 1049
+#define SMB_OPEN_DATABASE_TDB_HASH_SIZE 10007
 
 /* Characters we disallow in sharenames. */
 #define INVALID_SHARENAME_CHARS "%<>*?|/\\+=;:\","
index 8af6effb191a169b93a7fdbd3966b5cf5a3439ac..5078515b3e9b1244446681faad29e387ad982762 100644 (file)
@@ -289,8 +289,10 @@ void brl_init(int read_only)
 {
        if (tdb)
                return;
-       tdb = tdb_open_log(lock_path("brlock.tdb"), 0,  TDB_DEFAULT|(read_only?0x0:TDB_CLEAR_IF_FIRST),
-                      read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644 );
+       tdb = tdb_open_log(lock_path("brlock.tdb"),
+                       lp_open_files_db_hash_size(),
+                       TDB_DEFAULT|(read_only?0x0:TDB_CLEAR_IF_FIRST),
+                       read_only?O_RDONLY:(O_RDWR|O_CREAT), 0644 );
        if (!tdb) {
                DEBUG(0,("Failed to open byte range locking database\n"));
                return;
index 5cb1f71555d6ac398dfcce4804476907e78c43be..0ecc90c794c8bc5a6426d852f916938873beb4d6 100644 (file)
@@ -301,7 +301,8 @@ BOOL locking_init(int read_only)
                return True;
 
        tdb = tdb_open_log(lock_path("locking.tdb"), 
-                       SMB_OPEN_DATABASE_TDB_HASH_SIZE, TDB_DEFAULT|(read_only?0x0:TDB_CLEAR_IF_FIRST), 
+                       lp_open_files_db_hash_size(),
+                       TDB_DEFAULT|(read_only?0x0:TDB_CLEAR_IF_FIRST), 
                        read_only?O_RDONLY:O_RDWR|O_CREAT,
                        0644);
 
index 13f585d8d0a6784dbe4f5f61ce2bc850e992750c..a80eda7a4efdec5e7996f07fe8a848ab5f2944fc 100644 (file)
@@ -201,6 +201,7 @@ typedef struct {
        int max_xmit;
        int max_mux;
        int max_open_files;
+       int open_files_db_hash_size;
        int pwordlevel;
        int unamelevel;
        int deadtime;
@@ -1023,6 +1024,7 @@ static struct parm_struct parm_table[] = {
        {"max disk size", P_INTEGER, P_GLOBAL, &Globals.maxdisksize, NULL, NULL, FLAG_ADVANCED}, 
        {"max open files", P_INTEGER, P_GLOBAL, &Globals.max_open_files, NULL, NULL, FLAG_ADVANCED}, 
        {"min print space", P_INTEGER, P_LOCAL, &sDefault.iMinPrintSpace, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT}, 
+       {"open files database hash size", P_INTEGER, P_GLOBAL, &Globals.open_files_db_hash_size, NULL, NULL, FLAG_ADVANCED}, 
 
        {"socket options", P_GSTRING, P_GLOBAL, user_socket_options, NULL, NULL, FLAG_ADVANCED}, 
        {"strict allocate", P_BOOL, P_LOCAL, &sDefault.bStrictAllocate, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE}, 
@@ -1498,6 +1500,7 @@ static void init_globals(BOOL first_time_only)
        Globals.bLargeReadwrite = True;
        Globals.max_log_size = 5000;
        Globals.max_open_files = MAX_OPEN_FILES;
+       Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
        Globals.maxprotocol = PROTOCOL_NT1;
        Globals.minprotocol = PROTOCOL_CORE;
        Globals.security = SEC_USER;
@@ -1938,6 +1941,7 @@ FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
+FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)