From 86fb36e2b08f667bc06ac7d0b160a0247bb382a0 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Fri, 19 Sep 2008 05:33:37 +0000 Subject: [PATCH] Add device/md_chunk_alignment to lvm.conf --- WHATS_NEW | 1 + doc/example.conf | 5 +++++ lib/config/defaults.h | 1 + lib/metadata/metadata.c | 5 ++++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/WHATS_NEW b/WHATS_NEW index b0fcbca31..2a27861b2 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.40 - ================================ + Add device/md_chunk_alignment to lvm.conf. Pass struct physical_volume to pe_align and adjust for md chunk size. Store sysfs location in struct cmd_context. Avoid shuffling remaining mirror images when removing one, retaining primary. diff --git a/doc/example.conf b/doc/example.conf index 8eceafe3f..ca85d32a5 100644 --- a/doc/example.conf +++ b/doc/example.conf @@ -93,6 +93,11 @@ devices { # 1 enables; 0 disables. md_component_detection = 1 + # By default, if a PV is placed directly upon an md device, LVM2 + # will align its data blocks with the the chunk_size exposed in sysfs. + # 1 enables; 0 disables. + md_chunk_alignment = 1 + # If, while scanning the system for PVs, LVM2 encounters a device-mapper # device that has its I/O suspended, it waits for it to become accessible. # Set this to 1 to skip such devices. This should only be needed diff --git a/lib/config/defaults.h b/lib/config/defaults.h index 645cfddfb..9566c6ea2 100644 --- a/lib/config/defaults.h +++ b/lib/config/defaults.h @@ -32,6 +32,7 @@ #define DEFAULT_PROC_DIR "/proc" #define DEFAULT_SYSFS_SCAN 1 #define DEFAULT_MD_COMPONENT_DETECTION 1 +#define DEFAULT_MD_CHUNK_ALIGNMENT 1 #define DEFAULT_IGNORE_SUSPENDED_DEVICES 1 #define DEFAULT_LOCK_DIR "/var/lock/lvm" diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 3dd203632..ecf4152a3 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -27,6 +27,7 @@ #include "display.h" #include "locking.h" #include "archiver.h" +#include "defaults.h" #include @@ -74,7 +75,9 @@ unsigned long pe_align(struct physical_volume *pv) /* * Align to chunk size of underlying md device if present */ - if (pv->dev) + if (pv->dev && + find_config_tree_bool(pv->fmt->cmd, "devices/md_chunk_alignment", + DEFAULT_MD_CHUNK_ALIGNMENT)) pv->pe_align = MAX(pv->pe_align, dev_md_chunk_size(pv->fmt->cmd->sysfs_dir, pv->dev)); -- 2.43.5