dm cache metadata: use dm-space-map-metadata.h defined size limits
Commit 7d48935e cleaned up the persistent-data's space-map-metadata limits by elevating them to dm-space-map-metadata.h. Update dm-cache-metadata to use these same limits. The calculation for DM_CACHE_METADATA_MAX_SECTORS didn't account for the sizeof the disk_bitmap_header. So the supported maximum metadata size is a bit smaller (reduced from 33423360 to 33292800 sectors). Signed-off-by: Mike Snitzer <snitzer@redhat.com> Acked-by: Joe Thornber <ejt@redhat.com>
This commit is contained in:
parent
304affaa88
commit
895b47d798
@ -330,7 +330,7 @@ static int __write_initial_superblock(struct dm_cache_metadata *cmd)
|
|||||||
disk_super->discard_root = cpu_to_le64(cmd->discard_root);
|
disk_super->discard_root = cpu_to_le64(cmd->discard_root);
|
||||||
disk_super->discard_block_size = cpu_to_le64(cmd->discard_block_size);
|
disk_super->discard_block_size = cpu_to_le64(cmd->discard_block_size);
|
||||||
disk_super->discard_nr_blocks = cpu_to_le64(from_oblock(cmd->discard_nr_blocks));
|
disk_super->discard_nr_blocks = cpu_to_le64(from_oblock(cmd->discard_nr_blocks));
|
||||||
disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT);
|
disk_super->metadata_block_size = cpu_to_le32(DM_CACHE_METADATA_BLOCK_SIZE);
|
||||||
disk_super->data_block_size = cpu_to_le32(cmd->data_block_size);
|
disk_super->data_block_size = cpu_to_le32(cmd->data_block_size);
|
||||||
disk_super->cache_blocks = cpu_to_le32(0);
|
disk_super->cache_blocks = cpu_to_le32(0);
|
||||||
|
|
||||||
@ -478,7 +478,7 @@ static int __create_persistent_data_objects(struct dm_cache_metadata *cmd,
|
|||||||
bool may_format_device)
|
bool may_format_device)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
cmd->bm = dm_block_manager_create(cmd->bdev, DM_CACHE_METADATA_BLOCK_SIZE,
|
cmd->bm = dm_block_manager_create(cmd->bdev, DM_CACHE_METADATA_BLOCK_SIZE << SECTOR_SHIFT,
|
||||||
CACHE_METADATA_CACHE_SIZE,
|
CACHE_METADATA_CACHE_SIZE,
|
||||||
CACHE_MAX_CONCURRENT_LOCKS);
|
CACHE_MAX_CONCURRENT_LOCKS);
|
||||||
if (IS_ERR(cmd->bm)) {
|
if (IS_ERR(cmd->bm)) {
|
||||||
|
@ -9,19 +9,17 @@
|
|||||||
|
|
||||||
#include "dm-cache-block-types.h"
|
#include "dm-cache-block-types.h"
|
||||||
#include "dm-cache-policy-internal.h"
|
#include "dm-cache-policy-internal.h"
|
||||||
|
#include "persistent-data/dm-space-map-metadata.h"
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
|
|
||||||
#define DM_CACHE_METADATA_BLOCK_SIZE 4096
|
#define DM_CACHE_METADATA_BLOCK_SIZE DM_SM_METADATA_BLOCK_SIZE
|
||||||
|
|
||||||
/* FIXME: remove this restriction */
|
/* FIXME: remove this restriction */
|
||||||
/*
|
/*
|
||||||
* The metadata device is currently limited in size.
|
* The metadata device is currently limited in size.
|
||||||
*
|
|
||||||
* We have one block of index, which can hold 255 index entries. Each
|
|
||||||
* index entry contains allocation info about 16k metadata blocks.
|
|
||||||
*/
|
*/
|
||||||
#define DM_CACHE_METADATA_MAX_SECTORS (255 * (1 << 14) * (DM_CACHE_METADATA_BLOCK_SIZE / (1 << SECTOR_SHIFT)))
|
#define DM_CACHE_METADATA_MAX_SECTORS DM_SM_METADATA_MAX_SECTORS
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A metadata device larger than 16GB triggers a warning.
|
* A metadata device larger than 16GB triggers a warning.
|
||||||
|
@ -2840,7 +2840,7 @@ static void cache_status(struct dm_target *ti, status_type_t type,
|
|||||||
residency = policy_residency(cache->policy);
|
residency = policy_residency(cache->policy);
|
||||||
|
|
||||||
DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %lu ",
|
DMEMIT("%u %llu/%llu %u %llu/%llu %u %u %u %u %u %u %lu ",
|
||||||
(unsigned)(DM_CACHE_METADATA_BLOCK_SIZE >> SECTOR_SHIFT),
|
(unsigned)DM_CACHE_METADATA_BLOCK_SIZE,
|
||||||
(unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata),
|
(unsigned long long)(nr_blocks_metadata - nr_free_blocks_metadata),
|
||||||
(unsigned long long)nr_blocks_metadata,
|
(unsigned long long)nr_blocks_metadata,
|
||||||
cache->sectors_per_block,
|
cache->sectors_per_block,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user