mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
thin: add alloc_pool_metadata
Since our api call is not yet powerfull enough, use this wrapper to preset options.
This commit is contained in:
parent
f4137640f6
commit
b786096863
@ -1650,6 +1650,50 @@ int update_pool_params(struct cmd_context *cmd, unsigned attr,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
|
||||||
|
alloc_policy_t alloc,
|
||||||
|
const char *name,
|
||||||
|
struct dm_list *pvh,
|
||||||
|
uint32_t read_ahead,
|
||||||
|
uint32_t stripes,
|
||||||
|
uint32_t stripe_size,
|
||||||
|
uint64_t size)
|
||||||
|
{
|
||||||
|
struct logical_volume *metadata_lv;
|
||||||
|
struct lvcreate_params lvc;
|
||||||
|
|
||||||
|
/* FIXME: Make lvm2api usable */
|
||||||
|
memset(&lvc, 0, sizeof(lvc));
|
||||||
|
|
||||||
|
if (!(lvc.extents = extents_from_size(pool_lv->vg->cmd, size,
|
||||||
|
pool_lv->vg->extent_size)))
|
||||||
|
return_0;
|
||||||
|
|
||||||
|
if (!(lvc.segtype = get_segtype_from_string(pool_lv->vg->cmd, "striped")))
|
||||||
|
return_0;
|
||||||
|
|
||||||
|
dm_list_init(&lvc.tags);
|
||||||
|
|
||||||
|
/* FIXME: allocate properly space for metadata_lv */
|
||||||
|
lvc.activate = CHANGE_ALY;
|
||||||
|
lvc.alloc = alloc;
|
||||||
|
lvc.lv_name = name;
|
||||||
|
lvc.major = -1;
|
||||||
|
lvc.minor = -1;
|
||||||
|
lvc.permission = LVM_READ | LVM_WRITE;
|
||||||
|
lvc.pvh = pvh;
|
||||||
|
lvc.read_ahead = read_ahead;
|
||||||
|
lvc.stripe_size = stripe_size;
|
||||||
|
lvc.stripes = stripes;
|
||||||
|
lvc.vg_name = pool_lv->vg->name;
|
||||||
|
lvc.zero = 1;
|
||||||
|
|
||||||
|
if (!(metadata_lv = lv_create_single(pool_lv->vg, &lvc)))
|
||||||
|
return_0;
|
||||||
|
|
||||||
|
return metadata_lv;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generic stripe parameter checks.
|
* Generic stripe parameter checks.
|
||||||
*/
|
*/
|
||||||
|
@ -120,6 +120,11 @@ int update_pool_params(struct cmd_context *cmd, unsigned attr,
|
|||||||
uint32_t data_extents, uint32_t extent_size,
|
uint32_t data_extents, uint32_t extent_size,
|
||||||
uint32_t *chunk_size, thin_discards_t *discards,
|
uint32_t *chunk_size, thin_discards_t *discards,
|
||||||
uint64_t *pool_metadata_size);
|
uint64_t *pool_metadata_size);
|
||||||
|
struct logical_volume *alloc_pool_metadata(struct logical_volume *pool_lv,
|
||||||
|
alloc_policy_t alloc, const char *name,
|
||||||
|
struct dm_list *pvh, uint32_t read_ahead,
|
||||||
|
uint32_t stripes, uint32_t stripe_size,
|
||||||
|
uint64_t size);
|
||||||
int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes,
|
int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes,
|
||||||
uint32_t *stripe_size);
|
uint32_t *stripe_size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user