|
@@ -38,18 +38,17 @@ struct dm_transaction_manager *dm_tm_create_non_blocking_clone(struct dm_transac
|
|
/*
|
|
/*
|
|
* We use a 2-phase commit here.
|
|
* We use a 2-phase commit here.
|
|
*
|
|
*
|
|
- * i) In the first phase the block manager is told to start flushing, and
|
|
|
|
- * the changes to the space map are written to disk. You should interrogate
|
|
|
|
- * your particular space map to get detail of its root node etc. to be
|
|
|
|
- * included in your superblock.
|
|
|
|
|
|
+ * i) Make all changes for the transaction *except* for the superblock.
|
|
|
|
+ * Then call dm_tm_pre_commit() to flush them to disk.
|
|
*
|
|
*
|
|
- * ii) @root will be committed last. You shouldn't use more than the
|
|
|
|
- * first 512 bytes of @root if you wish the transaction to survive a power
|
|
|
|
- * failure. You *must* have a write lock held on @root for both stage (i)
|
|
|
|
- * and (ii). The commit will drop the write lock.
|
|
|
|
|
|
+ * ii) Lock your superblock. Update. Then call dm_tm_commit() which will
|
|
|
|
+ * unlock the superblock and flush it. No other blocks should be updated
|
|
|
|
+ * during this period. Care should be taken to never unlock a partially
|
|
|
|
+ * updated superblock; perform any operations that could fail *before* you
|
|
|
|
+ * take the superblock lock.
|
|
*/
|
|
*/
|
|
int dm_tm_pre_commit(struct dm_transaction_manager *tm);
|
|
int dm_tm_pre_commit(struct dm_transaction_manager *tm);
|
|
-int dm_tm_commit(struct dm_transaction_manager *tm, struct dm_block *root);
|
|
|
|
|
|
+int dm_tm_commit(struct dm_transaction_manager *tm, struct dm_block *superblock);
|
|
|
|
|
|
/*
|
|
/*
|
|
* These methods are the only way to get hold of a writeable block.
|
|
* These methods are the only way to get hold of a writeable block.
|