metadata: fix bug that allowed PE alignment to be misaligned
PATCH 1/1 metadata: fix bug that allowed PE alignment to be misaligned
The default PE alignment could be selected (via MAX()) even if it was determined that the device's MD stripe width, or minimal_io_size or optimal_io_size were not factors of the default PE alignment (either 64K or the newer default of 1MB, etc). This bug would manifest if the default PE alignment was larger than the overriding hint that the device provided (e.g. default of 1MB vs optimal_io_size of 768K).
This fixes a long standing regression since LVM2 2.02.74 (commit 4efb1d9c, "Update heuristic used for default and detected data alignment.")
Signed-off-by Mike Snitzer <[email protected]>
--- lib/metadata/metadata.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
lib/metadata/metadata.c +3 -3
@@ -86,7 +86,7 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignmif (find_config_tree_bool (pv->fmt->cmd, devices_md_chunk_alignment_CFG)) { temp_pe_align =dev_md_stripe_width (pv->fmt->cmd->sysfs_dir, pv->dev);if (_alignment_overrides_default (temp_pe_align, default_pe_align)) - pv->pe_align =MAX (pv->pe_align, temp_pe_align); + pv->pe_align = temp_pe_align; }/*
@@ -99,11 +99,11 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignmif (find_config_tree_bool (pv->fmt->cmd, devices_data_alignment_detection_CFG)) { temp_pe_align =dev_minimum_io_size (pv->fmt->cmd->sysfs_dir, pv->dev);if (_alignment_overrides_default (temp_pe_align, default_pe_align)) - pv->pe_align =MAX (pv->pe_align, temp_pe_align); + pv->pe_align = temp_pe_align; temp_pe_align =dev_optimal_io_size (pv->fmt->cmd->sysfs_dir, pv->dev);if (_alignment_overrides_default (temp_pe_align, default_pe_align)) - pv->pe_align =MAX (pv->pe_align, temp_pe_align); + pv->pe_align = temp_pe_align; } out:
Signature · 1 line
1.7.1