diff options
author | Joe Thornber <ejt@redhat.com> | 2012-07-27 10:08:14 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2012-07-27 10:08:14 -0400 |
commit | 40db5a537655aa0b17a82a4b5596f8d27400edd8 (patch) | |
tree | 5e9d59aac1c42d949b47c962d4ee24b4287d23fa /drivers/md | |
parent | 66b1edc05e3f4c1227f51e40f2ead3e973c00cb0 (diff) |
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')
-rw-r--r-- | drivers/md/dm-thin-metadata.c | 16 | ||||
-rw-r--r-- | drivers/md/dm-thin-metadata.h | 2 |
2 files changed, 15 insertions, 3 deletions
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index 5ae31185e47c..4f5b11c195f4 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, | |||
1375 | if (r) | 1375 | if (r) |
1376 | return r; | 1376 | return r; |
1377 | 1377 | ||
1378 | if (inserted) { | 1378 | td->changed = 1; |
1379 | if (inserted) | ||
1379 | td->mapped_blocks++; | 1380 | td->mapped_blocks++; |
1380 | td->changed = 1; | ||
1381 | } | ||
1382 | 1381 | ||
1383 | return 0; | 1382 | return 0; |
1384 | } | 1383 | } |
@@ -1422,6 +1421,17 @@ int dm_thin_remove_block(struct dm_thin_device *td, dm_block_t block) | |||
1422 | return r; | 1421 | return r; |
1423 | } | 1422 | } |
1424 | 1423 | ||
1424 | bool dm_thin_changed_this_transaction(struct dm_thin_device *td) | ||
1425 | { | ||
1426 | int r; | ||
1427 | |||
1428 | down_read(&td->pmd->root_lock); | ||
1429 | r = td->changed; | ||
1430 | up_read(&td->pmd->root_lock); | ||
1431 | |||
1432 | return r; | ||
1433 | } | ||
1434 | |||
1425 | int dm_pool_alloc_data_block(struct dm_pool_metadata *pmd, dm_block_t *result) | 1435 | int dm_pool_alloc_data_block(struct dm_pool_metadata *pmd, dm_block_t *result) |
1426 | { | 1436 | { |
1427 | int r; | 1437 | int r; |
diff --git a/drivers/md/dm-thin-metadata.h b/drivers/md/dm-thin-metadata.h index 7e6656c49bd5..1632fec1660d 100644 --- a/drivers/md/dm-thin-metadata.h +++ b/drivers/md/dm-thin-metadata.h | |||
@@ -148,6 +148,8 @@ int dm_thin_remove_block(struct dm_thin_device *td, dm_block_t block); | |||
148 | /* | 148 | /* |
149 | * Queries. | 149 | * Queries. |
150 | */ | 150 | */ |
151 | bool dm_thin_changed_this_transaction(struct dm_thin_device *td); | ||
152 | |||
151 | int dm_thin_get_highest_mapped_block(struct dm_thin_device *td, | 153 | int dm_thin_get_highest_mapped_block(struct dm_thin_device *td, |
152 | dm_block_t *highest_mapped); | 154 | dm_block_t *highest_mapped); |
153 | 155 | ||