1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-25 21:57:45 +03:00

Handle a misaligned device that reports a -1 alignment_offset.

The kernel's blk_stack_limits() function may flag a device as
'misaligned'.  If it does the alignment_offset will be -1.

Update set_pe_align_offset() to accommodate this corner case.
This commit is contained in:
Mike Snitzer 2010-03-02 21:56:14 +00:00
parent 16d9293bd7
commit c485fe183e
2 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.62 -
====================================
Handle a misaligned device that reports a -1 alignment_offset.
Extend core allocation code in preparation for mirrored log areas.
Rewrite clvmd init script.
Remove lvs_in_vg_activated_by_uuid_only call.

View File

@ -123,11 +123,14 @@ unsigned long set_pe_align_offset(struct physical_volume *pv,
if (find_config_tree_bool(pv->fmt->cmd,
"devices/data_alignment_offset_detection",
DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION))
pv->pe_align_offset =
MAX(pv->pe_align_offset,
dev_alignment_offset(pv->fmt->cmd->sysfs_dir,
pv->dev));
DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION)) {
int align_offset = dev_alignment_offset(pv->fmt->cmd->sysfs_dir,
pv->dev);
/* must handle a -1 alignment_offset; means dev is misaligned */
if (align_offset < 0)
align_offset = 0;
pv->pe_align_offset = MAX(pv->pe_align_offset, align_offset);
}
log_very_verbose("%s: Setting PE alignment offset to %lu sectors.",
dev_name(pv->dev), pv->pe_align_offset);