]> arthur.barton.de Git - netatalk.git/commitdiff
Merge from branch 2-1
authorFrank Lahm <franklahm@googlemail.com>
Fri, 15 Apr 2011 19:29:22 +0000 (21:29 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Fri, 15 Apr 2011 19:29:22 +0000 (21:29 +0200)
1  2 
etc/cnid_dbd/cmd_dbd.c
etc/cnid_dbd/cmd_dbd_scanvol.c
etc/cnid_dbd/db_param.h
etc/cnid_dbd/dbif.c
etc/cnid_dbd/dbif.h

index 5c29e19ca8fc6be1af70a8b1f8be2b4bff493e57,59d5e6072d51905ac5f1f92e21e675008a8f28a4..532b7b8a6bd3b67d3966e374185ea83f02e91b04
@@@ -91,16 -90,15 +91,17 @@@ static struct db_param db_param = 
      NULL,                       /* Volume dirpath */
      1,                          /* bdb logfile autoremove */
      64 * 1024,                  /* bdb cachesize (64 MB) */
-     -1,                         /* not used ... */
-     -1,
-     "",
-     -1,
-     -1,
-     -1
 +    DEFAULT_MAXLOCKS,           /* maxlocks */
 +    DEFAULT_MAXLOCKOBJS,        /* maxlockobjs */
+     0,                          /* flush_interval */
+     0,                          /* flush_frequency */
+     1000,                       /* txn_frequency */
+     0,                          /* usock_file */
+     -1,                         /* fd_table_size */
+     -1,                         /* idle_timeout */
+     -1                          /* max_vols */
  };
 -static char dbpath[PATH_MAX];   /* Path to the dbd database */
 +static char dbpath[MAXPATHLEN+1];   /* Path to the dbd database */
  
  /* 
     Provide some logging
index f263329df364ddcb9185ce65601cd68de4560009,dcecf5fee2c0904f1ded8285be06988bfe7963da..0f105dd580e6e5db53f63bc1bd03e070e1f5c7ac
@@@ -673,10 -675,21 +673,21 @@@ static cnid_t check_cnid(const char *na
      cnid_t db_cnid, ad_cnid;
      struct adouble ad;
  
+     /* Force checkout every X items */
+     static int cnidcount = 0;
+     cnidcount++;
+     if (cnidcount > 10000) {
+         cnidcount = 0;
+         if (dbif_txn_checkpoint(dbd, 0, 0, 0) < 0) {
+             dbd_log(LOGSTD, "Error checkpointing!");
+             return 0;
+         }
+     }
      /* Get CNID from ad-file if volume is using AFPVOL_CACHE */
      ad_cnid = 0;
 -    if ( (volinfo->v_flags & AFPVOL_CACHE) && ADFILE_OK) {
 -        ad_init(&ad, volinfo->v_adouble, volinfo->v_ad_options);
 +    if ( (myvolinfo->v_flags & AFPVOL_CACHE) && ADFILE_OK) {
 +        ad_init(&ad, myvolinfo->v_adouble, myvolinfo->v_ad_options);
          if (ad_open_metadata( name, adflags, O_RDWR, &ad) != 0) {
              
              if (dbd_flags & DBD_FLAGS_CLEANUP)
@@@ -1127,12 -1146,9 +1153,9 @@@ static void delete_orphaned_cnids(DBD *
              dbd_log(LOGSTD, "Ghost CNID: %u. This is fatal! Dumping rebuild db:\n", rebuild_cnid);
              dbif_dump(dbd_rebuild, 0);
              dbd_log(LOGSTD, "Send this dump and a `dbd -d ...` dump to the Netatalk Dev team!");
-             dbif_txn_close(dbd, ret);
-             dbif_idwalk(dbd, NULL, 1); /* Close cursor */
-             dbif_idwalk(dbd_rebuild, NULL, 1); /* Close cursor */
              goto cleanup;
          }
 -    }
 +    } /* while ((dbif_idwalk(dbd, &dbd_cnid, 0)) == 1) */
  
  cleanup:
      dbif_idwalk(dbd, NULL, 1); /* Close cursor */
@@@ -1160,9 -1176,9 +1183,11 @@@ int cmd_dbd_scanvol(DBD *dbd_ref, struc
      const char *tmpdb_path = NULL;
  
      /* Set cachesize for in-memory rebuild db */
 -    db_param.cachesize = 128 * 1024 * 1024; /* 128 MB */
 +    db_param.cachesize = 128 * 1024; /* 128 MB */
 +    db_param.maxlocks = DEFAULT_MAXLOCKS;
 +    db_param.maxlockobjs = DEFAULT_MAXLOCKOBJS;
+     db_param.txn_frequency = 1000;          /* close txn every 1000 objects */
+     db_param.logfile_autoremove = 1;
  
      /* Make it accessible for all funcs */
      dbd = dbd_ref;
index f3a4827a031a5f99e5fa055c2232d228539024f2,f1b188c18576fb968abbabd9e719a396cec27196..302b16db93632b6f7617eeafbd635fb97926ea95
@@@ -24,10 -20,9 +24,11 @@@ struct db_param 
      char *dir;
      int logfile_autoremove;
      int cachesize;              /* in KB */
 +    int maxlocks;
 +    int maxlockobjs;
      int flush_interval;
      int flush_frequency;
+     int txn_frequency;
      char usock_file[MAXPATHLEN + 1];    
      int fd_table_size;
      int idle_timeout;
Simple merge
Simple merge