dm thin metadata: add dm_thin_changed_this_transaction
[pandora-kernel.git] / drivers / md / dm-thin-metadata.c
index 5ae3118..4f5b11c 100644 (file)
@@ -1375,10 +1375,9 @@ static int __insert(struct dm_thin_device *td, dm_block_t block,
        if (r)
                return r;
 
-       if (inserted) {
+       td->changed = 1;
+       if (inserted)
                td->mapped_blocks++;
-               td->changed = 1;
-       }
 
        return 0;
 }
@@ -1422,6 +1421,17 @@ int dm_thin_remove_block(struct dm_thin_device *td, dm_block_t block)
        return r;
 }
 
+bool dm_thin_changed_this_transaction(struct dm_thin_device *td)
+{
+       int r;
+
+       down_read(&td->pmd->root_lock);
+       r = td->changed;
+       up_read(&td->pmd->root_lock);
+
+       return r;
+}
+
 int dm_pool_alloc_data_block(struct dm_pool_metadata *pmd, dm_block_t *result)
 {
        int r;