Skip to content

Commit cb323ee

Browse files
committed
Merge tag 'block-5.17-2022-01-28' of git://git.kernel.dk/linux-block
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
2 parents 3b58e9f + b879f91 commit cb323ee

File tree

8 files changed

+35
-29
lines changed

8 files changed

+35
-29
lines changed

block/blk-core.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,20 +1061,32 @@ void update_io_ticks(struct block_device *part, unsigned long now, bool end)
10611061
}
10621062

10631063
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)
10651066
{
10661067
const int sgrp = op_stat_group(op);
1067-
unsigned long now = READ_ONCE(jiffies);
10681068

10691069
part_stat_lock();
1070-
update_io_ticks(part, now, false);
1070+
update_io_ticks(part, start_time, false);
10711071
part_stat_inc(part, ios[sgrp]);
10721072
part_stat_add(part, sectors[sgrp], sectors);
10731073
part_stat_local_inc(part, in_flight[op_is_write(op)]);
10741074
part_stat_unlock();
10751075

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);
10771088
}
1089+
EXPORT_SYMBOL_GPL(bio_start_io_acct_time);
10781090

10791091
/**
10801092
* 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,
10841096
*/
10851097
unsigned long bio_start_io_acct(struct bio *bio)
10861098
{
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);
10881101
}
10891102
EXPORT_SYMBOL_GPL(bio_start_io_acct);
10901103

10911104
unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
10921105
unsigned int op)
10931106
{
1094-
return __part_start_io_acct(disk->part0, sectors, op);
1107+
return __part_start_io_acct(disk->part0, sectors, op, jiffies);
10951108
}
10961109
EXPORT_SYMBOL(disk_start_io_acct);
10971110

block/blk-ia-ranges.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ int disk_register_independent_access_ranges(struct gendisk *disk,
144144
&q->kobj, "%s", "independent_access_ranges");
145145
if (ret) {
146146
q->ia_ranges = NULL;
147-
kfree(iars);
147+
kobject_put(&iars->kobj);
148148
return ret;
149149
}
150150

block/blk-mq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2922,6 +2922,8 @@ blk_status_t blk_insert_cloned_request(struct request_queue *q, struct request *
29222922
*/
29232923
blk_mq_run_dispatch_ops(rq->q,
29242924
ret = blk_mq_request_issue_directly(rq, true));
2925+
if (ret)
2926+
blk_account_io_done(rq, ktime_get_ns());
29252927
return ret;
29262928
}
29272929
EXPORT_SYMBOL_GPL(blk_insert_cloned_request);

drivers/md/dm.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static void start_io_acct(struct dm_io *io)
489489
struct mapped_device *md = io->md;
490490
struct bio *bio = io->orig_bio;
491491

492-
io->start_time = bio_start_io_acct(bio);
492+
bio_start_io_acct_time(bio, io->start_time);
493493
if (unlikely(dm_stats_used(&md->stats)))
494494
dm_stats_account_io(&md->stats, bio_data_dir(bio),
495495
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)
535535
io->md = md;
536536
spin_lock_init(&io->endio_lock);
537537

538-
start_io_acct(io);
538+
io->start_time = jiffies;
539539

540540
return io;
541541
}
@@ -1442,9 +1442,6 @@ static void init_clone_info(struct clone_info *ci, struct mapped_device *md,
14421442
ci->sector = bio->bi_iter.bi_sector;
14431443
}
14441444

1445-
#define __dm_part_stat_sub(part, field, subnd) \
1446-
(part_stat_get(part, field) -= (subnd))
1447-
14481445
/*
14491446
* Entry point to split a bio into clones and submit them to the targets.
14501447
*/
@@ -1480,23 +1477,12 @@ static void __split_and_process_bio(struct mapped_device *md,
14801477
GFP_NOIO, &md->queue->bio_split);
14811478
ci.io->orig_bio = b;
14821479

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-
14951480
bio_chain(b, bio);
14961481
trace_block_split(b, bio->bi_iter.bi_sector);
14971482
submit_bio_noacct(bio);
14981483
}
14991484
}
1485+
start_io_acct(ci.io);
15001486

15011487
/* drop the extra reference count */
15021488
dm_io_dec_pending(ci.io, errno_to_blk_status(error));

drivers/nvme/host/fabrics.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,6 @@ static void __nvmf_concat_opt_tokens(struct seq_file *seq_file)
10921092
static int nvmf_dev_show(struct seq_file *seq_file, void *private)
10931093
{
10941094
struct nvme_ctrl *ctrl;
1095-
int ret = 0;
10961095

10971096
mutex_lock(&nvmf_dev_mutex);
10981097
ctrl = seq_file->private;
@@ -1106,7 +1105,7 @@ static int nvmf_dev_show(struct seq_file *seq_file, void *private)
11061105

11071106
out_unlock:
11081107
mutex_unlock(&nvmf_dev_mutex);
1109-
return ret;
1108+
return 0;
11101109
}
11111110

11121111
static int nvmf_dev_open(struct inode *inode, struct file *file)

drivers/nvme/host/pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3391,7 +3391,8 @@ static const struct pci_device_id nvme_id_table[] = {
33913391
NVME_QUIRK_DEALLOCATE_ZEROES, },
33923392
{ PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */
33933393
.driver_data = NVME_QUIRK_STRIPE_SIZE |
3394-
NVME_QUIRK_DEALLOCATE_ZEROES, },
3394+
NVME_QUIRK_DEALLOCATE_ZEROES |
3395+
NVME_QUIRK_IGNORE_DEV_SUBNQN, },
33953396
{ PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */
33963397
.driver_data = NVME_QUIRK_STRIPE_SIZE |
33973398
NVME_QUIRK_DEALLOCATE_ZEROES, },

include/linux/blkdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
12581258
void disk_end_io_acct(struct gendisk *disk, unsigned int op,
12591259
unsigned long start_time);
12601260

1261+
void bio_start_io_acct_time(struct bio *bio, unsigned long start_time);
12611262
unsigned long bio_start_io_acct(struct bio *bio);
12621263
void bio_end_io_acct_remapped(struct bio *bio, unsigned long start_time,
12631264
struct block_device *orig_bdev);

lib/sbitmap.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,13 @@ void sbitmap_queue_recalculate_wake_batch(struct sbitmap_queue *sbq,
488488
unsigned int users)
489489
{
490490
unsigned int wake_batch;
491+
unsigned int min_batch;
492+
unsigned int depth = (sbq->sb.depth + users - 1) / users;
491493

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);
494498
__sbitmap_queue_update_wake_batch(sbq, wake_batch);
495499
}
496500
EXPORT_SYMBOL_GPL(sbitmap_queue_recalculate_wake_batch);

0 commit comments

Comments
 (0)