]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb/transaction.c
Use -O not -O3: reduces ccan/tdb test time from 24 to 18 seconds.
[ccan] / ccan / tdb / transaction.c
index 988296372c578bde1f04311e7f25aa66caa1ea4b..34137251bce51f2697184fbd8dc515315b9d64c6 100644 (file)
@@ -144,14 +144,6 @@ static int transaction_read(struct tdb_context *tdb, tdb_off_t off, void *buf,
 {
        uint32_t blk;
 
-       /* Only a commit is allowed on a prepared transaction */
-       if (tdb->transaction->prepared) {
-               tdb->ecode = TDB_ERR_EINVAL;
-               TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_read: transaction already prepared, read not allowed\n"));
-               tdb->transaction->transaction_error = 1;
-               return -1;
-       }
-
        /* break it down into block sized ops */
        while (len + (off % tdb->transaction->block_size) > tdb->transaction->block_size) {
                tdb_len_t len2 = tdb->transaction->block_size - (off % tdb->transaction->block_size);
@@ -927,11 +919,6 @@ static int _tdb_transaction_prepare_commit(struct tdb_context *tdb)
                return 0;
        }               
 
-#ifdef TDB_TRACE
-       /* store seqnum now, before reading becomes illegal. */
-       tdb_ofs_read(tdb, TDB_SEQNUM_OFS, &tdb->transaction_prepare_seqnum);
-#endif
-
        /* check for a null transaction */
        if (tdb->transaction->blocks == NULL) {
                return 0;
@@ -1020,13 +1007,7 @@ int tdb_transaction_commit(struct tdb_context *tdb)
                return -1;
        }
 
-       /* If we've prepared, can't read seqnum. */
-       if (tdb->transaction->prepared) {
-               tdb_trace_seqnum(tdb, tdb->transaction_prepare_seqnum,
-                                "tdb_transaction_commit");
-       } else {
-               tdb_trace(tdb, "tdb_transaction_commit");
-       }
+       tdb_trace(tdb, "tdb_transaction_commit");
 
        if (tdb->transaction->transaction_error) {
                tdb->ecode = TDB_ERR_IO;