Pull block fixes from Jens Axboe: - NVMe pull request - add the IGNORE_DEV_SUBNQN quirk for Intel P4500/P4600 SSDs (Wu Zheng) - remove the unneeded ret variable in nvmf_dev_show (Changcheng Deng) - Fix for a hang regression introduced with a patch in the merge window, where low queue depth devices would not always get woken correctly (Laibin) - Small series fixing an IO accounting issue with bio backed dm devices (Mike, Yu) * tag 'block-5.17-2022-01-28' of git://git.kernel.dk/linux-block: dm: properly fix redundant bio-based IO accounting dm: revert partial fix for redundant bio-based IO accounting block: add bio_start_io_acct_time() to control start_time blk-mq: Fix wrong wakeup batch configuration which will cause hang nvme-fabrics: remove the unneeded ret variable in nvmf_dev_show nvme-pci: add the IGNORE_DEV_SUBNQN quirk for Intel P4500/P4600 SSDs blk-mq: fix missing blk_account_io_done() in error path block: fix memory leak in disk_register_independent_access_ranges
Unified · Split
| @@ -1061,20 +1061,32 @@ again: · 1060 unmodified lines | ||
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | static unsigned long __part_start_io_acct(struct block_device *part, |
| 1064 | − unsigned int sectors, unsigned int op) | |
| 1064 | + unsigned int sectors, unsigned int op, | |
| 1065 | + unsigned long start_time) | |
| 1065 | 1066 | { |
| 1066 | 1067 | const int sgrp = op_stat_group(op); |
| 1067 | − unsigned long now = READ_ONCE(jiffies); | |
| 1068 | 1068 | |
| 1069 | 1069 | part_stat_lock(); |
| 1070 | − update_io_ticks(part, now, false); | |
| 1070 | + update_io_ticks(part, start_time, false); | |
| 1071 | 1071 | part_stat_inc(part, ios[sgrp]); |
| 1072 | 1072 | part_stat_add(part, sectors[sgrp], sectors); |
| 1073 | 1073 | part_stat_local_inc(part, in_flight[op_is_write(op)]); |
| 1074 | 1074 | part_stat_unlock(); |
| 1075 | 1075 | |
| 1076 | − return now; | |
| 1076 | + return start_time; | |
| 1077 | +} | |
| 1078 | + | |
| 1079 | +/** | |
| 1080 | + * bio_start_io_acct_time - start I/O accounting for bio based drivers | |
| 1081 | + * @bio: bio to start account for | |
| 1082 | + * @start_time: start time that should be passed back to bio_end_io_acct(). | |
| 1083 | + */ | |
| 1084 | +void bio_start_io_acct_time(struct bio *bio, unsigned long start_time) | |
| 1085 | +{ | |
| 1086 | + __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), | |
| 1087 | + bio_op(bio), start_time); | |
| 1077 | 1088 | } |
| 1089 | +EXPORT_SYMBOL_GPL(bio_start_io_acct_time); | |
| 1078 | 1090 | |
| 1079 | 1091 | /** |
| 1080 | 1092 | * bio_start_io_acct - start I/O accounting for bio based drivers |
| @@ -1084,14 +1096,15 @@ static unsigned long __part_start_io_acct(struct block_device *part, · 3 unmodified lines | ||
| 1084 | 1096 | */ |
| 1085 | 1097 | unsigned long bio_start_io_acct(struct bio *bio) |
| 1086 | 1098 | { |
| 1087 | − return __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), bio_op(bio)); | |
| 1099 | + return __part_start_io_acct(bio->bi_bdev, bio_sectors(bio), | |
| 1100 | + bio_op(bio), jiffies); | |
| 1088 | 1101 | } |
| 1089 | 1102 | EXPORT_SYMBOL_GPL(bio_start_io_acct); |
| 1090 | 1103 | |
| 1091 | 1104 | unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, |
| 1092 | 1105 | unsigned int op) |
| 1093 | 1106 | { |
| 1094 | − return __part_start_io_acct(disk->part0, sectors, op); | |
| 1107 | + return __part_start_io_acct(disk->part0, sectors, op, jiffies); | |
| 1095 | 1108 | } |
| 1096 | 1109 | EXPORT_SYMBOL(disk_start_io_acct); |
| 1097 | 1110 | |
| @@ -144,7 +144,7 @@ int disk_register_independent_access_ranges(struct gendisk *disk, · 143 unmodified lines | ||
| 144 | 144 | &q->kobj, "%s", "independent_access_ranges"); |
| 145 | 145 | if (ret) { |
| 146 | 146 | q->ia_ranges = NULL; |
| 147 | − kfree(iars); | |
| 147 | + kobject_put(&iars->kobj); | |
| 148 | 148 | return ret; |
| 149 | 149 | } |
| 150 | 150 | |
| @@ -2922,6 +2922,8 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request * · 2921 unmodified lines | ||
| 2922 | 2922 | */ |
| 2923 | 2923 | blk_mq_run_dispatch_ops(rq->q, |
| 2924 | 2924 | ret = blk_mq_request_issue_directly(rq, true)); |
| 2925 | + if (ret) | |
| 2926 | + blk_account_io_done(rq, ktime_get_ns()); | |
| 2925 | 2927 | return ret; |
| 2926 | 2928 | } |
| 2927 | 2929 | EXPORT_SYMBOL_GPL(blk_insert_cloned_request); |
| @@ -489,7 +489,7 @@ static void start_io_acct(struct dm_io *io) · 488 unmodified lines | ||
| 489 | 489 | struct mapped_device *md = io->md; |
| 490 | 490 | struct bio *bio = io->orig_bio; |
| 491 | 491 | |
| 492 | − io->start_time = bio_start_io_acct(bio); | |
| 492 | + bio_start_io_acct_time(bio, io->start_time); | |
| 493 | 493 | if (unlikely(dm_stats_used(&md->stats))) |
| 494 | 494 | dm_stats_account_io(&md->stats, bio_data_dir(bio), |
| 495 | 495 | bio->bi_iter.bi_sector, bio_sectors(bio), |
| @@ -535,7 +535,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio) · 39 unmodified lines | ||
| 535 | 535 | io->md = md; |
| 536 | 536 | spin_lock_init(&io->endio_lock); |
| 537 | 537 | |
| 538 | − start_io_acct(io); | |
| 538 | + io->start_time = jiffies; | |
| 539 | 539 | |
| 540 | 540 | return io; |
| 541 | 541 | } |
| @@ -1442,9 +1442,6 @@ static void init_clone_info(struct clone_info *ci, struct mapped_device *md, · 900 unmodified lines | ||
| 1442 | 1442 | ci->sector = bio->bi_iter.bi_sector; |
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | −#define __dm_part_stat_sub(part, field, subnd) \ | |
| 1446 | − (part_stat_get(part, field) -= (subnd)) | |
| 1447 | − | |
| 1448 | 1445 | /* |
| 1449 | 1446 | * Entry point to split a bio into clones and submit them to the targets. |
| 1450 | 1447 | */ |
| @@ -1480,23 +1477,12 @@ static void __split_and_process_bio(struct mapped_device *md, · 29 unmodified lines | ||
| 1480 | 1477 | GFP_NOIO, &md->queue->bio_split); |
| 1481 | 1478 | ci.io->orig_bio = b; |
| 1482 | 1479 | |
| 1483 | − /* | |
| 1484 | − * Adjust IO stats for each split, otherwise upon queue | |
| 1485 | − * reentry there will be redundant IO accounting. | |
| 1486 | − * NOTE: this is a stop-gap fix, a proper fix involves | |
| 1487 | − * significant refactoring of DM core's bio splitting | |
| 1488 | − * (by eliminating DM's splitting and just using bio_split) | |
| 1489 | − */ | |
| 1490 | − part_stat_lock(); | |
| 1491 | − __dm_part_stat_sub(dm_disk(md)->part0, | |
| 1492 | − sectors[op_stat_group(bio_op(bio))], ci.sector_count); | |
| 1493 | − part_stat_unlock(); | |
| 1494 | − | |
| 1495 | 1480 | bio_chain(b, bio); |
| 1496 | 1481 | trace_block_split(b, bio->bi_iter.bi_sector); |
| 1497 | 1482 | submit_bio_noacct(bio); |
| 1498 | 1483 | } |
| 1499 | 1484 | } |
| 1485 | + start_io_acct(ci.io); | |
| 1500 | 1486 | |
| 1501 | 1487 | /* drop the extra reference count */ |
| 1502 | 1488 | dm_io_dec_pending(ci.io, errno_to_blk_status(error)); |
| @@ -1092,7 +1092,6 @@ static void __nvmf_concat_opt_tokens(struct seq_file *seq_file) · 1091 unmodified lines | ||
| 1092 | 1092 | static int nvmf_dev_show(struct seq_file *seq_file, void *private) |
| 1093 | 1093 | { |
| 1094 | 1094 | struct nvme_ctrl *ctrl; |
| 1095 | − int ret = 0; | |
| 1096 | 1095 | |
| 1097 | 1096 | mutex_lock(&nvmf_dev_mutex); |
| 1098 | 1097 | ctrl = seq_file->private; |
| @@ -1106,7 +1105,7 @@ static int nvmf_dev_show(struct seq_file *seq_file, void *private) · 7 unmodified lines | ||
| 1106 | 1105 | |
| 1107 | 1106 | out_unlock: |
| 1108 | 1107 | mutex_unlock(&nvmf_dev_mutex); |
| 1109 | − return ret; | |
| 1108 | + return 0; | |
| 1110 | 1109 | } |
| 1111 | 1110 | |
| 1112 | 1111 | static int nvmf_dev_open(struct inode *inode, struct file *file) |
| @@ -3391,7 +3391,8 @@ static const struct pci_device_id nvme_id_table[] = { · 3390 unmodified lines | ||
| 3391 | 3391 | NVME_QUIRK_DEALLOCATE_ZEROES, }, |
| 3392 | 3392 | { PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */ |
| 3393 | 3393 | .driver_data = NVME_QUIRK_STRIPE_SIZE | |
| 3394 | − NVME_QUIRK_DEALLOCATE_ZEROES, }, | |
| 3394 | + NVME_QUIRK_DEALLOCATE_ZEROES | | |
| 3395 | + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, | |
| 3395 | 3396 | { PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */ |
| 3396 | 3397 | .driver_data = NVME_QUIRK_STRIPE_SIZE | |
| 3397 | 3398 | NVME_QUIRK_DEALLOCATE_ZEROES, }, |
| @@ -1258,6 +1258,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors, · 1257 unmodified lines | ||
| 1258 | 1258 | void disk_end_io_acct(struct gendisk *disk, unsigned int op, |
| 1259 | 1259 | unsigned long start_time); |
| 1260 | 1260 | |
| 1261 | +void bio_start_io_acct_time(struct bio *bio, unsigned long start_time); | |
| 1261 | 1262 | unsigned long bio_start_io_acct(struct bio *bio); |
| 1262 | 1263 | void bio_end_io_acct_remapped(struct bio *bio, unsigned long start_time, |
| 1263 | 1264 | struct block_device *orig_bdev); |
| @@ -488,9 +488,13 @@ void sbitmap_queue_recalculate_wake_batch(struct sbitmap_queue *sbq, · 487 unmodified lines | ||
| 488 | 488 | unsigned int users) |
| 489 | 489 | { |
| 490 | 490 | unsigned int wake_batch; |
| 491 | + unsigned int min_batch; | |
| 492 | + unsigned int depth = (sbq->sb.depth + users - 1) / users; | |
| 491 | 493 | |
| 492 | − wake_batch = clamp_val((sbq->sb.depth + users - 1) / | |
| 493 | − users, 4, SBQ_WAKE_BATCH); | |
| 494 | + min_batch = sbq->sb.depth >= (4 * SBQ_WAIT_QUEUES) ? 4 : 1; | |
| 495 | + | |
| 496 | + wake_batch = clamp_val(depth / SBQ_WAIT_QUEUES, | |
| 497 | + min_batch, SBQ_WAKE_BATCH); | |
| 494 | 498 | __sbitmap_queue_update_wake_batch(sbq, wake_batch); |
| 495 | 499 | } |
| 496 | 500 | EXPORT_SYMBOL_GPL(sbitmap_queue_recalculate_wake_batch); |