Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: update validation of atomic writes boundary for stacked devices

In commit 63d092d1c1b1 ("block: use chunk_sectors when evaluating stacked
atomic write limits"), it was missed to use a chunk sectors limit check
in blk_stack_atomic_writes_boundary_head(), so update that function to
do the proper check.

Fixes: 63d092d1c1b1 ("block: use chunk_sectors when evaluating stacked atomic write limits")
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

John Garry and committed by
Jens Axboe
bfd40372 74b1db86

+14 -8
+14 -8
block/blk-settings.c
··· 643 643 static bool blk_stack_atomic_writes_boundary_head(struct queue_limits *t, 644 644 struct queue_limits *b) 645 645 { 646 + unsigned int boundary_sectors; 647 + 648 + if (!b->atomic_write_hw_boundary || !t->chunk_sectors) 649 + return true; 650 + 651 + boundary_sectors = b->atomic_write_hw_boundary >> SECTOR_SHIFT; 652 + 646 653 /* 647 654 * Ensure atomic write boundary is aligned with chunk sectors. Stacked 648 - * devices store chunk sectors in t->io_min. 655 + * devices store any stripe size in t->chunk_sectors. 649 656 */ 650 - if (b->atomic_write_hw_boundary > t->io_min && 651 - b->atomic_write_hw_boundary % t->io_min) 657 + if (boundary_sectors > t->chunk_sectors && 658 + boundary_sectors % t->chunk_sectors) 652 659 return false; 653 - if (t->io_min > b->atomic_write_hw_boundary && 654 - t->io_min % b->atomic_write_hw_boundary) 660 + if (t->chunk_sectors > boundary_sectors && 661 + t->chunk_sectors % boundary_sectors) 655 662 return false; 656 663 657 - t->atomic_write_hw_boundary = b->atomic_write_hw_boundary; 658 664 return true; 659 665 } 660 666 ··· 701 695 static bool blk_stack_atomic_writes_head(struct queue_limits *t, 702 696 struct queue_limits *b) 703 697 { 704 - if (b->atomic_write_hw_boundary && 705 - !blk_stack_atomic_writes_boundary_head(t, b)) 698 + if (!blk_stack_atomic_writes_boundary_head(t, b)) 706 699 return false; 707 700 708 701 t->atomic_write_hw_unit_max = b->atomic_write_hw_unit_max; 709 702 t->atomic_write_hw_unit_min = b->atomic_write_hw_unit_min; 710 703 t->atomic_write_hw_max = b->atomic_write_hw_max; 704 + t->atomic_write_hw_boundary = b->atomic_write_hw_boundary; 711 705 return true; 712 706 } 713 707