Messages in this thread | | | Subject | Re: [PATCH -next v3 1/3] block, bfq: record how many queues are busy in bfq_group | From | "yukuai (C)" <> | Date | Thu, 28 Apr 2022 09:08:14 +0800 |
| |
在 2022/04/27 20:52, Jan Kara 写道: > On Wed 27-04-22 20:47:20, Yu Kuai wrote: >> Prepare to refactor the counting of 'num_groups_with_pending_reqs'. >> >> Add a counter 'busy_queues' in bfq_group, and update it in >> bfq_add/del_bfqq_busy(). >> >> Signed-off-by: Yu Kuai <yukuai3@huawei.com> > > ... > >> diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c >> index f8eb340381cf..53826797430f 100644 >> --- a/block/bfq-wf2q.c >> +++ b/block/bfq-wf2q.c >> @@ -218,6 +218,14 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity) >> return false; >> } >> >> +static void bfq_update_busy_queues(struct bfq_queue *bfqq, bool is_add) >> +{ >> + if (is_add) >> + bfqq_group(bfqq)->busy_queues++; >> + else >> + bfqq_group(bfqq)->busy_queues--; >> +} >> + >> #else /* CONFIG_BFQ_GROUP_IOSCHED */ > > I think the bool argument here unnecessarily hurts readability (it's > difficult to see what the argument means without looking into the > implementation). I'd rather create two functions bfq_{inc,dec}_busy_queues() > or if you really insist on a single function, we can have > bfq_add_busy_queues() and have 'int' argument that will be +1 or -1.
Thanks for the suggestion, I'll create two functions in next iteration. > > Honza >
| |