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: fix stacking of atomic writes when atomics are not supported

Atomic writes support may not always be possible when stacking devices
which support atomic writes. Such as case is a different atomic write
boundary between stacked devices (which is not supported).

In the case that atomic writes cannot supported, the top device queue HW
limits are set to 0.

However, in blk_stack_atomic_writes_limits(), we detect that we are
stacking the first bottom device by checking the top device
atomic_write_hw_max value == 0. This get confused with the case of atomic
writes not supported, above.

Make the distinction between stacking the first bottom device and no
atomics supported by initializing stacked device atomic_write_hw_max =
UINT_MAX and checking that for stacking the first bottom device.

Fixes: d7f36dc446e8 ("block: Support atomic writes limits for stacked devices")
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
f2d8c5a2 bfd40372

+10 -9
+10 -9
block/blk-settings.c
··· 56 56 lim->max_user_wzeroes_unmap_sectors = UINT_MAX; 57 57 lim->max_hw_zone_append_sectors = UINT_MAX; 58 58 lim->max_user_discard_sectors = UINT_MAX; 59 + lim->atomic_write_hw_max = UINT_MAX; 59 60 } 60 61 EXPORT_SYMBOL(blk_set_stacking_limits); 61 62 ··· 231 230 lim->atomic_write_hw_max >> SECTOR_SHIFT; 232 231 233 232 if (!(lim->features & BLK_FEAT_ATOMIC_WRITES)) 233 + goto unsupported; 234 + 235 + /* UINT_MAX indicates stacked limits in initial state */ 236 + if (lim->atomic_write_hw_max == UINT_MAX) 234 237 goto unsupported; 235 238 236 239 if (!lim->atomic_write_hw_max) ··· 728 723 if (!blk_atomic_write_start_sect_aligned(start, b)) 729 724 goto unsupported; 730 725 731 - /* 732 - * If atomic_write_hw_max is set, we have already stacked 1x bottom 733 - * device, so check for compliance. 734 - */ 735 - if (t->atomic_write_hw_max) { 726 + /* UINT_MAX indicates no stacking of bottom devices yet */ 727 + if (t->atomic_write_hw_max == UINT_MAX) { 728 + if (!blk_stack_atomic_writes_head(t, b)) 729 + goto unsupported; 730 + } else { 736 731 if (!blk_stack_atomic_writes_tail(t, b)) 737 732 goto unsupported; 738 - return; 739 733 } 740 - 741 - if (!blk_stack_atomic_writes_head(t, b)) 742 - goto unsupported; 743 734 blk_stack_atomic_writes_chunk_sectors(t); 744 735 return; 745 736