diff options
author | Mike Snitzer <snitzer@redhat.com> | 2009-07-30 17:45:28 +0000 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2009-07-30 17:45:28 +0000 |
commit | 04b2a4bdcfee745a075f1d720be48afbb951fd09 (patch) | |
tree | b07a36dfd02e6fcf3be94053e784a932f578092a /tools | |
parent | d01a37f597bb1e2384c6813aef34589d20f47fd8 (diff) | |
download | lvm2-04b2a4bdcfee745a075f1d720be48afbb951fd09.tar.gz lvm2-04b2a4bdcfee745a075f1d720be48afbb951fd09.tar.xz lvm2-04b2a4bdcfee745a075f1d720be48afbb951fd09.zip |
Add --dataalignmentoffset to pvcreate to shift start of aligned data area
Adds pe_align_offset to 'struct physical_volume'; is initialized with
set_pe_align_offset(). After pe_start is established pe_align_offset is
added to it.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/args.h | 1 | ||||
-rw-r--r-- | tools/commands.h | 7 | ||||
-rw-r--r-- | tools/pvcreate.c | 21 | ||||
-rw-r--r-- | tools/vgconvert.c | 2 |
4 files changed, 26 insertions, 5 deletions
diff --git a/tools/args.h b/tools/args.h index 846b6c2e..f5db50e0 100644 --- a/tools/args.h +++ b/tools/args.h @@ -59,6 +59,7 @@ arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0) arg(unquoted_ARG, '\0', "unquoted", NULL, 0) arg(rows_ARG, '\0', "rows", NULL, 0) arg(dataalignment_ARG, '\0', "dataalignment", size_kb_arg, 0) +arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", size_kb_arg, 0) arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0) arg(virtualsize_ARG, '\0', "virtualsize", size_mb_arg, 0) diff --git a/tools/commands.h b/tools/commands.h index 8559799d..7f9feee4 100644 --- a/tools/commands.h +++ b/tools/commands.h @@ -470,6 +470,7 @@ xx(pvcreate, "\t[--metadatacopies #copies]" "\n" "\t[--metadatasize MetadataSize[bBsSkKmMgGtTpPeE]]" "\n" "\t[--dataalignment Alignment[bBsSkKmMgGtTpPeE]]" "\n" + "\t[--dataalignmentoffset AlignmentOffset[bBsSkKmMgGtTpPeE]]" "\n" "\t[--setphysicalvolumesize PhysicalVolumeSize[bBsSkKmMgGtTpPeE]" "\n" "\t[-t|--test] " "\n" "\t[-u|--uuid uuid] " "\n" @@ -479,9 +480,9 @@ xx(pvcreate, "\t[--version] " "\n" "\tPhysicalVolume [PhysicalVolume...]\n", - dataalignment_ARG, force_ARG, test_ARG, labelsector_ARG, metadatatype_ARG, - metadatacopies_ARG, metadatasize_ARG, physicalvolumesize_ARG, - restorefile_ARG, uuidstr_ARG, yes_ARG, zero_ARG) + dataalignment_ARG, dataalignmentoffset_ARG, force_ARG, test_ARG, + labelsector_ARG, metadatatype_ARG, metadatacopies_ARG, metadatasize_ARG, + physicalvolumesize_ARG, restorefile_ARG, uuidstr_ARG, yes_ARG, zero_ARG) xx(pvdata, "Display the on-disk metadata for physical volume(s)", diff --git a/tools/pvcreate.c b/tools/pvcreate.c index 8595339b..a22190d7 100644 --- a/tools/pvcreate.c +++ b/tools/pvcreate.c @@ -96,7 +96,8 @@ static int pvcreate_validate_params(struct cmd_context *cmd, if (!(cmd->fmt->features & FMT_MDAS) && (arg_count(cmd, metadatacopies_ARG) || arg_count(cmd, metadatasize_ARG) || - arg_count(cmd, dataalignment_ARG))) { + arg_count(cmd, dataalignment_ARG) || + arg_count(cmd, dataalignmentoffset_ARG))) { log_error("Metadata and data alignment parameters only " "apply to text format."); return 0; @@ -140,6 +141,24 @@ static int pvcreate_validate_params(struct cmd_context *cmd, pp->data_alignment = 0; } + if (arg_sign_value(cmd, dataalignmentoffset_ARG, 0) == SIGN_MINUS) { + log_error("Physical volume data alignment offset may not be negative"); + return 0; + } + pp->data_alignment_offset = arg_uint64_value(cmd, dataalignmentoffset_ARG, UINT64_C(0)); + + if (pp->data_alignment_offset > ULONG_MAX) { + log_error("Physical volume data alignment offset is too big."); + return 0; + } + + if (pp->data_alignment_offset && pp->pe_start) { + log_warn("WARNING: Ignoring data alignment offset %" PRIu64 + " incompatible with --restorefile value (%" + PRIu64").", pp->data_alignment_offset, pp->pe_start); + pp->data_alignment_offset = 0; + } + if (arg_sign_value(cmd, metadatasize_ARG, 0) == SIGN_MINUS) { log_error("Metadata size may not be negative"); return 0; diff --git a/tools/vgconvert.c b/tools/vgconvert.c index 0996d954..a8b064d9 100644 --- a/tools/vgconvert.c +++ b/tools/vgconvert.c @@ -123,7 +123,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name, dm_list_init(&mdas); if (!(pv = pv_create(cmd, pv_dev(existing_pv), - &existing_pv->id, size, 0, + &existing_pv->id, size, 0, 0, pe_start, pv_pe_count(existing_pv), pv_pe_size(existing_pv), pvmetadatacopies, pvmetadatasize, &mdas))) { |