Commit b80278c0 authored by Milan Broz's avatar Milan Broz

Ignore device opt-io alignment if it is not multiple of minimal-io.

Some USB enclosures seems to report bogus topology info. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1513820
parent 7d4fcfa1
......@@ -414,7 +414,9 @@ void device_topology_alignment(struct device *device,
temp_alignment = (unsigned long)min_io_size;
if (temp_alignment < (unsigned long)opt_io_size)
/* Ignore bogus opt-io that could break alignment */
if ((temp_alignment < (unsigned long)opt_io_size) &&
!((unsigned long)opt_io_size % temp_alignment))
temp_alignment = (unsigned long)opt_io_size;
/* If calculated alignment is multiple of default, keep default */
......
......@@ -132,6 +132,17 @@ format 256 8192 8192
format 128 8192 8192
cleanup
echo "# Create desktop-class 4K drive with misaligned opt-io (some bad USB enclosures)"
echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=0, opt-io=1025)"
add_device dev_size_mb=16 sector_size=512 physblk_exp=3 num_tgts=1 opt_blks=1025
format 256 4096
format 256 2112 8
format 128 2048
format 128 1088 8
format 256 8192 8192
format 128 8192 8192
cleanup
echo "# Create desktop-class 4K drive w/ 63-sector DOS partition compensation"
echo "# (logical_block_size=512, physical_block_size=4096, alignment_offset=3584)"
add_device dev_size_mb=16 sector_size=512 physblk_exp=3 lowest_aligned=7 num_tgts=1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment