On Sun, 2017-05-28 at 10:37 +0200, Christoph Hellwig wrote:
> Oh, and btw - for the mq case we don't want to use the function
> pointer directly in the queue, but in blk_mq_ops, so that we have
> all the mq methods in one place.

Hello Christoph,

Are you sure of this? All other function pointers that apply to both blk-sq
and blk-mq occur in struct request, e.g. .make_request_fn(), .init_rq_fn()
and .exit_rq_fn(). If the .initialize_rq_fn() will be added to struct request
all I have to add to blk_get_request is the following:

        if (!IS_ERR(req) && q->initialize_rq_fn)
                q->initialize_rq_fn(req);

However, if for the mq case the .initialize_rq_fn() would be added to struct
blk_mq_ops then that code would look as follows:

        if (!IS_ERR(req))
                if (q->mq_ops)
                        q->mq_ops->initialize_rq_fn(req);
                else
                        q->initialize_rq_fn(req);

Personally I prefer the first alternative.

Bart.

Reply via email to