On Wed, Nov 23, 2011 at 3:42 AM, Zhi Yong Wu <zwu.ker...@gmail.com> wrote:
> On Thu, Nov 17, 2011 at 9:40 PM, Stefan Hajnoczi
> <stefa...@linux.vnet.ibm.com> wrote:
>>     tracked_request_begin(&req, bs, sector_num, nb_sectors, false);
>> +
>> +    if (bs->copy_on_read) {
> Why is  tracked_request_begin/end() not put inside the brace around
> bs->copy_on_read?
> If this COR function is not enabled, i guess that request tracing
> function should not be need.

It's not safe to put the calls inside the "if (bs->copy_on_read) {"
body because turning off copy_on_read while a request is pending would
leave the request in the tracked list forever!

In a previous version of the series there was a flag to turn request
tracking on/off.  Pending requests would still remove themselves from
the list even after request tracking was disabled.

But request tracking is cheap - it involves filling in fields on the
stack and adding them to a linked list.  So to keep things simple we
always maintain this list.

Stefan

Reply via email to