Lift the code from device mapper into blk_stack_limits to inherity the stacking limitations. This ensures we do the right thing for all stacked zoned block devices.
Unified · Split
| @@ -609,6 +609,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, · 608 unmodified lines | |||
| 609 | t->chunk_sectors = min_not_zero(t->chunk_sectors, | 609 | t->chunk_sectors = min_not_zero(t->chunk_sectors, |
| 610 | b->chunk_sectors); | 610 | b->chunk_sectors); |
| 611 | 611 | ||
| 612 | t->zoned = max(t->zoned, b->zoned); | ||
| 612 | return ret; | 613 | return ret; |
| 613 | } | 614 | } |
| 614 | EXPORT_SYMBOL(blk_stack_limits); | 615 | EXPORT_SYMBOL(blk_stack_limits); |
| @@ -467,9 +467,6 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, · 466 unmodified lines | |||
| 467 | q->limits.logical_block_size, | 467 | q->limits.logical_block_size, |
| 468 | q->limits.alignment_offset, | 468 | q->limits.alignment_offset, |
| 469 | (unsigned long long) start << SECTOR_SHIFT); | 469 | (unsigned long long) start << SECTOR_SHIFT); |
| 470 | |||
| 471 | limits->zoned = blk_queue_zoned_model(q); | ||
| 472 | |||
| 473 | return 0; | 470 | return 0; |
| 474 | } | 471 | } |
| 475 | 472 | ||
| @@ -1528,22 +1525,6 @@ combine_limits: · 1052 unmodified lines | |||
| 1528 | dm_device_name(table->md), | 1525 | dm_device_name(table->md), |
| 1529 | (unsigned long long) ti->begin, | 1526 | (unsigned long long) ti->begin, |
| 1530 | (unsigned long long) ti->len); | 1527 | (unsigned long long) ti->len); |
| 1531 | |||
| 1532 | /* | ||
| 1533 | * FIXME: this should likely be moved to blk_stack_limits(), would | ||
| 1534 | * also eliminate limits->zoned stacking hack in dm_set_device_limits() | ||
| 1535 | */ | ||
| 1536 | if (limits->zoned == BLK_ZONED_NONE && ti_limits.zoned != BLK_ZONED_NONE) { | ||
| 1537 | /* | ||
| 1538 | * By default, the stacked limits zoned model is set to | ||
| 1539 | * BLK_ZONED_NONE in blk_set_stacking_limits(). Update | ||
| 1540 | * this model using the first target model reported | ||
| 1541 | * that is not BLK_ZONED_NONE. This will be either the | ||
| 1542 | * first target device zoned model or the model reported | ||
| 1543 | * by the target .io_hints. | ||
| 1544 | */ | ||
| 1545 | limits->zoned = ti_limits.zoned; | ||
| 1546 | } | ||
| 1547 | } | 1528 | } |
| 1548 | 1529 | ||
| 1549 | /* | 1530 | /* |
| @@ -306,11 +306,14 @@ enum blk_queue_state { · 305 unmodified lines | |||
| 306 | 306 | ||
| 307 | /* | 307 | /* |
| 308 | * Zoned block device models (zoned limit). | 308 | * Zoned block device models (zoned limit). |
| 309 | * | ||
| 310 | * Note: This needs to be ordered from the least to the most severe | ||
| 311 | * restrictions for the inheritance in blk_stack_limits() to work. | ||
| 309 | */ | 312 | */ |
| 310 | enum blk_zoned_model { | 313 | enum blk_zoned_model { |
| 311 | BLK_ZONED_NONE, /* Regular block device */ | 314 | BLK_ZONED_NONE = 0, /* Regular block device */ |
| 312 | BLK_ZONED_HA, /* Host-aware zoned block device */ | 315 | BLK_ZONED_HA, /* Host-aware zoned block device */ |
| 313 | BLK_ZONED_HM, /* Host-managed zoned block device */ | 316 | BLK_ZONED_HM, /* Host-managed zoned block device */ |
| 314 | }; | 317 | }; |
| 315 | 318 | ||
| 316 | struct queue_limits { | 319 | struct queue_limits { |