[SCM] Samba Shared Repository - branch v4-0-test updated -
release-4-0-0alpha2-641-gdf4efb9
Andrew Tridgell
tridge at samba.org
Thu Feb 7 12:07:40 GMT 2008
The branch, v4-0-test has been updated
via df4efb902ec5053ae9d7c6e4fd1e21255ca66914 (commit)
via f4b363d7a65023c816264b58d6f3f07730b43c0c (commit)
from 3f2edcc341e5b0e4369e8f601ef0cb6ecf73b4c7 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test
- Log -----------------------------------------------------------------
commit df4efb902ec5053ae9d7c6e4fd1e21255ca66914
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu Feb 7 23:06:44 2008 +1100
merge growing tdb for tdb_wipe_all() fix from ctdb
commit f4b363d7a65023c816264b58d6f3f07730b43c0c
Author: Andrew Tridgell <tridge at samba.org>
Date: Thu Feb 7 23:05:44 2008 +1100
make the multiplier in the RAW-OFFLINE test settable
-----------------------------------------------------------------------
Summary of changes:
source/lib/tdb/common/tdb.c | 43 ++++++++++++++++++++++++++++++++++++++++++
source/torture/raw/offline.c | 3 +-
2 files changed, 45 insertions(+), 1 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/lib/tdb/common/tdb.c b/source/lib/tdb/common/tdb.c
index ea5d9cc..a25c3e7 100644
--- a/source/lib/tdb/common/tdb.c
+++ b/source/lib/tdb/common/tdb.c
@@ -696,11 +696,31 @@ int tdb_wipe_all(struct tdb_context *tdb)
int i;
tdb_off_t offset = 0;
ssize_t data_len;
+ tdb_off_t recovery_head;
+ tdb_len_t recovery_size = 0;
if (tdb_lockall(tdb) != 0) {
return -1;
}
+ /* see if the tdb has a recovery area, and remember its size
+ if so. We don't want to lose this as otherwise each
+ tdb_wipe_all() in a transaction will increase the size of
+ the tdb by the size of the recovery area */
+ if (tdb_ofs_read(tdb, TDB_RECOVERY_HEAD, &recovery_head) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_wipe_all: failed to read recovery head\n"));
+ goto failed;
+ }
+
+ if (recovery_head != 0) {
+ struct list_struct rec;
+ if (tdb->methods->tdb_read(tdb, recovery_head, &rec, sizeof(rec), DOCONV()) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_wipe_all: failed to read recovery record\n"));
+ return -1;
+ }
+ recovery_size = rec.rec_len + sizeof(rec);
+ }
+
/* wipe the hashes */
for (i=0;i<tdb->header.hash_size;i++) {
if (tdb_ofs_write(tdb, TDB_HASH_TOP(i), &offset) == -1) {
@@ -722,6 +742,11 @@ int tdb_wipe_all(struct tdb_context *tdb)
/* add all the rest of the file to the freelist */
data_len = (tdb->map_size - TDB_DATA_START(tdb->header.hash_size)) - sizeof(struct list_struct);
+ if (data_len < recovery_size+sizeof(tdb_off_t)) {
+ recovery_size = 0;
+ } else {
+ data_len -= recovery_size;
+ }
if (data_len > 0) {
struct list_struct rec;
memset(&rec,'\0',sizeof(rec));
@@ -732,6 +757,24 @@ int tdb_wipe_all(struct tdb_context *tdb)
}
}
+ /* possibly add the recovery record */
+ if (recovery_size != 0) {
+ struct list_struct rec;
+
+ recovery_head = tdb->map_size - recovery_size;
+
+ ZERO_STRUCT(rec);
+ rec.rec_len = recovery_size - sizeof(rec);
+ if (tdb_rec_write(tdb, recovery_head, &rec) != 0) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to add recovery record\n"));
+ goto failed;
+ }
+ if (tdb_ofs_write(tdb, TDB_RECOVERY_HEAD, &recovery_head) == -1) {
+ TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to write recovery head\n"));
+ goto failed;
+ }
+ }
+
if (tdb_unlockall(tdb) != 0) {
TDB_LOG((tdb, TDB_DEBUG_FATAL,"tdb_wipe_all: failed to unlock\n"));
goto failed;
diff --git a/source/torture/raw/offline.c b/source/torture/raw/offline.c
index 754185e..1340692 100644
--- a/source/torture/raw/offline.c
+++ b/source/torture/raw/offline.c
@@ -42,6 +42,7 @@ static int numstates;
static int num_connected;
static int test_failed;
extern int torture_numops;
+extern int torture_entries;
static bool test_finished;
enum offline_op {OP_LOADFILE, OP_SAVEFILE, OP_SETOFFLINE, OP_GETOFFLINE, OP_ENDOFLIST};
@@ -395,7 +396,7 @@ bool torture_test_offline(struct torture_context *torture)
progress = torture_setting_bool(torture, "progress", true);
nconnections = torture_setting_int(torture, "nprocs", 4);
- numstates = nconnections * 5;
+ numstates = nconnections * torture_entries;
state = talloc_zero_array(mem_ctx, struct offline_state, numstates);
--
Samba Shared Repository
More information about the samba-cvs
mailing list