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.5-2023-07-21' of git://git.kernel.dk/linux

Pull block fixes from Jens Axboe:

- Fix for loop regressions (Mauricio)

- Fix a potential stall with batched wakeups in sbitmap (David)

- Fix for stall with recursive plug flushes (Ross)

- Skip accounting of empty requests for blk-iocost (Chengming)

- Remove a dead field in struct blk_mq_hw_ctx (Chengming)

* tag 'block-6.5-2023-07-21' of git://git.kernel.dk/linux:
loop: do not enforce max_loop hard limit by (new) default
loop: deprecate autoloading callback loop_probe()
sbitmap: fix batching wakeup
blk-iocost: skip empty flush bio in iocost
blk-mq: delete dead struct blk_mq_hw_ctx->queued field
blk-mq: Fix stall due to recursive flush plug

+58 -15
+1 -2
block/blk-core.c
··· 1144 1144 { 1145 1145 if (!list_empty(&plug->cb_list)) 1146 1146 flush_plug_callbacks(plug, from_schedule); 1147 - if (!rq_list_empty(plug->mq_list)) 1148 - blk_mq_flush_plug_list(plug, from_schedule); 1147 + blk_mq_flush_plug_list(plug, from_schedule); 1149 1148 /* 1150 1149 * Unconditionally flush out cached requests, even if the unplug 1151 1150 * event came from schedule. Since we know hold references to the
+4
block/blk-iocost.c
··· 2516 2516 u64 seek_pages = 0; 2517 2517 u64 cost = 0; 2518 2518 2519 + /* Can't calculate cost for empty bio */ 2520 + if (!bio->bi_iter.bi_size) 2521 + goto out; 2522 + 2519 2523 switch (bio_op(bio)) { 2520 2524 case REQ_OP_READ: 2521 2525 coef_seqio = ioc->params.lcoefs[LCOEF_RSEQIO];
+8 -1
block/blk-mq.c
··· 2754 2754 { 2755 2755 struct request *rq; 2756 2756 2757 - if (rq_list_empty(plug->mq_list)) 2757 + /* 2758 + * We may have been called recursively midway through handling 2759 + * plug->mq_list via a schedule() in the driver's queue_rq() callback. 2760 + * To avoid mq_list changing under our feet, clear rq_count early and 2761 + * bail out specifically if rq_count is 0 rather than checking 2762 + * whether the mq_list is empty. 2763 + */ 2764 + if (plug->rq_count == 0) 2758 2765 return; 2759 2766 plug->rq_count = 0; 2760 2767
+38 -2
drivers/block/loop.c
··· 1775 1775 /* 1776 1776 * If max_loop is specified, create that many devices upfront. 1777 1777 * This also becomes a hard limit. If max_loop is not specified, 1778 + * the default isn't a hard limit (as before commit 85c50197716c 1779 + * changed the default value from 0 for max_loop=0 reasons), just 1778 1780 * create CONFIG_BLK_DEV_LOOP_MIN_COUNT loop devices at module 1779 1781 * init time. Loop devices can be requested on-demand with the 1780 1782 * /dev/loop-control interface, or be instantiated by accessing 1781 1783 * a 'dead' device node. 1782 1784 */ 1783 1785 static int max_loop = CONFIG_BLK_DEV_LOOP_MIN_COUNT; 1784 - module_param(max_loop, int, 0444); 1786 + 1787 + #ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD 1788 + static bool max_loop_specified; 1789 + 1790 + static int max_loop_param_set_int(const char *val, 1791 + const struct kernel_param *kp) 1792 + { 1793 + int ret; 1794 + 1795 + ret = param_set_int(val, kp); 1796 + if (ret < 0) 1797 + return ret; 1798 + 1799 + max_loop_specified = true; 1800 + return 0; 1801 + } 1802 + 1803 + static const struct kernel_param_ops max_loop_param_ops = { 1804 + .set = max_loop_param_set_int, 1805 + .get = param_get_int, 1806 + }; 1807 + 1808 + module_param_cb(max_loop, &max_loop_param_ops, &max_loop, 0444); 1785 1809 MODULE_PARM_DESC(max_loop, "Maximum number of loop devices"); 1810 + #else 1811 + module_param(max_loop, int, 0444); 1812 + MODULE_PARM_DESC(max_loop, "Initial number of loop devices"); 1813 + #endif 1814 + 1786 1815 module_param(max_part, int, 0444); 1787 1816 MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device"); 1788 1817 ··· 2122 2093 put_disk(lo->lo_disk); 2123 2094 } 2124 2095 2096 + #ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD 2125 2097 static void loop_probe(dev_t dev) 2126 2098 { 2127 2099 int idx = MINOR(dev) >> part_shift; 2128 2100 2129 - if (max_loop && idx >= max_loop) 2101 + if (max_loop_specified && max_loop && idx >= max_loop) 2130 2102 return; 2131 2103 loop_add(idx); 2132 2104 } 2105 + #else 2106 + #define loop_probe NULL 2107 + #endif /* !CONFIG_BLOCK_LEGACY_AUTOLOAD */ 2133 2108 2134 2109 static int loop_control_remove(int idx) 2135 2110 { ··· 2314 2281 static int __init max_loop_setup(char *str) 2315 2282 { 2316 2283 max_loop = simple_strtol(str, NULL, 0); 2284 + #ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD 2285 + max_loop_specified = true; 2286 + #endif 2317 2287 return 1; 2318 2288 } 2319 2289
-2
include/linux/blk-mq.h
··· 397 397 */ 398 398 struct blk_mq_tags *sched_tags; 399 399 400 - /** @queued: Number of queued requests. */ 401 - unsigned long queued; 402 400 /** @run: Number of dispatched requests. */ 403 401 unsigned long run; 404 402
+7 -8
lib/sbitmap.c
··· 550 550 551 551 static void __sbitmap_queue_wake_up(struct sbitmap_queue *sbq, int nr) 552 552 { 553 - int i, wake_index; 553 + int i, wake_index, woken; 554 554 555 555 if (!atomic_read(&sbq->ws_active)) 556 556 return; ··· 567 567 */ 568 568 wake_index = sbq_index_inc(wake_index); 569 569 570 - /* 571 - * It is sufficient to wake up at least one waiter to 572 - * guarantee forward progress. 573 - */ 574 - if (waitqueue_active(&ws->wait) && 575 - wake_up_nr(&ws->wait, nr)) 576 - break; 570 + if (waitqueue_active(&ws->wait)) { 571 + woken = wake_up_nr(&ws->wait, nr); 572 + if (woken == nr) 573 + break; 574 + nr -= woken; 575 + } 577 576 } 578 577 579 578 if (wake_index != atomic_read(&sbq->wake_index))