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.

Merge tag 'block-6.10-20240530' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:

- NVMe fixes via Keith:
- Removing unused fields (Kanchan)
- Large folio offsets support (Kundan)
- Multipath NUMA node initialiazation fix (Nilay)
- Multipath IO stats accounting fixes (Keith)
- Circular lockdep fix (Keith)
- Target race condition fix (Sagi)
- Target memory leak fix (Sagi)

- bcache fixes

- null_blk fixes (Damien)

- Fix regression in io.max due to throttle low removal (Waiman)

- DM limit table fixes (Christoph)

- SCSI and block limit fixes (Christoph)

- zone fixes (Damien)

- Misc fixes (Christoph, Hannes, hexue)

* tag 'block-6.10-20240530' of git://git.kernel.dk/linux: (25 commits)
blk-throttle: Fix incorrect display of io.max
block: Fix zone write plugging handling of devices with a runt zone
block: Fix validation of zoned device with a runt zone
null_blk: Do not allow runt zone with zone capacity smaller then zone size
nvmet: fix a possible leak when destroy a ctrl during qp establishment
nvme: use srcu for iterating namespace list
bcache: code cleanup in __bch_bucket_alloc_set()
bcache: call force_wake_up_gc() if necessary in check_should_bypass()
bcache: allow allocator to invalidate bucket in gc
block: check for max_hw_sectors underflow
block: stack max_user_sectors
sd: also set max_user_sectors when setting max_sectors
null_blk: Print correct max open zones limit in null_init_zoned_dev()
block: delete redundant function declaration
null_blk: Fix return value of nullb_device_power_store()
dm: make dm_set_zones_restrictions work on the queue limits
dm: remove dm_check_zoned
dm: move setting zoned_enabled to dm_table_set_restrictions
block: remove blk_queue_max_integrity_segments
nvme: adjust multiples of NVME_CTRL_PAGE_SIZE in offset
...

