Welcome! Log In Create A New Profile

Advanced

Using blk_make_request() kAPI for REQ_TYPE_BLOCK_PC commands

Posted by dwata 
Using blk_make_request() kAPI for REQ_TYPE_BLOCK_PC commands
March 25, 2011 04:44AM
folks,

I need clarification about blk_make_request() usage. (Kernel 2.6.38).

1. [My understanding/Facts]

i) accroding to the source file comment,
blk_make_request() is "is the parallel of generic_make_request for
BLOCK_PC type commands".

ii) blk_make_request() calls:-
-> blk_rq_append_bio()
-> (under some condtion) ll_back_merge_fn()

In ll_back_merge_fn(),
there is a if-condition like below:-

if (unlikely(blk_pc_request(req)))
max_sectors = queue_max_hw_sectors(q);
else
max_sectors = queue_max_sectors(q)

iii) blk_make_request() calls
blk_get_request(), and calls blk_rq_append_bio() (see above).
req->cmd_type is _not_ set in blk_make_request().
Therefore,
the if-condition (in l_back_merge_fn() (see above)) executes
"max_sectors = queue_max_sectors(q)".

So, if I call blk_make_request(),
max_sectors will be _always_ "queue_max_sectors(q)",
rather than queue_max_hw_sectors(q).

This is my understanding.


2. [Question/Clarification Point]

Q1) Is there any "proper" way to use blk_make_request(),
AND,
let the code use queue_max_hw_sectors(q) as max_sectors?

Q2) If blk_make_request() is not expecting to be called for
REQ_TYPE_BLOCK_PC commands,
should I add a new function like,

blk_make_pc_request(...)
{
struct request *rq = blk_get_request(q, bio_data_dir(bio), gfp_mask);
(snip)
rq->cmd_type = REQ_TYPE_BLOCK_PC;

for_each_bio(bio) {
(snip)
}

return rq;
}
EXPORT_SYMBOL(blk_make_pc_request);

And, use this blk_make_pc_request or something
If I really need to have a execution path,
blk_make_pc_request()
-> blk_rq_append_bio()
-> ll_back_merge_fn()
-> max_sectors = queue_max_hw_sectors(q);

Is this a valid way?

It is very apprecaited if anybody can give me a clue.

Thanks very much.

BR
D. Watanabe
windows keyboard shortcuts
February 26, 2019 11:27AM
Nice post since if you want to move a files from one folder to another folder then you should try the windows shortcut keys of Microsoft. computer shortcut keys And if you couldn't know about windows shortcut keys then you should visit here and know the complete information of windows shortcut keys.
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 4 plus 12?
Message: