lkml.org 
[lkml]   [2021]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH RFC 1/9] block, bfq: add new apis to iterate bfq entities
    Date
    The old and the new apis are the same currently, prepare to count
    root group into 'num_groups_with_pending_reqs'. The old apis will be
    used to iterate with root group's entity, and the new apis will be
    used to iterate without root group's entity.

    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
    ---
    block/bfq-iosched.h | 19 ++++++++++++++++++-
    1 file changed, 18 insertions(+), 1 deletion(-)

    diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h
    index a73488eec8a4..f5afc80ff11c 100644
    --- a/block/bfq-iosched.h
    +++ b/block/bfq-iosched.h
    @@ -1034,9 +1034,20 @@ extern struct blkcg_policy blkcg_policy_bfq;
    #define for_each_entity_safe(entity, parent) \
    for (; entity && ({ parent = entity->parent; 1; }); entity = parent)

    +#define is_root_entity(entity) \
    + (entity->sched_data == NULL)
    +
    +#define for_each_entity_not_root(entity) \
    + for (; entity && !is_root_entity(entity); entity = entity->parent)
    +
    +#define for_each_entity_not_root_safe(entity, parent) \
    + for (; entity && !is_root_entity(entity) && \
    + ({ parent = entity->parent; 1; }); entity = parent)
    #else /* CONFIG_BFQ_GROUP_IOSCHED */
    +#define is_root_entity(entity) (false)
    +
    /*
    - * Next two macros are fake loops when cgroups support is not
    + * Next four macros are fake loops when cgroups support is not
    * enabled. I fact, in such a case, there is only one level to go up
    * (to reach the root group).
    */
    @@ -1045,6 +1056,12 @@ extern struct blkcg_policy blkcg_policy_bfq;

    #define for_each_entity_safe(entity, parent) \
    for (parent = NULL; entity ; entity = parent)
    +
    +#define for_each_entity_not_root(entity) \
    + for (; entity ; entity = NULL)
    +
    +#define for_each_entity_not_root_safe(entity, parent) \
    + for (parent = NULL; entity ; entity = parent)
    #endif /* CONFIG_BFQ_GROUP_IOSCHED */

    struct bfq_group *bfq_bfqq_to_bfqg(struct bfq_queue *bfqq);
    --
    2.31.1
    \
     
     \ /
      Last update: 2021-11-27 11:01    [W:3.528 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site