Skip to content

Commit 70a7dea

Browse files
jankaragregkh
authored andcommitted
bfq: Track whether bfq_group is still online
commit 09f8718 upstream. Track whether bfq_group is still online. We cannot rely on blkcg_gq->online because that gets cleared only after all policies are offlined and we need something that gets updated already under bfqd->lock when we are cleaning up our bfq_group to be able to guarantee that when we see online bfq_group, it will stay online while we are holding bfqd->lock lock. CC: [email protected] Tested-by: "yukuai (C)" <[email protected]> Signed-off-by: Jan Kara <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b06691a commit 70a7dea

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

block/bfq-cgroup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ static void bfq_pd_init(struct blkg_policy_data *pd)
553553
*/
554554
bfqg->bfqd = bfqd;
555555
bfqg->active_entities = 0;
556+
bfqg->online = true;
556557
bfqg->rq_pos_tree = RB_ROOT;
557558
}
558559

@@ -599,7 +600,6 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
599600
struct bfq_entity *entity;
600601

601602
bfqg = bfq_lookup_bfqg(bfqd, blkcg);
602-
603603
if (unlikely(!bfqg))
604604
return NULL;
605605

@@ -961,6 +961,7 @@ static void bfq_pd_offline(struct blkg_policy_data *pd)
961961

962962
put_async_queues:
963963
bfq_put_async_queues(bfqd, bfqg);
964+
bfqg->online = false;
964965

965966
spin_unlock_irqrestore(&bfqd->lock, flags);
966967
/*

block/bfq-iosched.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,8 @@ struct bfq_group {
901901

902902
/* reference counter (see comments in bfq_bic_update_cgroup) */
903903
int ref;
904+
/* Is bfq_group still online? */
905+
bool online;
904906

905907
struct bfq_entity entity;
906908
struct bfq_sched_data sched_data;

0 commit comments

Comments
 (0)