Pass metadataignore through PV creation / setup paths.
As a result of this cleanup, we can remove the unnecessary setting
of mda_ignore bits inside pvcreate_single(), after call to pv_create.
For now, just set metadataignore to '0' in some places. This is
equivalent to the prior functionality, although the 0 is given
by the caller not hardcoded in _mda_setup() call.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
}
static int _format1_pv_setup(const struct format_type *fmt,
- uint64_t pe_start, uint32_t extent_count,
- uint32_t extent_size,
- unsigned long data_alignment __attribute((unused)),
- unsigned long data_alignment_offset __attribute((unused)),
- int pvmetadatacopies __attribute((unused)),
- uint64_t pvmetadatasize __attribute((unused)), struct dm_list *mdas __attribute((unused)),
- struct physical_volume *pv, struct volume_group *vg __attribute((unused)))
+ uint64_t pe_start, uint32_t extent_count,
+ uint32_t extent_size,
+ unsigned long data_alignment __attribute((unused)),
+ unsigned long data_alignment_offset __attribute((unused)),
+ int pvmetadatacopies __attribute((unused)),
+ uint64_t pvmetadatasize __attribute((unused)),
+ unsigned metadataignore __attribute((unused)),
+ struct dm_list *mdas __attribute((unused)),
+ struct physical_volume *pv, struct volume_group *vg __attribute((unused)))
{
if (pv->size > MAX_PV_SIZE)
pv->size--;
unsigned long data_alignment_offset __attribute((unused)),
int pvmetadatacopies __attribute((unused)),
uint64_t pvmetadatasize __attribute((unused)),
+ unsigned metadataignore __attribute((unused)),
struct dm_list *mdas __attribute((unused)),
struct physical_volume *pv __attribute((unused)),
struct volume_group *vg __attribute((unused)))
}
if (!vg->fid->fmt->ops->
pv_setup(vg->fid->fmt, UINT64_C(0), 0, 0, 0, 0, 0UL,
- UINT64_C(0), &vg->fid->metadata_areas_in_use, pv, vg)) {
+ UINT64_C(0), 0,
+ &vg->fid->metadata_areas_in_use, pv, vg)) {
log_error("Format-specific setup for %s failed",
pv_dev_name(pv));
return 0;
Always have an mda between end-of-label and pe_align() boundary */
static int _mda_setup(const struct format_type *fmt,
uint64_t pe_start, uint64_t pe_end,
- int pvmetadatacopies,
- uint64_t pvmetadatasize, struct dm_list *mdas,
+ int pvmetadatacopies, uint64_t pvmetadatasize,
+ unsigned metadataignore, struct dm_list *mdas,
struct physical_volume *pv,
struct volume_group *vg __attribute((unused)))
{
/* FIXME If creating new mdas, wipe them! */
if (mda_size1) {
if (!add_mda(fmt, fmt->cmd->mem, mdas, pv->dev, start1,
- mda_size1, 0))
+ mda_size1, metadataignore))
return 0;
if (!dev_set((struct device *) pv->dev, start1,
if (mda_size2) {
if (!add_mda(fmt, fmt->cmd->mem, mdas, pv->dev, start2,
- mda_size2, 0)) return 0;
+ mda_size2, metadataignore)) return 0;
if (!dev_set(pv->dev, start2,
(size_t) (mda_size1 >
wipe_size ? : mda_size1), 0)) {
* setting of pv->pe_start to .pv_write
*/
static int _text_pv_setup(const struct format_type *fmt,
- uint64_t pe_start, uint32_t extent_count,
- uint32_t extent_size, unsigned long data_alignment,
- unsigned long data_alignment_offset,
- int pvmetadatacopies,
- uint64_t pvmetadatasize, struct dm_list *mdas,
- struct physical_volume *pv, struct volume_group *vg)
+ uint64_t pe_start, uint32_t extent_count,
+ uint32_t extent_size, unsigned long data_alignment,
+ unsigned long data_alignment_offset,
+ int pvmetadatacopies, uint64_t pvmetadatasize,
+ unsigned metadataignore, struct dm_list *mdas,
+ struct physical_volume *pv, struct volume_group *vg)
{
struct metadata_area *mda, *mda_new, *mda2;
struct mda_context *mdac, *mdac2;
if (extent_count)
pe_end = pe_start + extent_count * extent_size - 1;
if (!_mda_setup(fmt, pe_start, pe_end, pvmetadatacopies,
- pvmetadatasize, mdas, pv, vg))
+ pvmetadatasize, metadataignore, mdas, pv, vg))
return_0;
}
/* pe_start and pe_end relate to any existing data so that new metadata
* areas can avoid overlap */
struct physical_volume *pv_create(const struct cmd_context *cmd,
- struct device *dev,
- struct id *id,
- uint64_t size,
- unsigned long data_alignment,
- unsigned long data_alignment_offset,
- uint64_t pe_start,
- uint32_t existing_extent_count,
- uint32_t existing_extent_size,
- int pvmetadatacopies,
- uint64_t pvmetadatasize, struct dm_list *mdas);
+ struct device *dev,
+ struct id *id,
+ uint64_t size,
+ unsigned long data_alignment,
+ unsigned long data_alignment_offset,
+ uint64_t pe_start,
+ uint32_t existing_extent_count,
+ uint32_t existing_extent_size,
+ int pvmetadatacopies, uint64_t pvmetadatasize,
+ unsigned metadataignore,
+ struct dm_list *mdas);
int pv_resize(struct physical_volume *pv, struct volume_group *vg,
uint32_t new_pe_count);
int pv_analyze(struct cmd_context *cmd, const char *pv_name,
if (!fid->fmt->ops->pv_setup(fid->fmt, UINT64_C(0), 0,
vg->extent_size, 0, 0, 0UL, UINT64_C(0),
- mdas, pv, vg)) {
+ 0, mdas, pv, vg)) {
log_error("Format-specific setup of physical volume '%s' "
"failed.", pv_name);
return 0;
struct dm_list mdas;
struct pvcreate_params default_pp;
char buffer[64] __attribute((aligned(8)));
- struct metadata_area *mda;
pvcreate_params_set_defaults(&default_pp);
if (!pp)
if (!(pv = pv_create(cmd, dev, pp->idp, pp->size,
pp->data_alignment, pp->data_alignment_offset,
pp->pe_start, pp->extent_count, pp->extent_size,
- pp->pvmetadatacopies,
- pp->pvmetadatasize,&mdas))) {
+ pp->pvmetadatacopies, pp->pvmetadatasize,
+ pp->metadataignore, &mdas))) {
log_error("Failed to setup physical volume \"%s\"", pv_name);
goto error;
}
log_very_verbose("Writing physical volume data to disk \"%s\"",
pv_name);
- if (pp->metadataignore)
- dm_list_iterate_items(mda, &mdas)
- mda_set_ignored(mda, 1);
-
if (!(pv_write(cmd, pv, &mdas, pp->labelsector))) {
log_error("Failed to write physical volume \"%s\"", pv_name);
goto error;
uint64_t pe_start,
uint32_t existing_extent_count,
uint32_t existing_extent_size,
- int pvmetadatacopies,
- uint64_t pvmetadatasize, struct dm_list *mdas)
+ int pvmetadatacopies, uint64_t pvmetadatasize,
+ unsigned metadataignore, struct dm_list *mdas)
{
const struct format_type *fmt = cmd->fmt;
struct dm_pool *mem = fmt->cmd->mem;
if (!fmt->ops->pv_setup(fmt, pe_start, existing_extent_count,
existing_extent_size, data_alignment,
data_alignment_offset,
- pvmetadatacopies, pvmetadatasize, mdas,
- pv, NULL)) {
+ pvmetadatacopies, pvmetadatasize,
+ metadataignore, mdas, pv, NULL)) {
log_error("%s: Format-specific setup of physical volume "
"failed.", pv_dev_name(pv));
goto bad;
uint64_t pe_start, uint32_t extent_count,
uint32_t extent_size, unsigned long data_alignment,
unsigned long data_alignment_offset,
- int pvmetadatacopies,
- uint64_t pvmetadatasize, struct dm_list * mdas,
+ int pvmetadatacopies, uint64_t pvmetadatasize,
+ unsigned metadataignore, struct dm_list * mdas,
struct physical_volume * pv, struct volume_group * vg);
/*
&existing_pv->id, size, 0, 0,
pe_start, pv_pe_count(existing_pv),
pv_pe_size(existing_pv), pvmetadatacopies,
- pvmetadatasize, &mdas))) {
+ pvmetadatasize, 0, &mdas))) {
log_error("Failed to setup physical volume \"%s\"",
pv_dev_name(existing_pv));
if (change_made)