Skip to content

Commit 01c5f85

Browse files
committed
blk-cgroup: increase number of supported policies
After merging the iolatency policy, we potentially now have 4 policies being registered, but only support 3. This causes one of them to fail loading. Takashi reports that BFQ no longer works for him, because it fails to load due to policy registration failure. Bump to 5 policies, and also add a warning for when we have exceeded the global amount. If we have to touch this again, we should switch to a dynamic scheme instead. Reported-by: Takashi Iwai <tiwai@suse.de> Reviewed-by: Jeff Moyer <jmoyer@redhat.com> Tested-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent bf93585 commit 01c5f85

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

block/blk-cgroup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,10 @@ int blkcg_policy_register(struct blkcg_policy *pol)
15101510
for (i = 0; i < BLKCG_MAX_POLS; i++)
15111511
if (!blkcg_policy[i])
15121512
break;
1513-
if (i >= BLKCG_MAX_POLS)
1513+
if (i >= BLKCG_MAX_POLS) {
1514+
pr_warn("blkcg_policy_register: BLKCG_MAX_POLS too small\n");
15141515
goto err_unlock;
1516+
}
15151517

15161518
/* Make sure cpd/pd_alloc_fn and cpd/pd_free_fn in pairs */
15171519
if ((!pol->cpd_alloc_fn ^ !pol->cpd_free_fn) ||

include/linux/blkdev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct blk_stat_callback;
5454
* Maximum number of blkcg policies allowed to be registered concurrently.
5555
* Defined here to simplify include dependency.
5656
*/
57-
#define BLKCG_MAX_POLS 3
57+
#define BLKCG_MAX_POLS 5
5858

5959
typedef void (rq_end_io_fn)(struct request *, blk_status_t);
6060

0 commit comments

Comments
 (0)