block: fix blk_queue_alignment_offset
PATCH 1/1 block: fix blk_queue_alignment_offset
We need to mask out bits inside the logical block, not outside of it, otherwise we'll always get a 0 alignment_offset.
Signed-off-by Christoph Hellwig <[email protected]>
block/blk-settings.c +1 -1
@@ -371,7 +371,7 @@ EXPORT_SYMBOL(blk_queue_physical_block_svoid blk_queue_alignment_offset (struct request_queue *q,unsigned int offset) { q->limits.alignment_offset = - offset & (q->limits.physical_block_size -1 ); + offset & ~(q->limits.physical_block_size -1 ); q->limits.misaligned =0 ; }EXPORT_SYMBOL (blk_queue_alignment_offset);
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"hch" == Christoph Hellwig <[email protected]> writes:
hch> We need to mask out bits inside the logical block, not outside of hch> it, otherwise we'll always get a 0 alignment_offset.
The alignment_offset only makes sense if physical_block_size > logical_block_size. For instance (63 * 512) & (4096 - 1) = 3584.
Your patch would yield 28672 = 4096 * 7 and that's incorrect; LBA 63 is not aligned on a 4KB boundary...
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering