Skip to content

Commit 5f756ca

Browse files
johnpgarrykawasaki
authored andcommitted
dm-stripe: limit chunk_sectors to the stripe size
Currently we use min io size as the chunk size when deciding on the limit of atomic write size. Using min io size is not reliable, as this may be mutated when stacking the bottom device limits. The block stacking limits will rely on chunk_sectors in future, so set this value (to the chunk size). Introduce a flag - DM_TARGET_STRIPED - and check this in dm_set_device_limits() when setting this limit. Signed-off-by: John Garry <[email protected]>
1 parent 10beabf commit 5f756ca

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

drivers/md/dm-stripe.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@ static struct target_type stripe_target = {
466466
.name = "striped",
467467
.version = {1, 7, 0},
468468
.features = DM_TARGET_PASSES_INTEGRITY | DM_TARGET_NOWAIT |
469-
DM_TARGET_ATOMIC_WRITES | DM_TARGET_PASSES_CRYPTO,
469+
DM_TARGET_ATOMIC_WRITES | DM_TARGET_PASSES_CRYPTO |
470+
DM_TARGET_STRIPED,
470471
.module = THIS_MODULE,
471472
.ctr = stripe_ctr,
472473
.dtr = stripe_dtr,

drivers/md/dm-table.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,10 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
430430
return 0;
431431
}
432432

433+
/* For striped types, limit the chunk_sectors to the chunk size */
434+
if (dm_target_supports_striped(ti->type))
435+
limits->chunk_sectors = len >> SECTOR_SHIFT;
436+
433437
mutex_lock(&q->limits_lock);
434438
/*
435439
* BLK_FEAT_ATOMIC_WRITES is not inherited from the bottom device in

include/linux/device-mapper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ struct target_type {
309309
#define DM_TARGET_ATOMIC_WRITES 0x00000400
310310
#define dm_target_supports_atomic_writes(type) ((type)->features & DM_TARGET_ATOMIC_WRITES)
311311

312+
#define DM_TARGET_STRIPED 0x00000800
313+
#define dm_target_supports_striped(type) ((type)->features & DM_TARGET_STRIPED)
314+
312315
struct dm_target {
313316
struct dm_table *table;
314317
struct target_type *type;

0 commit comments

Comments
 (0)