Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e7986f

Browse files
snitmaxboe
authored andcommitted
block: use gcd() to fix chunk_sectors limit stacking
commit22ada80 ("block: use lcm_not_zero() when stackingchunk_sectors") broke chunk_sectors limit stacking. chunk_sectors mustreflect the most limited of all devices in the IO stack.Otherwise malformed IO may result. E.g.: prior to this fix,->chunk_sectors = lcm_not_zero(8, 128) would result inblk_max_size_offset() splitting IO at 128 sectors rather than therequired more restrictive 8 sectors.And since commit07d098e ("block: allow 'chunk_sectors' to benon-power-of-2") care must be taken to properly stack chunk_sectors tobe compatible with the possibility that a non-power-of-2 chunk_sectorsmay be stacked. This is why gcd() is used instead of reverting backto using min_not_zero().Fixes:22ada80 ("block: use lcm_not_zero() when stacking chunk_sectors")Fixes:07d098e ("block: allow 'chunk_sectors' to be non-power-of-2")Reported-by: John Dorminy <jdorminy@redhat.com>Reported-by: Bruce Johnston <bjohnsto@redhat.com>Signed-off-by: Mike Snitzer <snitzer@redhat.com>Reviewed-by: John Dorminy <jdorminy@redhat.com>Cc: stable@vger.kernel.orgReviewed-by: Martin K. Petersen <martin.petersen@oracle.com>Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent47a8465 commit7e7986f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎block/blk-settings.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
547547

548548
t->io_min=max(t->io_min,b->io_min);
549549
t->io_opt=lcm_not_zero(t->io_opt,b->io_opt);
550-
t->chunk_sectors=lcm_not_zero(t->chunk_sectors,b->chunk_sectors);
550+
551+
/* Set non-power-of-2 compatible chunk_sectors boundary */
552+
if (b->chunk_sectors)
553+
t->chunk_sectors=gcd(t->chunk_sectors,b->chunk_sectors);
551554

552555
/* Physical block size a multiple of the logical block size? */
553556
if (t->physical_block_size& (t->logical_block_size-1)) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp