diff options
-rw-r--r-- | drivers/md/persistent-data/dm-space-map-common.c | 12 | ||||
-rw-r--r-- | drivers/md/persistent-data/dm-space-map-common.h | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c index ff3beed6ad2d..d77602d63c83 100644 --- a/drivers/md/persistent-data/dm-space-map-common.c +++ b/drivers/md/persistent-data/dm-space-map-common.c | |||
@@ -224,6 +224,7 @@ static int sm_ll_init(struct ll_disk *ll, struct dm_transaction_manager *tm) | |||
224 | ll->nr_blocks = 0; | 224 | ll->nr_blocks = 0; |
225 | ll->bitmap_root = 0; | 225 | ll->bitmap_root = 0; |
226 | ll->ref_count_root = 0; | 226 | ll->ref_count_root = 0; |
227 | ll->bitmap_index_changed = false; | ||
227 | 228 | ||
228 | return 0; | 229 | return 0; |
229 | } | 230 | } |
@@ -476,7 +477,15 @@ int sm_ll_dec(struct ll_disk *ll, dm_block_t b, enum allocation_event *ev) | |||
476 | 477 | ||
477 | int sm_ll_commit(struct ll_disk *ll) | 478 | int sm_ll_commit(struct ll_disk *ll) |
478 | { | 479 | { |
479 | return ll->commit(ll); | 480 | int r = 0; |
481 | |||
482 | if (ll->bitmap_index_changed) { | ||
483 | r = ll->commit(ll); | ||
484 | if (!r) | ||
485 | ll->bitmap_index_changed = false; | ||
486 | } | ||
487 | |||
488 | return r; | ||
480 | } | 489 | } |
481 | 490 | ||
482 | /*----------------------------------------------------------------*/ | 491 | /*----------------------------------------------------------------*/ |
@@ -491,6 +500,7 @@ static int metadata_ll_load_ie(struct ll_disk *ll, dm_block_t index, | |||
491 | static int metadata_ll_save_ie(struct ll_disk *ll, dm_block_t index, | 500 | static int metadata_ll_save_ie(struct ll_disk *ll, dm_block_t index, |
492 | struct disk_index_entry *ie) | 501 | struct disk_index_entry *ie) |
493 | { | 502 | { |
503 | ll->bitmap_index_changed = true; | ||
494 | memcpy(ll->mi_le.index + index, ie, sizeof(*ie)); | 504 | memcpy(ll->mi_le.index + index, ie, sizeof(*ie)); |
495 | return 0; | 505 | return 0; |
496 | } | 506 | } |
diff --git a/drivers/md/persistent-data/dm-space-map-common.h b/drivers/md/persistent-data/dm-space-map-common.h index 8f220821a9a9..b3078d5eda0c 100644 --- a/drivers/md/persistent-data/dm-space-map-common.h +++ b/drivers/md/persistent-data/dm-space-map-common.h | |||
@@ -78,6 +78,7 @@ struct ll_disk { | |||
78 | open_index_fn open_index; | 78 | open_index_fn open_index; |
79 | max_index_entries_fn max_entries; | 79 | max_index_entries_fn max_entries; |
80 | commit_fn commit; | 80 | commit_fn commit; |
81 | bool bitmap_index_changed:1; | ||
81 | }; | 82 | }; |
82 | 83 | ||
83 | struct disk_sm_root { | 84 | struct disk_sm_root { |