diff options
Diffstat (limited to 'drivers/md/persistent-data')
| -rw-r--r-- | drivers/md/persistent-data/dm-space-map-metadata.c | 2 | ||||
| -rw-r--r-- | drivers/md/persistent-data/dm-space-map-metadata.h | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c index 536782e3bcb7..e9bdd462f4f5 100644 --- a/drivers/md/persistent-data/dm-space-map-metadata.c +++ b/drivers/md/persistent-data/dm-space-map-metadata.c | |||
| @@ -680,6 +680,8 @@ int dm_sm_metadata_create(struct dm_space_map *sm, | |||
| 680 | if (r) | 680 | if (r) |
| 681 | return r; | 681 | return r; |
| 682 | 682 | ||
| 683 | if (nr_blocks > DM_SM_METADATA_MAX_BLOCKS) | ||
| 684 | nr_blocks = DM_SM_METADATA_MAX_BLOCKS; | ||
| 683 | r = sm_ll_extend(&smm->ll, nr_blocks); | 685 | r = sm_ll_extend(&smm->ll, nr_blocks); |
| 684 | if (r) | 686 | if (r) |
| 685 | return r; | 687 | return r; |
diff --git a/drivers/md/persistent-data/dm-space-map-metadata.h b/drivers/md/persistent-data/dm-space-map-metadata.h index 39bba0801cf2..64df923974d8 100644 --- a/drivers/md/persistent-data/dm-space-map-metadata.h +++ b/drivers/md/persistent-data/dm-space-map-metadata.h | |||
| @@ -9,6 +9,17 @@ | |||
| 9 | 9 | ||
| 10 | #include "dm-transaction-manager.h" | 10 | #include "dm-transaction-manager.h" |
| 11 | 11 | ||
| 12 | #define DM_SM_METADATA_BLOCK_SIZE (4096 >> SECTOR_SHIFT) | ||
| 13 | |||
| 14 | /* | ||
| 15 | * The metadata device is currently limited in size. | ||
| 16 | * | ||
| 17 | * We have one block of index, which can hold 255 index entries. Each | ||
| 18 | * index entry contains allocation info about ~16k metadata blocks. | ||
| 19 | */ | ||
| 20 | #define DM_SM_METADATA_MAX_BLOCKS (255 * ((1 << 14) - 64)) | ||
| 21 | #define DM_SM_METADATA_MAX_SECTORS (DM_SM_METADATA_MAX_BLOCKS * DM_SM_METADATA_BLOCK_SIZE) | ||
| 22 | |||
| 12 | /* | 23 | /* |
| 13 | * Unfortunately we have to use two-phase construction due to the cycle | 24 | * Unfortunately we have to use two-phase construction due to the cycle |
| 14 | * between the tm and sm. | 25 | * between the tm and sm. |
