atomic->success = FALSE;
}
+void mdbox_map_atomic_set_success(struct mdbox_map_atomic_context *atomic)
+{
+ atomic->success = TRUE;
+}
+
int mdbox_map_atomic_finish(struct mdbox_map_atomic_context **_atomic)
{
struct mdbox_map_atomic_context *atomic = *_atomic;
/* When finish() is called, rollback the changes. If data was already written
to map's transaction log, this desyncs the map and causes a rebuild */
void mdbox_map_atomic_set_failed(struct mdbox_map_atomic_context *atomic);
+/* Mark this atomic as having succeeded. This is internally done if
+ transaction or append is committed within this atomic, but not when the
+ atomic is used standalone. */
+void mdbox_map_atomic_set_success(struct mdbox_map_atomic_context *atomic);
/* Commit/rollback changes within this atomic context. */
int mdbox_map_atomic_finish(struct mdbox_map_atomic_context **atomic);
atomic = mdbox_map_atomic_begin(storage->map);
ret = mdbox_storage_rebuild_in_context(storage, atomic);
+ mdbox_map_atomic_set_success(atomic);
if (mdbox_map_atomic_finish(&atomic) < 0)
ret = -1;
return ret;
ret = mdbox_sync_begin(mbox, flags, atomic, &sync_ctx);
if (ret == 0 && sync_ctx != NULL)
ret = mdbox_sync_finish(&sync_ctx, TRUE);
+ if (ret == 0)
+ mdbox_map_atomic_set_success(atomic);
if (mdbox_map_atomic_finish(&atomic) < 0)
ret = -1;
return ret;