Skip to content

Commit 0c9f4ac

Browse files
committed
Merge tag 'for-6.10/block-20240511' of git://git.kernel.dk/linux
Pull block updates from Jens Axboe: - Add a partscan attribute in sysfs, fixing an issue with systemd relying on an internal interface that went away. - Attempt #2 at making long running discards interruptible. The previous attempt went into 6.9, but we ended up mostly reverting it as it had issues. - Remove old ida_simple API in bcache - Support for zoned write plugging, greatly improving the performance on zoned devices. - Remove the old throttle low interface, which has been experimental since 2017 and never made it beyond that and isn't being used. - Remove page->index debugging checks in brd, as it hasn't caught anything and prepares us for removing in struct page. - MD pull request from Song - Don't schedule block workers on isolated CPUs * tag 'for-6.10/block-20240511' of git://git.kernel.dk/linux: (84 commits) blk-throttle: delay initialization until configuration blk-throttle: remove CONFIG_BLK_DEV_THROTTLING_LOW block: fix that util can be greater than 100% block: support to account io_ticks precisely block: add plug while submitting IO bcache: fix variable length array abuse in btree_iter bcache: Remove usage of the deprecated ida_simple_xx() API md: Revert "md: Fix overflow in is_mddev_idle" blk-lib: check for kill signal in ioctl BLKDISCARD block: add a bio_await_chain helper block: add a blk_alloc_discard_bio helper block: add a bio_chain_and_submit helper block: move discard checks into the ioctl handler block: remove the discard_granularity check in __blkdev_issue_discard block/ioctl: prefer different overflow check null_blk: Fix the WARNING: modpost: missing MODULE_DESCRIPTION() block: fix and simplify blkdevparts= cmdline parsing block: refine the EOF check in blkdev_iomap_begin block: add a partscan sysfs attribute for disks block: add a disk_has_partscan helper ...
2 parents 9961a78 + a3166c5 commit 0c9f4ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2646
-3040
lines changed

Documentation/ABI/stable/sysfs-block

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ Description:
101101
devices that support receiving integrity metadata.
102102

103103

104+
What: /sys/block/<disk>/partscan
105+
Date: May 2024
106+
Contact: Christoph Hellwig <[email protected]>
107+
Description:
108+
The /sys/block/<disk>/partscan files reports if partition
109+
scanning is enabled for the disk. It returns "1" if partition
110+
scanning is enabled, or "0" if not. The value type is a 32-bit
111+
unsigned integer, but only "0" and "1" are valid values.
112+
113+
104114
What: /sys/block/<disk>/<partition>/alignment_offset
105115
Date: April 2009
106116
Contact: Martin K. Petersen <[email protected]>
@@ -584,18 +594,6 @@ Description:
584594
the data. If no such restriction exists, this file will contain
585595
'0'. This file is writable for testing purposes.
586596

587-
588-
What: /sys/block/<disk>/queue/throttle_sample_time
589-
Date: March 2017
590-
591-
Description:
592-
[RW] This is the time window that blk-throttle samples data, in
593-
millisecond. blk-throttle makes decision based on the
594-
samplings. Lower time means cgroups have more smooth throughput,
595-
but higher CPU overhead. This exists only when
596-
CONFIG_BLK_DEV_THROTTLING_LOW is enabled.
597-
598-
599597
What: /sys/block/<disk>/queue/virt_boundary_mask
600598
Date: April 2021
601599

arch/loongarch/configs/loongson3_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ CONFIG_MODULE_FORCE_UNLOAD=y
7676
CONFIG_MODVERSIONS=y
7777
CONFIG_BLK_DEV_ZONED=y
7878
CONFIG_BLK_DEV_THROTTLING=y
79-
CONFIG_BLK_DEV_THROTTLING_LOW=y
8079
CONFIG_BLK_WBT=y
8180
CONFIG_BLK_CGROUP_IOLATENCY=y
8281
CONFIG_BLK_CGROUP_FC_APPID=y

block/Kconfig

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ config BLK_DEV_WRITE_MOUNTED
100100

