On 2020-05-04 19:09, Ming Lei wrote: > @@ -310,19 +313,30 @@ static void bt_tags_for_each(struct blk_mq_tags *tags, struct sbitmap_queue *bt, > /** > * blk_mq_all_tag_busy_iter - iterate over all started requests in a tag map > * @tags: Tag map to iterate over. > - * @fn: Pointer to the function that will be called for each started > - * request. @fn will be called as follows: @fn(rq, @priv, > - * reserved) where rq is a pointer to a request. 'reserved' > - * indicates whether or not @rq is a reserved request. Return > - * true to continue iterating tags, false to stop. > + * @fn: Pointer to the function that will be called for each request > + * when .busy_rq_fn(rq) returns true. @fn will be called as > + * follows: @fn(rq, @priv, reserved) where rq is a pointer to a > + * request. 'reserved' indicates whether or not @rq is a reserved > + * request. Return true to continue iterating tags, false to stop. > + * @busy_rq_fn: Pointer to the function that will be called for each request, > + * @busy_rq_fn's type is same with @fn. Only when @busy_rq_fn(rq, > + * @priv, reserved) returns true, @fn will be called on this rq. > * @priv: Will be passed as second argument to @fn. > */ > -static void blk_mq_all_tag_busy_iter(struct blk_mq_tags *tags, > - busy_tag_iter_fn *fn, void *priv) > +void blk_mq_all_tag_busy_iter(struct blk_mq_tags *tags, > + busy_tag_iter_fn *fn, busy_rq_iter_fn *busy_rq_fn, > + void *priv) > { The name 'busy_rq_fn' is not ideal because it is named after one specific use case, namely checking whether or not a request is busy (has already been started). How about using the name 'pred_fn' ('pred' from predicate because it controls whether the other function is called)? Since only the context that passes 'fn' can know what data structure 'priv' points to and since 'busy_rq_fn' is passed from another context, can 'busy_rq_fn' even know what data 'priv' points at? Has it been considered not to pass the 'priv' argument to 'busy_rq_fn'? Thanks, Bart.