Cyril Hrubis wrote:
> Hi!
>> aio_suspend may be interrupted by IO request's completion signal, so we
>> should use aio_error instead signal hander to check whether this request
>> has complete.
... snip ...
>> /* Use SIGRTMIN+2 for list completion */
>> event.sigev_notify = SIGEV_SIGNAL;
>> - event.sigev_signo = SIGRTMIN+2;
>> + event.sigev_signo = SIGRTMIN+1;
>> event.sigev_value.sival_ptr = NULL;
>
> Fix comment here.
Thanks.
>
>> - /* Setup handler for individual operation completion */
>> + /* Setup handler for list completion */
>> action.sa_sigaction = sigrt1_handler;
>> sigemptyset(&action.sa_mask);
>> action.sa_flags = SA_SIGINFO|SA_RESTART;
>> sigaction(SIGRTMIN+1, &action, NULL);
>>
>> - /* Setup handler for list completion */
>> - action.sa_sigaction = sigrt2_handler;
>> - sigemptyset(&action.sa_mask);
>> - action.sa_flags = SA_SIGINFO|SA_RESTART;
>> - sigaction(SIGRTMIN+2, &action, NULL);
>> -
>> /* Setup suspend list */
>> plist[0] = NULL;
>> plist[1] = aiocbs[WAIT_FOR_AIOCB];
>>
>> /* Submit request list */
>> ret = lio_listio(LIO_NOWAIT, aiocbs, NUM_AIOCBS, &event);
>> -
>
> No need to remove newline here.
>
>> if (ret) {
>> printf(TNAME " Error at lio_listio() %d: %s\n", errno,
>> strerror(errno));
>> for (i=0; i<NUM_AIOCBS; i++)
>> @@ -165,9 +158,7 @@ main ()
>> }
>>
>> /* Check selected request has not completed yet */
>> - if (received_selected) {
>> - printf (TNAME " Error : AIOCB %d already completed before
>> suspend\n",
>> - WAIT_FOR_AIOCB);
>> + if (!selected_request_status(aiocbs[WAIT_FOR_AIOCB], EINPROGRESS)) {
>> for (i=0; i<NUM_AIOCBS; i++)
>> free (aiocbs[i]);
>> free (bufs);
>
> Any particular need to removing the printf() here?
>
en..., i will send a new path without removing this printf.
>> @@ -178,11 +169,8 @@ main ()
>>
>> /* Suspend on selected request */
>> ret = aio_suspend((const struct aiocb **)plist, 2, NULL);
>> -
>> - /* Check selected request has completed */
>> - if (!received_selected) {
>> - printf (TNAME " Error : AIOCB %d should have completed after
>> suspend\n",
>> - WAIT_FOR_AIOCB);
>> + if (ret) {
>> + printf (TNAME " Error at aio_suspend() %d: %s\n", errno,
>> strerror (errno));
>> for (i=0; i<NUM_AIOCBS; i++)
>> free (aiocbs[i]);
>> free (bufs);
>> @@ -191,9 +179,8 @@ main ()
>> exit (PTS_FAIL);
>> }
>>
>> -
>> - if (ret) {
>> - printf (TNAME " Error at aio_suspend() %d: %s\n", errno,
>> strerror (errno));
>> + /* Check selected request has completed */
>> + if (!selected_request_status(aiocbs[WAIT_FOR_AIOCB], 0)) {
>> for (i=0; i<NUM_AIOCBS; i++)
>> free (aiocbs[i]);
>> free (bufs);
>
> And here.
ditto, thanks.
>
--
Regards
Bian Naimeng
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list