aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Garry <john.g.garry@oracle.com>2025-09-15 10:34:58 +0000
committerJens Axboe <axboe@kernel.dk>2025-09-16 12:29:10 -0600
commitbfd4037296bd7e1f95394a2e3daf8e3c1796c3b3 (patch)
tree6a82a75e7a843aff27f6e567998536bf1ae02dea
parentblock/mq-deadline: Remove the redundant rb_entry_rq in the deadline_from_pos(). (diff)
downloadlinux-bfd4037296bd7e1f95394a2e3daf8e3c1796c3b3.tar.gz
linux-bfd4037296bd7e1f95394a2e3daf8e3c1796c3b3.zip
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>
-rw-r--r--block/blk-settings.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 693bc8d20acf..6760dbf130b2 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -643,18 +643,24 @@ static bool blk_stack_atomic_writes_tail(struct queue_limits *t,
static bool blk_stack_atomic_writes_boundary_head(struct queue_limits *t,
struct queue_limits *b)
{
+ unsigned int boundary_sectors;
+
+ if (!b->atomic_write_hw_boundary || !t->chunk_sectors)
+ return true;
+
+ boundary_sectors = b->atomic_write_hw_boundary >> SECTOR_SHIFT;
+
/*
* Ensure atomic write boundary is aligned with chunk sectors. Stacked
- * devices store chunk sectors in t->io_min.
+ * devices store any stripe size in t->chunk_sectors.
*/
- if (b->atomic_write_hw_boundary > t->io_min &&
- b->atomic_write_hw_boundary % t->io_min)
+ if (boundary_sectors > t->chunk_sectors &&
+ boundary_sectors % t->chunk_sectors)
return false;
- if (t->io_min > b->atomic_write_hw_boundary &&
- t->io_min % b->atomic_write_hw_boundary)
+ if (t->chunk_sectors > boundary_sectors &&
+ t->chunk_sectors % boundary_sectors)
return false;
- t->atomic_write_hw_boundary = b->atomic_write_hw_boundary;
return true;
}
@@ -695,13 +701,13 @@ static void blk_stack_atomic_writes_chunk_sectors(struct queue_limits *t)
static bool blk_stack_atomic_writes_head(struct queue_limits *t,
struct queue_limits *b)
{
- if (b->atomic_write_hw_boundary &&
- !blk_stack_atomic_writes_boundary_head(t, b))
+ if (!blk_stack_atomic_writes_boundary_head(t, b))
return false;
t->atomic_write_hw_unit_max = b->atomic_write_hw_unit_max;
t->atomic_write_hw_unit_min = b->atomic_write_hw_unit_min;
t->atomic_write_hw_max = b->atomic_write_hw_max;
+ t->atomic_write_hw_boundary = b->atomic_write_hw_boundary;
return true;
}