101101
config BLK_DEV_ZONED
102102
bool "Zoned block device support"
103-
select MQ_IOSCHED_DEADLINE
104103
help
105104
Block layer zoned block device support. This option enables
106105
support for ZAC/ZBC/ZNS host-managed and host-aware zoned block
@@ -120,17 +119,6 @@ config BLK_DEV_THROTTLING
120119

121120
See Documentation/admin-guide/cgroup-v1/blkio-controller.rst for more information.
122121

123-
config BLK_DEV_THROTTLING_LOW
124-
bool "Block throttling .low limit interface support (EXPERIMENTAL)"
125-
depends on BLK_DEV_THROTTLING
126-
help
127-
Add .low limit interface for block throttling. The low limit is a best
128-
effort limit to prioritize cgroups. Depending on the setting, the limit
129-
can be used to protect cgroups in terms of bandwidth/iops and better
130-
utilize disk resource.
131-
132-
Note, this is an experimental interface and could be changed someday.
133-
134122
config BLK_WBT
135123
bool "Enable support for block device writeback throttling"
136124
help
@@ -198,10 +186,6 @@ config BLK_DEBUG_FS
198186
Unless you are building a kernel for a tiny system, you should
199187
say Y here.
200188

201-
config BLK_DEBUG_FS_ZONED
202-
bool
203-
default BLK_DEBUG_FS && BLK_DEV_ZONED
204-
205189
config BLK_SED_OPAL
206190
bool "Logic for interfacing with Opal enabled SEDs"
207191
depends on KEYS

block/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ obj-$(CONFIG_BLK_MQ_VIRTIO) += blk-mq-virtio.o
3333
obj-$(CONFIG_BLK_DEV_ZONED) += blk-zoned.o
3434
obj-$(CONFIG_BLK_WBT) += blk-wbt.o
3535
obj-$(CONFIG_BLK_DEBUG_FS) += blk-mq-debugfs.o
36-
obj-$(CONFIG_BLK_DEBUG_FS_ZONED)+= blk-mq-debugfs-zoned.o
3736
obj-$(CONFIG_BLK_SED_OPAL) += sed-opal.o
3837
obj-$(CONFIG_BLK_PM) += blk-pm.o
3938
obj-$(CONFIG_BLK_INLINE_ENCRYPTION) += blk-crypto.o blk-crypto-profile.o \

block/bio.c

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,29 @@ void bio_chain(struct bio *bio, struct bio *parent)
345345
}
346346
EXPORT_SYMBOL(bio_chain);
347347

348-
struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev,
349-
unsigned int nr_pages, blk_opf_t opf, gfp_t gfp)
348+
/**
349+
* bio_chain_and_submit - submit a bio after chaining it to another one
350+
* @prev: bio to chain and submit
351+
* @new: bio to chain to
352+
*
353+
* If @prev is non-NULL, chain it to @new and submit it.
354+
*
355+
* Return: @new.
356+
*/
357+
struct bio *bio_chain_and_submit(struct bio *prev, struct bio *new)
350358
{
351-
struct bio *new = bio_alloc(bdev, nr_pages, opf, gfp);
352-
353-
if (bio) {
354-
bio_chain(bio, new);
355-
submit_bio(bio);
359+
if (prev) {
360+
bio_chain(prev, new);
361+
submit_bio(prev);
356362
}
357-
358363
return new;
359364
}
365+
366+
struct bio *blk_next_bio(struct bio *bio, struct block_device *bdev,
367+
unsigned int nr_pages, blk_opf_t opf, gfp_t gfp)
368+
{
369+
return bio_chain_and_submit(bio, bio_alloc(bdev, nr_pages, opf, gfp));
370+
}
360371
EXPORT_SYMBOL_GPL(blk_next_bio);
361372

362373
static void bio_alloc_rescue(struct work_struct *work)
@@ -1384,6 +1395,26 @@ int submit_bio_wait(struct bio *bio)
13841395
}
13851396
EXPORT_SYMBOL(submit_bio_wait);
13861397

