generic_make_request not locked
/*
* We only want one ->make_request_fn to be active at a time,
* else stack usage with stacked devices could be a problem.
* So use current->bio_list to keep a list of requests
* submited by a make_request_fn function.
* current->bio_list is also used as a flag to say if
* generic_make_request is currently active in this task or not.
* If it is NULL, then no make_request is active. If it is non-NULL,
* then a make_request is active, and new requests should be added
* at the tail
*/
void generic_make_request(struct bio *bio)
{
...
if (current->bio_list) {
/* make_request is active */
bio_list_add(current->bio_list, bio);
return;
}...
}
current->bio_list is a global variable, and generic_make_request would run on multithread environment, so, i don't understand why here( bio_list_add ) not lock? thx everybody.ÿôèº{.nÇ+‰·Ÿ®‰†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºÊ‡Ú™ë,j¢f£¢·hš�ï�êÿ‘êçz_è®(階ŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨èÚ&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿÃÿ¶ìÿ¢¸?–I¥
Quoted 19 lines · remaper
/*
* We only want one ->make_request_fn to be active at a time,
* else stack usage with stacked devices could be a problem.
* So usecurrent->bio_listto keep a list of requests
* submited by amake_request_fnfunction.
*current->bio_listis also used as a flag to say if
*generic_make_requestis currently active in this task or not.
* If it is NULL, then nomake_requestis active. If it is non-NULL,
* then amake_requestis active, and new requests should be added
* at the tail
*/
voidgeneric_make_request(struct bio *bio)
{
...if (current->bio_list) { /* make_request is active */ bio_list_add(current->bio_list, bio); return; }
Quoted 6 lines
...
}
current->bio_listis a global variable, andgeneric_make_requestwould run on multithread environment, so, i don't understand whyhere( bio_list_add )not lock? thx everybody.
'current' refers to the task currently executing task. So current->bio_list isn't shared, hence there's no need for any locking.
Signature · 1 line
Jens Axboe