[Disksim-users] Question about addtoextraq and using the contents in extraq in the future

Ji-Yong Shin jiyong.shin at gmail.com
Sun Nov 30 08:16:08 EST 2008


Hi, I'm currently working on DiskSim, and I found some situations, which
seems to be a bug or my misuse of disksim functions:

When we call ioqueue_physical_access_done, ioqueue_remove_completed_request
and then ioqueue_remove_from_subqueue will be called to remove the iobuf
that was holding the ioreq_event that we are trying to remove from the
ioqueue. Then the "tmp" iobuf which was removed from
ioqueue_remove_from_subqueue will be added to extraq at the end
of ioqueue_remove_completed_request. At the same time queue->current which
is also pointing to the same position as "tmp" will point to extraq since
"tmp" has been added to extraq.
Now we want to remove another ioreq_event. We will follow the same procedure
as above. When we are selecting the "tmp" iobuf, containing
the ioreq_event, at the begining of ioqueue_remove_completed_request,
"queue->current" is pointing to extraq (actually the situation might have
been same in the procedure above). The following "if ((tmp->state !=
PENDING) || (ioqueue_request_match(done, tmp) == 0))" should let us find the
right tmp from the "queue->list" instead of selecting "queue->current" as
tmp. However, if the blkno and the opid of "queue->current," which once was
an iobuf and is currently in extraq, are the same as the opid and the
blkno of the ioreq_event we are removing, the "tmp" will be set as
"queue->current." Then ioqueue_remove_from_subqueue will try to remove
the "tmp (or a event in extraq)" and will cause an error because tmp->prev
is NULL.


When we add an event including ioreq_event or iobuf to extraq, doesn't it
means we do not care about the contents of the event any more?
 Why don't we wipe out the unneccesary data as soon as a event is added to
extraq or before reuse?

Maybe this situation was caused, because I created ioreq_events in my code
in the device level, which may have violated the opid generating rules.
To avoid this problem, I have added the code

"memset(temp->space, 0, DISKSIM_EVENT_SPACESIZE * sizeof(char));"

in the addtoextraq, but cause other ioqueue error. I also tried

"(iobuf *) temp)->opid = -1" or (= 0)
 "(iobuf *) temp)->blkno = -1" or (= 0)

which also cause other error in ioqueue.


My question is:

1. When event is added to extraq is it completely safe to wipe out all the
contents except for the variables connecting each other in the extraq?
If not what kind of information should be preserved?

2. Can you please explain some rules that I should observe when using
getfromextraq, addtoextraq and ioreq_copy?


Thank you :)

Ji-Yong Shin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/disksim-users/attachments/20081130/ea385b49/attachment.html>


More information about the Disksim-users mailing list