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

Merge tag 'for-5.9/block-merge-20200804' of git://git.kernel.dk/linux-block

Pull block stacking updates from Jens Axboe:
"The stacking related fixes depended on both the core block and drivers
branches, so here's a topic branch with that change.

Outside of that, a late fix from Johannes for zone revalidation"

* tag 'for-5.9/block-merge-20200804' of git://git.kernel.dk/linux-block:
block: don't do revalidate zones on invalid devices
block: remove blk_queue_stack_limits
block: remove bdev_stack_limits
block: inherit the zoned characteristics in blk_stack_limits

+18 -63
+3 -34
block/blk-settings.c
··· 456 456 EXPORT_SYMBOL(blk_queue_io_opt); 457 457 458 458 /** 459 - * blk_queue_stack_limits - inherit underlying queue limits for stacked drivers 460 - * @t: the stacking driver (top) 461 - * @b: the underlying device (bottom) 462 - **/ 463 - void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b) 464 - { 465 - blk_stack_limits(&t->limits, &b->limits, 0); 466 - } 467 - EXPORT_SYMBOL(blk_queue_stack_limits); 468 - 469 - /** 470 459 * blk_stack_limits - adjust queue_limits for stacked devices 471 460 * @t: the stacking driver limits (top device) 472 461 * @b: the underlying queue limits (bottom, component device) ··· 598 609 t->chunk_sectors = min_not_zero(t->chunk_sectors, 599 610 b->chunk_sectors); 600 611 612 + t->zoned = max(t->zoned, b->zoned); 601 613 return ret; 602 614 } 603 615 EXPORT_SYMBOL(blk_stack_limits); 604 - 605 - /** 606 - * bdev_stack_limits - adjust queue limits for stacked drivers 607 - * @t: the stacking driver limits (top device) 608 - * @bdev: the component block_device (bottom) 609 - * @start: first data sector within component device 610 - * 611 - * Description: 612 - * Merges queue limits for a top device and a block_device. Returns 613 - * 0 if alignment didn't change. Returns -1 if adding the bottom 614 - * device caused misalignment. 615 - */ 616 - int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, 617 - sector_t start) 618 - { 619 - struct request_queue *bq = bdev_get_queue(bdev); 620 - 621 - start += get_start_sect(bdev); 622 - 623 - return blk_stack_limits(t, &bq->limits, start); 624 - } 625 - EXPORT_SYMBOL(bdev_stack_limits); 626 616 627 617 /** 628 618 * disk_stack_limits - adjust queue limits for stacked drivers ··· 618 650 { 619 651 struct request_queue *t = disk->queue; 620 652 621 - if (bdev_stack_limits(&t->limits, bdev, offset >> 9) < 0) { 653 + if (blk_stack_limits(&t->limits, &bdev_get_queue(bdev)->limits, 654 + get_start_sect(bdev) + (offset >> 9)) < 0) { 622 655 char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE]; 623 656 624 657 disk_name(disk, 0, top);
+3
block/blk-zoned.c
··· 498 498 if (WARN_ON_ONCE(!queue_is_mq(q))) 499 499 return -EIO; 500 500 501 + if (!get_capacity(disk)) 502 + return -EIO; 503 + 501 504 /* 502 505 * Ensure that all memory allocations in this context are done as if 503 506 * GFP_NOIO was specified.
+2 -2
drivers/block/drbd/drbd_nl.c
··· 1250 1250 1251 1251 static void fixup_write_zeroes(struct drbd_device *device, struct request_queue *q) 1252 1252 { 1253 - /* Fixup max_write_zeroes_sectors after blk_queue_stack_limits(): 1253 + /* Fixup max_write_zeroes_sectors after blk_stack_limits(): 1254 1254 * if we can handle "zeroes" efficiently on the protocol, 1255 1255 * we want to do that, even if our backend does not announce 1256 1256 * max_write_zeroes_sectors itself. */ ··· 1361 1361 decide_on_write_same_support(device, q, b, o, disable_write_same); 1362 1362 1363 1363 if (b) { 1364 - blk_queue_stack_limits(q, b); 1364 + blk_stack_limits(&q->limits, &b->limits, 0); 1365 1365 1366 1366 if (q->backing_dev_info->ra_pages != 1367 1367 b->backing_dev_info->ra_pages) {
+2 -20
drivers/md/dm-table.c
··· 458 458 return 0; 459 459 } 460 460 461 - if (bdev_stack_limits(limits, bdev, start) < 0) 461 + if (blk_stack_limits(limits, &q->limits, 462 + get_start_sect(bdev) + start) < 0) 462 463 DMWARN("%s: adding target device %s caused an alignment inconsistency: " 463 464 "physical_block_size=%u, logical_block_size=%u, " 464 465 "alignment_offset=%u, start=%llu", ··· 468 467 q->limits.logical_block_size, 469 468 q->limits.alignment_offset, 470 469 (unsigned long long) start << SECTOR_SHIFT); 471 - 472 - limits->zoned = blk_queue_zoned_model(q); 473 - 474 470 return 0; 475 471 } 476 472 ··· 1526 1528 dm_device_name(table->md), 1527 1529 (unsigned long long) ti->begin, 1528 1530 (unsigned long long) ti->len); 1529 - 1530 - /* 1531 - * FIXME: this should likely be moved to blk_stack_limits(), would 1532 - * also eliminate limits->zoned stacking hack in dm_set_device_limits() 1533 - */ 1534 - if (limits->zoned == BLK_ZONED_NONE && ti_limits.zoned != BLK_ZONED_NONE) { 1535 - /* 1536 - * By default, the stacked limits zoned model is set to 1537 - * BLK_ZONED_NONE in blk_set_stacking_limits(). Update 1538 - * this model using the first target model reported 1539 - * that is not BLK_ZONED_NONE. This will be either the 1540 - * first target device zoned model or the model reported 1541 - * by the target .io_hints. 1542 - */ 1543 - limits->zoned = ti_limits.zoned; 1544 - } 1545 1531 } 1546 1532 1547 1533 /*
+2 -1
drivers/nvme/host/core.c
··· 2081 2081 #ifdef CONFIG_NVME_MULTIPATH 2082 2082 if (ns->head->disk) { 2083 2083 nvme_update_disk_info(ns->head->disk, ns, id); 2084 - blk_queue_stack_limits(ns->head->disk->queue, ns->queue); 2084 + blk_stack_limits(&ns->head->disk->queue->limits, 2085 + &ns->queue->limits, 0); 2085 2086 nvme_mpath_update_disk_size(ns->head->disk); 2086 2087 } 2087 2088 #endif
+6 -6
include/linux/blkdev.h
··· 306 306 307 307 /* 308 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 313 enum blk_zoned_model { 311 - BLK_ZONED_NONE, /* Regular block device */ 312 - BLK_ZONED_HA, /* Host-aware zoned block device */ 313 - BLK_ZONED_HM, /* Host-managed zoned block device */ 314 + BLK_ZONED_NONE = 0, /* Regular block device */ 315 + BLK_ZONED_HA, /* Host-aware zoned block device */ 316 + BLK_ZONED_HM, /* Host-managed zoned block device */ 314 317 }; 315 318 316 319 struct queue_limits { ··· 1139 1136 extern void blk_set_stacking_limits(struct queue_limits *lim); 1140 1137 extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, 1141 1138 sector_t offset); 1142 - extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev, 1143 - sector_t offset); 1144 1139 extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev, 1145 1140 sector_t offset); 1146 - extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b); 1147 1141 extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int); 1148 1142 extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); 1149 1143 extern void blk_queue_virt_boundary(struct request_queue *, unsigned long);