+262 -176
+8 -2
block/blk-settings.c
··· 104 104 static int blk_validate_limits(struct queue_limits *lim) 105 105 { 106 106 unsigned int max_hw_sectors; 107 + unsigned int logical_block_sectors; 107 108 108 109 /* 109 110 * Unless otherwise specified, default to 512 byte logical blocks and a ··· 135 134 lim->max_hw_sectors = BLK_SAFE_MAX_SECTORS; 136 135 if (WARN_ON_ONCE(lim->max_hw_sectors < PAGE_SECTORS)) 137 136 return -EINVAL; 137 + logical_block_sectors = lim->logical_block_size >> SECTOR_SHIFT; 138 + if (WARN_ON_ONCE(logical_block_sectors > lim->max_hw_sectors)) 139 + return -EINVAL; 138 140 lim->max_hw_sectors = round_down(lim->max_hw_sectors, 139 - lim->logical_block_size >> SECTOR_SHIFT); 141 + logical_block_sectors); 140 142 141 143 /* 142 144 * The actual max_sectors value is a complex beast and also takes the ··· 157 153 lim->max_sectors = min(max_hw_sectors, BLK_DEF_MAX_SECTORS_CAP); 158 154 } 159 155 lim->max_sectors = round_down(lim->max_sectors, 160 - lim->logical_block_size >> SECTOR_SHIFT); 156 + logical_block_sectors); 161 157 162 158 /* 163 159 * Random default for the maximum number of segments. Driver should not ··· 615 611 unsigned int top, bottom, alignment, ret = 0; 616 612 617 613 t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors); 614 + t->max_user_sectors = min_not_zero(t->max_user_sectors, 615 + b->max_user_sectors); 618 616 t->max_hw_sectors = min_not_zero(t->max_hw_sectors, b->max_hw_sectors); 619 617 t->max_dev_sectors = min_not_zero(t->max_dev_sectors, b->max_dev_sectors); 620 618 t->max_write_zeroes_sectors = min(t->max_write_zeroes_sectors,
-1
block/blk-stat.h
··· 64 64 65 65 struct blk_queue_stats *blk_alloc_queue_stats(void); 66 66 void blk_free_queue_stats(struct blk_queue_stats *); 67 - bool blk_stats_alloc_enable(struct request_queue *q); 68 67 69 68 void blk_stat_add(struct request *rq, u64 now); 70 69
+12 -12
block/blk-throttle.c
··· 1399 1399 bps_dft = U64_MAX; 1400 1400 iops_dft = UINT_MAX; 1401 1401 1402 - if (tg->bps_conf[READ] == bps_dft && 1403 - tg->bps_conf[WRITE] == bps_dft && 1404 - tg->iops_conf[READ] == iops_dft && 1405 - tg->iops_conf[WRITE] == iops_dft) 1402 + if (tg->bps[READ] == bps_dft && 1403 + tg->bps[WRITE] == bps_dft && 1404 + tg->iops[READ] == iops_dft && 1405 + tg->iops[WRITE] == iops_dft) 1406 1406 return 0; 1407 1407 1408 1408 seq_printf(sf, "%s", dname); 1409 - if (tg->bps_conf[READ] == U64_MAX) 1409 + if (tg->bps[READ] == U64_MAX) 1410 1410 seq_printf(sf, " rbps=max"); 1411 1411 else 1412 - seq_printf(sf, " rbps=%llu", tg->bps_conf[READ]); 1412 + seq_printf(sf, " rbps=%llu", tg->bps[READ]); 1413 1413 1414 - if (tg->bps_conf[WRITE] == U64_MAX) 1414 + if (tg->bps[WRITE] == U64_MAX) 1415 1415 seq_printf(sf, " wbps=max"); 1416 1416 else 1417 - seq_printf(sf, " wbps=%llu", tg->bps_conf[WRITE]); 1417 + seq_printf(sf, " wbps=%llu", tg->bps[WRITE]); 1418 1418 1419 - if (tg->iops_conf[READ] == UINT_MAX) 1419 + if (tg->iops[READ] == UINT_MAX) 1420 1420 seq_printf(sf, " riops=max"); 1421 1421 else 1422 - seq_printf(sf, " riops=%u", tg->iops_conf[READ]); 1422 + seq_printf(sf, " riops=%u", tg->iops[READ]); 1423 1423 1424 - if (tg->iops_conf[WRITE] == UINT_MAX) 1424 + if (tg->iops[WRITE] == UINT_MAX) 1425 1425 seq_printf(sf, " wiops=max"); 1426 1426 else 1427 - seq_printf(sf, " wiops=%u", tg->iops_conf[WRITE]); 1427 + seq_printf(sf, " wiops=%u", tg->iops[WRITE]); 1428 1428 1429 1429 seq_printf(sf, "\n"); 1430 1430 return 0;
+2 -6
block/blk-throttle.h
··· 95 95 bool has_rules_bps[2]; 96 96 bool has_rules_iops[2]; 97 97 98 - /* internally used bytes per second rate limits */ 98 + /* bytes per second rate limits */ 99 99 uint64_t bps[2]; 100 - /* user configured bps limits */ 101 - uint64_t bps_conf[2]; 102 100 103 - /* internally used IOPS limits */ 101 + /* IOPS limits */ 104 102 unsigned int iops[2]; 105 - /* user configured IOPS limits */ 106 - unsigned int iops_conf[2]; 107 103 108 104 /* Number of bytes dispatched in current slice */ 109 105 uint64_t bytes_disp[2];
+36 -11
block/blk-zoned.c
··· 450 450 return test_bit(disk_zone_no(disk, sector), disk->conv_zones_bitmap); 451 451 } 452 452 453 + static bool disk_zone_is_last(struct gendisk *disk, struct blk_zone *zone) 454 + { 455 + return zone->start + zone->len >= get_capacity(disk); 456 + } 457 + 458 + static bool disk_zone_is_full(struct gendisk *disk, 459 + unsigned int zno, unsigned int offset_in_zone) 460 + { 461 + if (zno < disk->nr_zones - 1) 462 + return offset_in_zone >= disk->zone_capacity; 463 + return offset_in_zone >= disk->last_zone_capacity; 464 + } 465 + 466 + static bool disk_zone_wplug_is_full(struct gendisk *disk, 467 + struct blk_zone_wplug *zwplug) 468 + { 469 + return disk_zone_is_full(disk, zwplug->zone_no, zwplug->wp_offset); 470 + } 471 + 453 472 static bool disk_insert_zone_wplug(struct gendisk *disk, 454 473 struct blk_zone_wplug *zwplug) 455 474 { ··· 562 543 return false; 563 544 564 545 /* We can remove zone write plugs for zones that are empty or full. */ 565 - return !zwplug->wp_offset || zwplug->wp_offset >= disk->zone_capacity; 546 + return !zwplug->wp_offset || disk_zone_wplug_is_full(disk, zwplug); 566 547 } 567 548 568 549 static void disk_remove_zone_wplug(struct gendisk *disk, ··· 683 664 static void disk_zone_wplug_abort_unaligned(struct gendisk *disk, 684 665 struct blk_zone_wplug *zwplug) 685 666 { 686 - unsigned int zone_capacity = disk->zone_capacity; 687 667 unsigned int wp_offset = zwplug->wp_offset; 688 668 struct bio_list bl = BIO_EMPTY_LIST; 689 669 struct bio *bio; 690 670 691 671 while ((bio = bio_list_pop(&zwplug->bio_list))) { 692 - if (wp_offset >= zone_capacity || 672 + if (disk_zone_is_full(disk, zwplug->zone_no, wp_offset) || 693 673 (bio_op(bio) != REQ_OP_ZONE_APPEND && 694 674 bio_offset_from_zone_start(bio) != wp_offset)) { 695 675 blk_zone_wplug_bio_io_error(zwplug, bio); ··· 927 909 sector_t req_back_sector = blk_rq_pos(req) + blk_rq_sectors(req); 928 910 struct request_queue *q = req->q; 929 911 struct gendisk *disk = q->disk; 930 - unsigned int zone_capacity = disk->zone_capacity; 931 912 struct blk_zone_wplug *zwplug = 932 913 disk_get_zone_wplug(disk, blk_rq_pos(req)); 933 914 unsigned long flags; ··· 950 933 * into the back of the request. 951 934 */ 952 935 spin_lock_irqsave(&zwplug->lock, flags); 953 - while (zwplug->wp_offset < zone_capacity) { 936 + while (!disk_zone_wplug_is_full(disk, zwplug)) { 954 937 bio = bio_list_peek(&zwplug->bio_list); 955 938 if (!bio) 956 939 break; ··· 996 979 * We know such BIO will fail, and that would potentially overflow our 997 980 * write pointer offset beyond the end of the zone. 998 981 */ 999 - if (zwplug->wp_offset >= disk->zone_capacity) 982 + if (disk_zone_wplug_is_full(disk, zwplug)) 1000 983 goto err; 1001 984 1002 985 if (bio_op(bio) == REQ_OP_ZONE_APPEND) { ··· 1573 1556 kfree(disk->conv_zones_bitmap); 1574 1557 disk->conv_zones_bitmap = NULL; 1575 1558 disk->zone_capacity = 0; 1559 + disk->last_zone_capacity = 0; 1576 1560 disk->nr_zones = 0; 1577 1561 } 1578 1562 ··· 1618 1600 unsigned long *conv_zones_bitmap; 1619 1601 unsigned int nr_zones; 1620 1602 unsigned int zone_capacity; 1603 + unsigned int last_zone_capacity; 1621 1604 sector_t sector; 1622 1605 }; 1623 1606 ··· 1636 1617 1637 1618 disk->nr_zones = args->nr_zones; 1638 1619 disk->zone_capacity = args->zone_capacity; 1620 + disk->last_zone_capacity = args->last_zone_capacity; 1639 1621 swap(disk->conv_zones_bitmap, args->conv_zones_bitmap); 1640 1622 if (disk->conv_zones_bitmap) 1641 1623 nr_conv_zones = bitmap_weight(disk->conv_zones_bitmap, ··· 1688 1668 return -ENODEV; 1689 1669 } 1690 1670 1671 + if (disk_zone_is_last(disk, zone)) 1672 + args->last_zone_capacity = zone->capacity; 1673 + 1691 1674 if (!disk_need_zone_resources(disk)) 1692 1675 return 0; 1693 1676 ··· 1716 1693 1717 1694 /* 1718 1695 * Remember the capacity of the first sequential zone and check 1719 - * if it is constant for all zones. 1696 + * if it is constant for all zones, ignoring the last zone as it can be 1697 + * smaller. 1720 1698 */ 1721 1699 if (!args->zone_capacity) 1722 1700 args->zone_capacity = zone->capacity; 1723 - if (zone->capacity != args->zone_capacity) { 1701 + if (disk_zone_is_last(disk, zone)) { 1702 + args->last_zone_capacity = zone->capacity; 1703 + } else if (zone->capacity != args->zone_capacity) { 1724 1704 pr_warn("%s: Invalid variable zone capacity\n", 1725 1705 disk->disk_name); 1726 1706 return -ENODEV; ··· 1758 1732 { 1759 1733 struct blk_revalidate_zone_args *args = data; 1760 1734 struct gendisk *disk = args->disk; 1761 - sector_t capacity = get_capacity(disk); 1762 1735 sector_t zone_sectors = disk->queue->limits.chunk_sectors; 1763 1736 int ret; 1764 1737 ··· 1768 1743 return -ENODEV; 1769 1744 } 1770 1745 1771 - if (zone->start >= capacity || !zone->len) { 1746 + if (zone->start >= get_capacity(disk) || !zone->len) { 1772 1747 pr_warn("%s: Invalid zone start %llu, length %llu\n", 1773 1748 disk->disk_name, zone->start, zone->len); 1774 1749 return -ENODEV; ··· 1778 1753 * All zones must have the same size, with the exception on an eventual 1779 1754 * smaller last zone. 1780 1755 */ 1781 - if (zone->start + zone->len < capacity) { 1756 + if (!disk_zone_is_last(disk, zone)) { 1782 1757 if (zone->len != zone_sectors) { 1783 1758 pr_warn("%s: Invalid zoned device with non constant zone size\n", 1784 1759 disk->disk_name);
+1
drivers/block/null_blk/main.c
··· 494 494 495 495 set_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags); 496 496 dev->power = newp; 497 + ret = count; 497 498 } else if (dev->power && !newp) { 498 499 if (test_and_clear_bit(NULLB_DEV_FL_UP, &dev->flags)) { 499 500 dev->power = newp;
+12 -1
drivers/block/null_blk/zoned.c
··· 74 74 return -EINVAL; 75 75 } 76 76 77 + /* 78 + * If a smaller zone capacity was requested, do not allow a smaller last 79 + * zone at the same time as such zone configuration does not correspond 80 + * to any real zoned device. 81 + */ 82 + if (dev->zone_capacity != dev->zone_size && 83 + dev->size & (dev->zone_size - 1)) { 84 + pr_err("A smaller last zone is not allowed with zone capacity smaller than zone size.\n"); 85 + return -EINVAL; 86 + } 87 + 77 88 zone_capacity_sects = mb_to_sects(dev->zone_capacity); 78 89 dev_capacity_sects = mb_to_sects(dev->size); 79 90 dev->zone_size_sects = mb_to_sects(dev->zone_size); ··· 119 108 if (dev->zone_max_active && dev->zone_max_open > dev->zone_max_active) { 120 109 dev->zone_max_open = dev->zone_max_active; 121 110 pr_info("changed the maximum number of open zones to %u\n", 122 - dev->nr_zones); 111 + dev->zone_max_open); 123 112 } else if (dev->zone_max_open >= dev->nr_zones - dev->zone_nr_conv) { 124 113 dev->zone_max_open = 0; 125 114 pr_info("zone_max_open limit disabled, limit >= zone count\n");
+7 -14
drivers/md/bcache/alloc.c
··· 129 129 130 130 bool bch_can_invalidate_bucket(struct cache *ca, struct bucket *b) 131 131 { 132 - BUG_ON(!ca->set->gc_mark_valid); 133 - 134 - return (!GC_MARK(b) || 135 - GC_MARK(b) == GC_MARK_RECLAIMABLE) && 136 - !atomic_read(&b->pin) && 137 - can_inc_bucket_gen(b); 132 + return (ca->set->gc_mark_valid || b->reclaimable_in_gc) && 133 + ((!GC_MARK(b) || GC_MARK(b) == GC_MARK_RECLAIMABLE) && 134 + !atomic_read(&b->pin) && can_inc_bucket_gen(b)); 138 135 } 139 136 140 137 void __bch_invalidate_one_bucket(struct cache *ca, struct bucket *b) ··· 145 148 bch_inc_gen(ca, b); 146 149 b->prio = INITIAL_PRIO; 147 150 atomic_inc(&b->pin); 151 + b->reclaimable_in_gc = 0; 148 152 } 149 153 150 154 static void bch_invalidate_one_bucket(struct cache *ca, struct bucket *b) ··· 350 352 */ 351 353 352 354 retry_invalidate: 353 - allocator_wait(ca, ca->set->gc_mark_valid && 354 - !ca->invalidate_needs_gc); 355 + allocator_wait(ca, !ca->invalidate_needs_gc); 355 356 invalidate_buckets(ca); 356 357 357 358 /* ··· 498 501 499 502 ca = c->cache; 500 503 b = bch_bucket_alloc(ca, reserve, wait); 501 - if (b == -1) 502 - goto err; 504 + if (b < 0) 505 + return -1; 503 506 504 507 k->ptr[0] = MAKE_PTR(ca->buckets[b].gen, 505 508 bucket_to_sector(c, b), ··· 508 511 SET_KEY_PTRS(k, 1); 509 512 510 513 return 0; 511 - err: 512 - bch_bucket_free(c, k); 513 - bkey_put(c, k); 514 - return -1; 515 514 } 516 515 517 516 int bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
+1
drivers/md/bcache/bcache.h
··· 200 200 uint8_t gen; 201 201 uint8_t last_gc; /* Most out of date gen in the btree */ 202 202 uint16_t gc_mark; /* Bitfield used by GC. See below for field */ 203 + uint16_t reclaimable_in_gc:1; 203 204 }; 204 205 205 206 /*
+6 -1
drivers/md/bcache/btree.c
··· 1741 1741 1742 1742 mutex_lock(&c->bucket_lock); 1743 1743 1744 - c->gc_mark_valid = 0; 1745 1744 c->gc_done = ZERO_KEY; 1746 1745 1747 1746 ca = c->cache; 1748 1747 for_each_bucket(b, ca) { 1749 1748 b->last_gc = b->gen; 1749 + if (bch_can_invalidate_bucket(ca, b)) 1750 + b->reclaimable_in_gc = 1; 1750 1751 if (!atomic_read(&b->pin)) { 1751 1752 SET_GC_MARK(b, 0); 1752 1753 SET_GC_SECTORS_USED(b, 0); 1753 1754 } 1754 1755 } 1755 1756 1757 + c->gc_mark_valid = 0; 1756 1758 mutex_unlock(&c->bucket_lock); 1757 1759 } 1758 1760 ··· 1810 1808 1811 1809 for_each_bucket(b, ca) { 1812 1810 c->need_gc = max(c->need_gc, bucket_gc_gen(b)); 1811 + 1812 + if (b->reclaimable_in_gc) 1813 + b->reclaimable_in_gc = 0; 1813 1814 1814 1815 if (atomic_read(&b->pin)) 1815 1816 continue;
+15 -1
drivers/md/bcache/request.c
··· 369 369 struct io *i; 370 370 371 371 if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags) || 372 - c->gc_stats.in_use > CUTOFF_CACHE_ADD || 373 372 (bio_op(bio) == REQ_OP_DISCARD)) 374 373 goto skip; 374 + 375 + if (c->gc_stats.in_use > CUTOFF_CACHE_ADD) { 376 + /* 377 + * If cached buckets are all clean now, 'true' will be 378 + * returned and all requests will bypass the cache device. 379 + * Then c->sectors_to_gc has no chance to be negative, and 380 + * gc thread won't wake up and caching won't work forever. 381 + * Here call force_wake_up_gc() to avoid such aftermath. 382 + */ 383 + if (BDEV_STATE(&dc->sb) == BDEV_STATE_CLEAN && 384 + c->gc_mark_valid) 385 + force_wake_up_gc(c); 386 + 387 + goto skip; 388 + } 375 389 376 390 if (mode == CACHE_MODE_NONE || 377 391 (mode == CACHE_MODE_WRITEAROUND &&
+6 -9
drivers/md/dm-table.c
··· 1981 1981 if (!dm_table_supports_secure_erase(t)) 1982 1982 limits->max_secure_erase_sectors = 0; 1983 1983 1984 - r = queue_limits_set(q, limits); 1985 - if (r) 1986 - return r; 1987 - 1988 1984 if (dm_table_supports_flush(t, (1UL << QUEUE_FLAG_WC))) { 1989 1985 wc = true; 1990 1986 if (dm_table_supports_flush(t, (1UL << QUEUE_FLAG_FUA))) ··· 2032 2036 * For a zoned target, setup the zones related queue attributes 2033 2037 * and resources necessary for zone append emulation if necessary. 2034 2038 */ 2035 - if (blk_queue_is_zoned(q)) { 2036 - r = dm_set_zones_restrictions(t, q); 2039 + if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && limits->zoned) { 2040 + r = dm_set_zones_restrictions(t, q, limits); 2037 2041 if (r) 2038 2042 return r; 2039 - if (blk_queue_is_zoned(q) && 2040 - !static_key_enabled(&zoned_enabled.key)) 2041 - static_branch_enable(&zoned_enabled); 2042 2043 } 2044 + 2045 + r = queue_limits_set(q, limits); 2046 + if (r) 2047 + return r; 2043 2048 2044 2049 dm_update_crypto_profile(q, t); 2045 2050
+33 -39
drivers/md/dm-zone.c
··· 160 160 return 0; 161 161 } 162 162 163 - static int dm_check_zoned(struct mapped_device *md, struct dm_table *t) 164 - { 165 - struct gendisk *disk = md->disk; 166 - unsigned int nr_conv_zones = 0; 167 - int ret; 168 - 169 - /* Count conventional zones */ 170 - md->zone_revalidate_map = t; 171 - ret = dm_blk_report_zones(disk, 0, UINT_MAX, 172 - dm_check_zoned_cb, &nr_conv_zones); 173 - md->zone_revalidate_map = NULL; 174 - if (ret < 0) { 175 - DMERR("Check zoned failed %d", ret); 176 - return ret; 177 - } 178 - 179 - /* 180 - * If we only have conventional zones, expose the mapped device as 181 - * a regular device. 182 - */ 183 - if (nr_conv_zones >= ret) { 184 - disk->queue->limits.max_open_zones = 0; 185 - disk->queue->limits.max_active_zones = 0; 186 - disk->queue->limits.zoned = false; 187 - clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 188 - disk->nr_zones = 0; 189 - } 190 - 191 - return 0; 192 - } 193 - 194 163 /* 195 164 * Revalidate the zones of a mapped device to initialize resource necessary 196 165 * for zone append emulation. Note that we cannot simply use the block layer ··· 220 251 return true; 221 252 } 222 253 223 - int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q) 254 + int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q, 255 + struct queue_limits *lim) 224 256 { 225 257 struct mapped_device *md = t->md; 258 + struct gendisk *disk = md->disk; 259 + unsigned int nr_conv_zones = 0; 226 260 int ret; 227 261 228 262 /* ··· 237 265 clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 238 266 } else { 239 267 set_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 240 - blk_queue_max_zone_append_sectors(q, 0); 268 + lim->max_zone_append_sectors = 0; 241 269 } 242 270 243 271 if (!get_capacity(md->disk)) 244 272 return 0; 245 273 246 274 /* 247 - * Check that the mapped device will indeed be zoned, that is, that it 248 - * has sequential write required zones. 275 + * Count conventional zones to check that the mapped device will indeed 276 + * have sequential write required zones. 249 277 */ 250 - ret = dm_check_zoned(md, t); 251 - if (ret) 278 + md->zone_revalidate_map = t; 279 + ret = dm_blk_report_zones(disk, 0, UINT_MAX, 280 + dm_check_zoned_cb, &nr_conv_zones); 281 + md->zone_revalidate_map = NULL; 282 + if (ret < 0) { 283 + DMERR("Check zoned failed %d", ret); 252 284 return ret; 253 - if (!blk_queue_is_zoned(q)) 285 + } 286 + 287 + /* 288 + * If we only have conventional zones, expose the mapped device as 289 + * a regular device. 290 + */ 291 + if (nr_conv_zones >= ret) { 292 + lim->max_open_zones = 0; 293 + lim->max_active_zones = 0; 294 + lim->zoned = false; 295 + clear_bit(DMF_EMULATE_ZONE_APPEND, &md->flags); 296 + disk->nr_zones = 0; 254 297 return 0; 298 + } 255 299 256 300 if (!md->disk->nr_zones) { 257 301 DMINFO("%s using %s zone append", ··· 275 287 queue_emulates_zone_append(q) ? "emulated" : "native"); 276 288 } 277 289 278 - return dm_revalidate_zones(md, t); 290 + ret = dm_revalidate_zones(md, t); 291 + if (ret < 0) 292 + return ret; 293 + 294 + if (!static_key_enabled(&zoned_enabled.key)) 295 + static_branch_enable(&zoned_enabled); 296 + return 0; 279 297 } 280 298 281 299 /*
+2 -1
drivers/md/dm.h
··· 101 101 /* 102 102 * Zoned targets related functions. 103 103 */ 104 - int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q); 104 + int dm_set_zones_restrictions(struct dm_table *t, struct request_queue *q, 105 + struct queue_limits *lim); 105 106 void dm_zone_endio(struct dm_io *io, struct bio *clone); 106 107 #ifdef CONFIG_BLK_DEV_ZONED 107 108 int dm_blk_report_zones(struct gendisk *disk, sector_t sector,
+70 -46
drivers/nvme/host/core.c
··· 414 414 } 415 415 } 416 416 417 - static inline void nvme_end_req(struct request *req) 417 + static inline void __nvme_end_req(struct request *req) 418 + { 419 + nvme_end_req_zoned(req); 420 + nvme_trace_bio_complete(req); 421 + if (req->cmd_flags & REQ_NVME_MPATH) 422 + nvme_mpath_end_request(req); 423 + } 424 + 425 + void nvme_end_req(struct request *req) 418 426 { 419 427 blk_status_t status = nvme_error_status(nvme_req(req)->status); 420 428 ··· 432 424 else 433 425 nvme_log_error(req); 434 426 } 435 - nvme_end_req_zoned(req); 436 - nvme_trace_bio_complete(req); 437 - if (req->cmd_flags & REQ_NVME_MPATH) 438 - nvme_mpath_end_request(req); 427 + __nvme_end_req(req); 439 428 blk_mq_end_request(req, status); 440 429 } 441 430 ··· 481 476 { 482 477 trace_nvme_complete_rq(req); 483 478 nvme_cleanup_cmd(req); 484 - nvme_end_req_zoned(req); 479 + __nvme_end_req(req); 485 480 } 486 481 EXPORT_SYMBOL_GPL(nvme_complete_batch_req); 487 482 ··· 678 673 kfree(ns); 679 674 } 680 675 681 - static inline bool nvme_get_ns(struct nvme_ns *ns) 676 + bool nvme_get_ns(struct nvme_ns *ns) 682 677 { 683 678 return kref_get_unless_zero(&ns->kref); 684 679 } ··· 3684 3679 struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid) 3685 3680 { 3686 3681 struct nvme_ns *ns, *ret = NULL; 3682 + int srcu_idx; 3687 3683 3688 - down_read(&ctrl->namespaces_rwsem); 3689 - list_for_each_entry(ns, &ctrl->namespaces, list) { 3684 + srcu_idx = srcu_read_lock(&ctrl->srcu); 3685 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 3690 3686 if (ns->head->ns_id == nsid) { 3691 3687 if (!nvme_get_ns(ns)) 3692 3688 continue; ··· 3697 3691 if (ns->head->ns_id > nsid) 3698 3692 break; 3699 3693 } 3700 - up_read(&ctrl->namespaces_rwsem); 3694 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 3701 3695 return ret; 3702 3696 } 3703 3697 EXPORT_SYMBOL_NS_GPL(nvme_find_get_ns, NVME_TARGET_PASSTHRU); ··· 3711 3705 3712 3706 list_for_each_entry_reverse(tmp, &ns->ctrl->namespaces, list) { 3713 3707 if (tmp->head->ns_id < ns->head->ns_id) { 3714 - list_add(&ns->list, &tmp->list); 3708 + list_add_rcu(&ns->list, &tmp->list); 3715 3709 return; 3716 3710 } 3717 3711 } ··· 3777 3771 if (nvme_update_ns_info(ns, info)) 3778 3772 goto out_unlink_ns; 3779 3773 3780 - down_write(&ctrl->namespaces_rwsem); 3774 + mutex_lock(&ctrl->namespaces_lock); 3781 3775 /* 3782 3776 * Ensure that no namespaces are added to the ctrl list after the queues 3783 3777 * are frozen, thereby avoiding a deadlock between scan and reset. 3784 3778 */ 3785 3779 if (test_bit(NVME_CTRL_FROZEN, &ctrl->flags)) { 3786 - up_write(&ctrl->namespaces_rwsem); 3780 + mutex_unlock(&ctrl->namespaces_lock); 3787 3781 goto out_unlink_ns; 3788 3782 } 3789 3783 nvme_ns_add_to_ctrl_list(ns); 3790 - up_write(&ctrl->namespaces_rwsem); 3784 + mutex_unlock(&ctrl->namespaces_lock); 3785 + synchronize_srcu(&ctrl->srcu); 3791 3786 nvme_get_ctrl(ctrl); 3792 3787 3793 3788 if (device_add_disk(ctrl->device, ns->disk, nvme_ns_attr_groups)) ··· 3811 3804 3812 3805 out_cleanup_ns_from_list: 3813 3806 nvme_put_ctrl(ctrl); 3814 - down_write(&ctrl->namespaces_rwsem); 3815 - list_del_init(&ns->list); 3816 - up_write(&ctrl->namespaces_rwsem); 3807 + mutex_lock(&ctrl->namespaces_lock); 3808 + list_del_rcu(&ns->list); 3809 + mutex_unlock(&ctrl->namespaces_lock); 3810 + synchronize_srcu(&ctrl->srcu); 3817 3811 out_unlink_ns: 3818 3812 mutex_lock(&ctrl->subsys->lock); 3819 3813 list_del_rcu(&ns->siblings); ··· 3864 3856 nvme_cdev_del(&ns->cdev, &ns->cdev_device); 3865 3857 del_gendisk(ns->disk); 3866 3858 3867 - down_write(&ns->ctrl->namespaces_rwsem); 3868 - list_del_init(&ns->list); 3869 - up_write(&ns->ctrl->namespaces_rwsem); 3859 + mutex_lock(&ns->ctrl->namespaces_lock); 3860 + list_del_rcu(&ns->list); 3861 + mutex_unlock(&ns->ctrl->namespaces_lock); 3862 + synchronize_srcu(&ns->ctrl->srcu); 3870 3863 3871 3864 if (last_path) 3872 3865 nvme_mpath_shutdown_disk(ns->head); ··· 3957 3948 struct nvme_ns *ns, *next; 3958 3949 LIST_HEAD(rm_list); 3959 3950 3960 - down_write(&ctrl->namespaces_rwsem); 3951 + mutex_lock(&ctrl->namespaces_lock); 3961 3952 list_for_each_entry_safe(ns, next, &ctrl->namespaces, list) { 3962 3953 if (ns->head->ns_id > nsid) 3963 - list_move_tail(&ns->list, &rm_list); 3954 + list_splice_init_rcu(&ns->list, &rm_list, 3955 + synchronize_rcu); 3964 3956 } 3965 - up_write(&ctrl->namespaces_rwsem); 3957 + mutex_unlock(&ctrl->namespaces_lock); 3958 + synchronize_srcu(&ctrl->srcu); 3966 3959 3967 3960 list_for_each_entry_safe(ns, next, &rm_list, list) 3968 3961 nvme_ns_remove(ns); 3969 - 3970 3962 } 3971 3963 3972 3964 static int nvme_scan_ns_list(struct nvme_ctrl *ctrl) ··· 4137 4127 /* this is a no-op when called from the controller reset handler */ 4138 4128 nvme_change_ctrl_state(ctrl, NVME_CTRL_DELETING_NOIO); 4139 4129 4140 - down_write(&ctrl->namespaces_rwsem); 4141 - list_splice_init(&ctrl->namespaces, &ns_list); 4142 - up_write(&ctrl->namespaces_rwsem); 4130 + mutex_lock(&ctrl->namespaces_lock); 4131 + list_splice_init_rcu(&ctrl->namespaces, &ns_list, synchronize_rcu); 4132 + mutex_unlock(&ctrl->namespaces_lock); 4133 + synchronize_srcu(&ctrl->srcu); 4143 4134 4144 4135 list_for_each_entry_safe(ns, next, &ns_list, list) 4145 4136 nvme_ns_remove(ns); ··· 4588 4577 key_put(ctrl->tls_key); 4589 4578 nvme_free_cels(ctrl); 4590 4579 nvme_mpath_uninit(ctrl); 4580 + cleanup_srcu_struct(&ctrl->srcu); 4591 4581 nvme_auth_stop(ctrl); 4592 4582 nvme_auth_free(ctrl); 4593 4583 __free_page(ctrl->discard_page); ··· 4621 4609 ctrl->passthru_err_log_enabled = false; 4622 4610 clear_bit(NVME_CTRL_FAILFAST_EXPIRED, &ctrl->flags); 4623 4611 spin_lock_init(&ctrl->lock); 4612 + mutex_init(&ctrl->namespaces_lock); 4613 + 4614 + ret = init_srcu_struct(&ctrl->srcu); 4615 + if (ret) 4616 + return ret; 4617 + 4624 4618 mutex_init(&ctrl->scan_lock); 4625 4619 INIT_LIST_HEAD(&ctrl->namespaces); 4626 4620 xa_init(&ctrl->cels); 4627 - init_rwsem(&ctrl->namespaces_rwsem); 4628 4621 ctrl->dev = dev; 4629 4622 ctrl->ops = ops; 4630 4623 ctrl->quirks = quirks; ··· 4709 4692 out: 4710 4693 if (ctrl->discard_page) 4711 4694 __free_page(ctrl->discard_page); 4695 + cleanup_srcu_struct(&ctrl->srcu); 4712 4696 return ret; 4713 4697 } 4714 4698 EXPORT_SYMBOL_GPL(nvme_init_ctrl); ··· 4718 4700 void nvme_mark_namespaces_dead(struct nvme_ctrl *ctrl) 4719 4701 { 4720 4702 struct nvme_ns *ns; 4703 + int srcu_idx; 4721 4704 4722 - down_read(&ctrl->namespaces_rwsem); 4723 - list_for_each_entry(ns, &ctrl->namespaces, list) 4705 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4706 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4724 4707 blk_mark_disk_dead(ns->disk); 4725 - up_read(&ctrl->namespaces_rwsem); 4708 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4726 4709 } 4727 4710 EXPORT_SYMBOL_GPL(nvme_mark_namespaces_dead); 4728 4711 4729 4712 void nvme_unfreeze(struct nvme_ctrl *ctrl) 4730 4713 { 4731 4714 struct nvme_ns *ns; 4715 + int srcu_idx; 4732 4716 4733 - down_read(&ctrl->namespaces_rwsem); 4734 - list_for_each_entry(ns, &ctrl->namespaces, list) 4717 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4718 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4735 4719 blk_mq_unfreeze_queue(ns->queue); 4736 - up_read(&ctrl->namespaces_rwsem); 4720 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4737 4721 clear_bit(NVME_CTRL_FROZEN, &ctrl->flags); 4738 4722 } 4739 4723 EXPORT_SYMBOL_GPL(nvme_unfreeze); ··· 4743 4723 int nvme_wait_freeze_timeout(struct nvme_ctrl *ctrl, long timeout) 4744 4724 { 4745 4725 struct nvme_ns *ns; 4726 + int srcu_idx; 4746 4727 4747 - down_read(&ctrl->namespaces_rwsem); 4748 - list_for_each_entry(ns, &ctrl->namespaces, list) { 4728 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4729 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 4749 4730 timeout = blk_mq_freeze_queue_wait_timeout(ns->queue, timeout); 4750 4731 if (timeout <= 0) 4751 4732 break; 4752 4733 } 4753 - up_read(&ctrl->namespaces_rwsem); 4734 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4754 4735 return timeout; 4755 4736 } 4756 4737 EXPORT_SYMBOL_GPL(nvme_wait_freeze_timeout); ··· 4759 4738 void nvme_wait_freeze(struct nvme_ctrl *ctrl) 4760 4739 { 4761 4740 struct nvme_ns *ns; 4741 + int srcu_idx; 4762 4742 4763 - down_read(&ctrl->namespaces_rwsem); 4764 - list_for_each_entry(ns, &ctrl->namespaces, list) 4743 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4744 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4765 4745 blk_mq_freeze_queue_wait(ns->queue); 4766 - up_read(&ctrl->namespaces_rwsem); 4746 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4767 4747 } 4768 4748 EXPORT_SYMBOL_GPL(nvme_wait_freeze); 4769 4749 4770 4750 void nvme_start_freeze(struct nvme_ctrl *ctrl) 4771 4751 { 4772 4752 struct nvme_ns *ns; 4753 + int srcu_idx; 4773 4754 4774 4755 set_bit(NVME_CTRL_FROZEN, &ctrl->flags); 4775 - down_read(&ctrl->namespaces_rwsem); 4776 - list_for_each_entry(ns, &ctrl->namespaces, list) 4756 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4757 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4777 4758 blk_freeze_queue_start(ns->queue); 4778 - up_read(&ctrl->namespaces_rwsem); 4759 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4779 4760 } 4780 4761 EXPORT_SYMBOL_GPL(nvme_start_freeze); 4781 4762 ··· 4820 4797 void nvme_sync_io_queues(struct nvme_ctrl *ctrl) 4821 4798 { 4822 4799 struct nvme_ns *ns; 4800 + int srcu_idx; 4823 4801 4824 - down_read(&ctrl->namespaces_rwsem); 4825 - list_for_each_entry(ns, &ctrl->namespaces, list) 4802 + srcu_idx = srcu_read_lock(&ctrl->srcu); 4803 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) 4826 4804 blk_sync_queue(ns->queue); 4827 - up_read(&ctrl->namespaces_rwsem); 4805 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 4828 4806 } 4829 4807 EXPORT_SYMBOL_GPL(nvme_sync_io_queues); 4830 4808
+9 -6
drivers/nvme/host/ioctl.c
··· 789 789 bool open_for_write) 790 790 { 791 791 struct nvme_ns *ns; 792 - int ret; 792 + int ret, srcu_idx; 793 793 794 - down_read(&ctrl->namespaces_rwsem); 794 + srcu_idx = srcu_read_lock(&ctrl->srcu); 795 795 if (list_empty(&ctrl->namespaces)) { 796 796 ret = -ENOTTY; 797 797 goto out_unlock; 798 798 } 799 799 800 - ns = list_first_entry(&ctrl->namespaces, struct nvme_ns, list); 800 + ns = list_first_or_null_rcu(&ctrl->namespaces, struct nvme_ns, list); 801 801 if (ns != list_last_entry(&ctrl->namespaces, struct nvme_ns, list)) { 802 802 dev_warn(ctrl->device, 803 803 "NVME_IOCTL_IO_CMD not supported when multiple namespaces present!\n"); ··· 807 807 808 808 dev_warn(ctrl->device, 809 809 "using deprecated NVME_IOCTL_IO_CMD ioctl on the char device!\n"); 810 - kref_get(&ns->kref); 811 - up_read(&ctrl->namespaces_rwsem); 810 + if (!nvme_get_ns(ns)) { 811 + ret = -ENXIO; 812 + goto out_unlock; 813 + } 814 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 812 815 813 816 ret = nvme_user_cmd(ctrl, ns, argp, 0, open_for_write); 814 817 nvme_put_ns(ns); 815 818 return ret; 816 819 817 820 out_unlock: 818 - up_read(&ctrl->namespaces_rwsem); 821 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 819 822 return ret; 820 823 } 821 824
+15 -11
drivers/nvme/host/multipath.c
··· 118 118 blk_steal_bios(&ns->head->requeue_list, req); 119 119 spin_unlock_irqrestore(&ns->head->requeue_lock, flags); 120 120 121 - blk_mq_end_request(req, 0); 121 + nvme_req(req)->status = 0; 122 + nvme_end_req(req); 122 123 kblockd_schedule_work(&ns->head->requeue_work); 123 124 } 124 125 ··· 151 150 void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl) 152 151 { 153 152 struct nvme_ns *ns; 153 + int srcu_idx; 154 154 155 - down_read(&ctrl->namespaces_rwsem); 156 - list_for_each_entry(ns, &ctrl->namespaces, list) { 155 + srcu_idx = srcu_read_lock(&ctrl->srcu); 156 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 157 157 if (!ns->head->disk) 158 158 continue; 159 159 kblockd_schedule_work(&ns->head->requeue_work); 160 160 if (nvme_ctrl_state(ns->ctrl) == NVME_CTRL_LIVE) 161 161 disk_uevent(ns->head->disk, KOBJ_CHANGE); 162 162 } 163 - up_read(&ctrl->namespaces_rwsem); 163 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 164 164 } 165 165 166 166 static const char *nvme_ana_state_names[] = { ··· 195 193 void nvme_mpath_clear_ctrl_paths(struct nvme_ctrl *ctrl) 196 194 { 197 195 struct nvme_ns *ns; 196 + int srcu_idx; 198 197 199 - down_read(&ctrl->namespaces_rwsem); 200 - list_for_each_entry(ns, &ctrl->namespaces, list) { 198 + srcu_idx = srcu_read_lock(&ctrl->srcu); 199 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 201 200 nvme_mpath_clear_current_path(ns); 202 201 kblockd_schedule_work(&ns->head->requeue_work); 203 202 } 204 - up_read(&ctrl->namespaces_rwsem); 203 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 205 204 } 206 205 207 206 void nvme_mpath_revalidate_paths(struct nvme_ns *ns) ··· 598 595 int node, srcu_idx; 599 596 600 597 srcu_idx = srcu_read_lock(&head->srcu); 601 - for_each_node(node) 598 + for_each_online_node(node) 602 599 __nvme_find_path(head, node); 603 600 srcu_read_unlock(&head->srcu, srcu_idx); 604 601 } ··· 683 680 u32 nr_nsids = le32_to_cpu(desc->nnsids), n = 0; 684 681 unsigned *nr_change_groups = data; 685 682 struct nvme_ns *ns; 683 + int srcu_idx; 686 684 687 685 dev_dbg(ctrl->device, "ANA group %d: %s.\n", 688 686 le32_to_cpu(desc->grpid), ··· 695 691 if (!nr_nsids) 696 692 return 0; 697 693 698 - down_read(&ctrl->namespaces_rwsem); 699 - list_for_each_entry(ns, &ctrl->namespaces, list) { 694 + srcu_idx = srcu_read_lock(&ctrl->srcu); 695 + list_for_each_entry_rcu(ns, &ctrl->namespaces, list) { 700 696 unsigned nsid; 701 697 again: 702 698 nsid = le32_to_cpu(desc->nsids[n]); ··· 709 705 if (ns->head->ns_id > nsid) 710 706 goto again; 711 707 } 712 - up_read(&ctrl->namespaces_rwsem); 708 + srcu_read_unlock(&ctrl->srcu, srcu_idx); 713 709 return 0; 714 710 } 715 711
+4 -3
drivers/nvme/host/nvme.h
··· 282 282 struct blk_mq_tag_set *tagset; 283 283 struct blk_mq_tag_set *admin_tagset; 284 284 struct list_head namespaces; 285 - struct rw_semaphore namespaces_rwsem; 285 + struct mutex namespaces_lock; 286 + struct srcu_struct srcu; 286 287 struct device ctrl_device; 287 288 struct device *device; /* char device */ 288 289 #ifdef CONFIG_NVME_HWMON ··· 472 471 u8 pi_type; 473 472 u8 pi_offset; 474 473 u8 guard_type; 475 - u16 sgs; 476 - u32 sws; 477 474 #ifdef CONFIG_BLK_DEV_ZONED 478 475 u64 zsze; 479 476 #endif ··· 766 767 } 767 768 } 768 769 770 + void nvme_end_req(struct request *req); 769 771 void nvme_complete_rq(struct request *req); 770 772 void nvme_complete_batch_req(struct request *req); 771 773 ··· 1161 1161 struct nvme_command *cmd, int status); 1162 1162 struct nvme_ctrl *nvme_ctrl_from_file(struct file *file); 1163 1163 struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid); 1164 + bool nvme_get_ns(struct nvme_ns *ns); 1164 1165 void nvme_put_ns(struct nvme_ns *ns); 1165 1166 1166 1167 static inline bool nvme_multi_css(struct nvme_ctrl *ctrl)
+2 -1
drivers/nvme/host/pci.c
··· 778 778 struct bio_vec bv = req_bvec(req); 779 779 780 780 if (!is_pci_p2pdma_page(bv.bv_page)) { 781 - if (bv.bv_offset + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2) 781 + if ((bv.bv_offset & (NVME_CTRL_PAGE_SIZE - 1)) + 782 + bv.bv_len <= NVME_CTRL_PAGE_SIZE * 2) 782 783 return nvme_setup_prp_simple(dev, req, 783 784 &cmnd->rw, &bv); 784 785
+8
drivers/nvme/target/configfs.c
··· 676 676 if (kstrtobool(page, &enable)) 677 677 return -EINVAL; 678 678 679 + /* 680 + * take a global nvmet_config_sem because the disable routine has a 681 + * window where it releases the subsys-lock, giving a chance to 682 + * a parallel enable to concurrently execute causing the disable to 683 + * have a misaccounting of the ns percpu_ref. 684 + */ 685 + down_write(&nvmet_config_sem); 679 686 if (enable) 680 687 ret = nvmet_ns_enable(ns); 681 688 else 682 689 nvmet_ns_disable(ns); 690 + up_write(&nvmet_config_sem); 683 691 684 692 return ret ? ret : count; 685 693 }
+9
drivers/nvme/target/core.c
··· 818 818 percpu_ref_exit(&sq->ref); 819 819 nvmet_auth_sq_free(sq); 820 820 821 + /* 822 + * we must reference the ctrl again after waiting for inflight IO 823 + * to complete. Because admin connect may have sneaked in after we 824 + * store sq->ctrl locally, but before we killed the percpu_ref. the 825 + * admin connect allocates and assigns sq->ctrl, which now needs a 826 + * final ref put, as this ctrl is going away. 827 + */ 828 + ctrl = sq->ctrl; 829 + 821 830 if (ctrl) { 822 831 /* 823 832 * The teardown flow may take some time, and the host may not
+3 -1
drivers/scsi/sd.c
··· 3700 3700 */ 3701 3701 if (sdkp->first_scan || 3702 3702 q->limits.max_sectors > q->limits.max_dev_sectors || 3703 - q->limits.max_sectors > q->limits.max_hw_sectors) 3703 + q->limits.max_sectors > q->limits.max_hw_sectors) { 3704 3704 q->limits.max_sectors = rw_max; 3705 + q->limits.max_user_sectors = rw_max; 3706 + } 3705 3707 3706 3708 sdkp->first_scan = 0; 3707 3709
-10
include/linux/blk-integrity.h
··· 66 66 return q->integrity.profile; 67 67 } 68 68 69 - static inline void blk_queue_max_integrity_segments(struct request_queue *q, 70 - unsigned int segs) 71 - { 72 - q->limits.max_integrity_segments = segs; 73 - } 74 - 75 69 static inline unsigned short 76 70 queue_max_integrity_segments(const struct request_queue *q) 77 71 { ··· 143 149 { 144 150 } 145 151 static inline void blk_integrity_unregister(struct gendisk *d) 146 - { 147 - } 148 - static inline void blk_queue_max_integrity_segments(struct request_queue *q, 149 - unsigned int segs) 150 152 { 151 153 } 152 154 static inline unsigned short
+1
include/linux/blkdev.h
··· 186 186 */ 187 187 unsigned int nr_zones; 188 188 unsigned int zone_capacity; 189 + unsigned int last_zone_capacity; 189 190 unsigned long *conv_zones_bitmap; 190 191 unsigned int zone_wplugs_hash_bits; 191 192 spinlock_t zone_wplugs_lock;