aboutsummaryrefslogtreecommitdiff
path: root/drivers/md/dm-thin-metadata.c
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2012-07-27 15:08:14 +0100
committerAlasdair G Kergon <agk@redhat.com>2012-07-27 15:08:14 +0100
commit40db5a537655aa0b17a82a4b5596f8d27400edd8 (patch)
tree5e9d59aac1c42d949b47c962d4ee24b4287d23fa /drivers/md/dm-thin-metadata.c
parent66b1edc05e3f4c1227f51e40f2ead3e973c00cb0 (diff)
downloadlinaro-lsk-40db5a537655aa0b17a82a4b5596f8d27400edd8.tar.gz
dm thin metadata: add dm_thin_changed_this_transaction
Introduce dm_thin_changed_this_transaction to dm-thin-metadata to publish a useful bit of information we're already tracking. This will help dm thin decide when to commit. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-thin-metadata.c')
-rw-r--r--drivers/md/dm-thin-metadata.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 5ae31185e47..4f5b11c195f 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -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;