1398+
static void bio_wait_end_io(struct bio *bio)
1399+
{
1400+
complete(bio->bi_private);
1401+
bio_put(bio);
1402+
}
1403+
1404+
/*
1405+
* bio_await_chain - ends @bio and waits for every chained bio to complete
1406+
*/
1407+
void bio_await_chain(struct bio *bio)
1408+
{
1409+
DECLARE_COMPLETION_ONSTACK_MAP(done,
1410+
bio->bi_bdev->bd_disk->lockdep_map);
1411+
1412+
bio->bi_private = &done;
1413+
bio->bi_end_io = bio_wait_end_io;
1414+
bio_endio(bio);
1415+
blk_wait_io(&done);
1416+
}
1417+
13871418
void __bio_advance(struct bio *bio, unsigned bytes)
13881419
{
13891420
if (bio_integrity(bio))
@@ -1576,6 +1607,8 @@ void bio_endio(struct bio *bio)
15761607
if (!bio_integrity_endio(bio))
15771608
return;
15781609

1610+
blk_zone_bio_endio(bio);
1611+
15791612
rq_qos_done_bio(bio);
15801613

15811614
if (bio->bi_bdev && bio_flagged(bio, BIO_TRACE_COMPLETION)) {
@@ -1596,7 +1629,6 @@ void bio_endio(struct bio *bio)
15961629
goto again;
15971630
}
15981631

1599-
blk_throtl_bio_endio(bio);
16001632
/* release cgroup info */
16011633
bio_uninit(bio);
16021634
if (bio->bi_end_io)

block/blk-cgroup-rwstat.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,19 @@ int blkg_rwstat_init(struct blkg_rwstat *rwstat, gfp_t gfp)
99
{
1010
int i, ret;
1111

12-
for (i = 0; i < BLKG_RWSTAT_NR; i++) {
13-
ret = percpu_counter_init(&rwstat->cpu_cnt[i], 0, gfp);
14-
if (ret) {
15-
while (--i >= 0)
16-
percpu_counter_destroy(&rwstat->cpu_cnt[i]);
17-
return ret;
18-
}
12+
ret = percpu_counter_init_many(rwstat->cpu_cnt, 0, gfp, BLKG_RWSTAT_NR);
13+
if (ret)
14+
return ret;
15+
16+
for (i = 0; i < BLKG_RWSTAT_NR; i++)
1917
atomic64_set(&rwstat->aux_cnt[i], 0);
20-
}
2118
return 0;
2219
}
2320
EXPORT_SYMBOL_GPL(blkg_rwstat_init);
2421

2522
void blkg_rwstat_exit(struct blkg_rwstat *rwstat)
2623
{
27-
int i;
28-
29-
for (i = 0; i < BLKG_RWSTAT_NR; i++)
30-
percpu_counter_destroy(&rwstat->cpu_cnt[i]);
24+
percpu_counter_destroy_many(rwstat->cpu_cnt, BLKG_RWSTAT_NR);
3125
}
3226
EXPORT_SYMBOL_GPL(blkg_rwstat_exit);
3327

block/blk-cgroup.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ static void blkg_async_bio_workfn(struct work_struct *work)
218218

219219
/* as long as there are pending bios, @blkg can't go away */
220220
spin_lock(&blkg->async_bio_lock);
221-
bio_list_merge(&bios, &blkg->async_bios);
222-
bio_list_init(&blkg->async_bios);
221+
bio_list_merge_init(&bios, &blkg->async_bios);
223222
spin_unlock(&blkg->async_bio_lock);
224223

225224
/* start plug only when bio_list contains at least 2 bios */
@@ -1444,14 +1443,8 @@ int blkcg_init_disk(struct gendisk *disk)
14441443
if (ret)
14451444
goto err_destroy_all;
14461445

1447-
ret = blk_throtl_init(disk);
1448-
if (ret)
1449-
goto err_ioprio_exit;
1450-
14511446
return 0;
14521447

1453-
err_ioprio_exit:
1454-
blk_ioprio_exit(disk);
14551448
err_destroy_all:
14561449
blkg_destroy_all(disk);
14571450
return ret;

block/blk-core.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,7 @@ static inline blk_status_t blk_check_zone_append(struct request_queue *q,
591591
return BLK_STS_NOTSUPP;
592592

593593
/* The bio sector must point to the start of a sequential zone */
594-
if (!bdev_is_zone_start(bio->bi_bdev, bio->bi_iter.bi_sector) ||
595-
!bio_zone_is_seq(bio))
594+
if (!bdev_is_zone_start(bio->bi_bdev, bio->bi_iter.bi_sector))
596595
return BLK_STS_IOERR;
597596

598597
/*
@@ -604,7 +603,7 @@ static inline blk_status_t blk_check_zone_append(struct request_queue *q,
604603
return BLK_STS_IOERR;
605604

606605
/* Make sure the BIO is small enough and will not get split */
607-
if (nr_sectors > q->limits.max_zone_append_sectors)
606+
if (nr_sectors > queue_max_zone_append_sectors(q))
608607
return BLK_STS_IOERR;
609608

610609
bio->bi_opf |= REQ_NOMERGE;
@@ -649,11 +648,13 @@ static void __submit_bio(struct bio *bio)
649648
static void __submit_bio_noacct(struct bio *bio)
650649
{
651650
struct bio_list bio_list_on_stack[2];
651+
struct blk_plug plug;
652652

653653
BUG_ON(bio->bi_next);
654654

655655
bio_list_init(&bio_list_on_stack[0]);
656656
current->bio_list = bio_list_on_stack;
657+
blk_start_plug(&plug);
657658

658659
do {
659660
struct request_queue *q = bdev_get_queue(bio->bi_bdev);
@@ -687,19 +688,23 @@ static void __submit_bio_noacct(struct bio *bio)
687688
bio_list_merge(&bio_list_on_stack[0], &bio_list_on_stack[1]);
688689
} while ((bio = bio_list_pop(&bio_list_on_stack[0])));
689690

691+
blk_finish_plug(&plug);
690692
current->bio_list = NULL;
691693
}
692694

693695
static void __submit_bio_noacct_mq(struct bio *bio)
694696
{
695697
struct bio_list bio_list[2] = { };
698+
struct blk_plug plug;
696699

697700
current->bio_list = bio_list;
701+
blk_start_plug(&plug);
698702

699703
do {
700704
__submit_bio(bio);
701705
} while ((bio = bio_list_pop(&bio_list[0])));
702706

707+
blk_finish_plug(&plug);
703708
current->bio_list = NULL;
704709
}
705710

@@ -910,12 +915,6 @@ int bio_poll(struct bio *bio, struct io_comp_batch *iob, unsigned int flags)
910915
!test_bit(QUEUE_FLAG_POLL, &q->queue_flags))
911916
return 0;
912917

913-
/*
914-
* As the requests that require a zone lock are not plugged in the
915-
* first place, directly accessing the plug instead of using
916-
* blk_mq_plug() should not have any consequences during flushing for
917-
* zoned devices.
918-
*/
919918
blk_flush_plug(current->plug, false);
920919

921920
/*
@@ -987,10 +986,11 @@ void update_io_ticks(struct block_device *part, unsigned long now, bool end)
987986
unsigned long stamp;
988987
again:
989988
stamp = READ_ONCE(part->bd_stamp);
990-
if (unlikely(time_after(now, stamp))) {
991-
if (likely(try_cmpxchg(&part->bd_stamp, &stamp, now)))
992-
__part_stat_add(part, io_ticks, end ? now - stamp : 1);
993-
}
989+
if (unlikely(time_after(now, stamp)) &&
990+
likely(try_cmpxchg(&part->bd_stamp, &stamp, now)) &&
991+
(end || part_in_flight(part)))
992+
__part_stat_add(part, io_ticks, now - stamp);
993+
994994
if (part->bd_partno) {
995995
part = bdev_whole(part);
996996
goto again;

block/blk-flush.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ static void blk_flush_restore_request(struct request *rq)
130130
* original @rq->bio. Restore it.
131131
*/
132132
rq->bio = rq->biotail;
133+
if (rq->bio)
134+
rq->__sector = rq->bio->bi_iter.bi_sector;
133135

134136
/* make @rq a normal request */
135137
rq->rq_flags &= ~RQF_FLUSH_SEQ;

0 commit comments

Comments
 (0)