/alps/fwbench

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/fwbench

« back to all changes in this revision

Viewing changes to seqreader.c

  • Committer: Suren A. Chilingaryan
  • Date: 2012-11-29 01:46:10 UTC
  • Revision ID: csa@dside.dyndns.org-20121129014610-zmfsryvmpc3alkf0
Fixes bugs in AIO mode

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
        ready = 0;
135
135
        while (1) {
136
136
            if (!done[curio%(AIO_MODE + EXTRA_BUFFERS)]) {
137
 
                err = io_getevents(aio, 1, AIO_MODE - events, &ev[events], NULL);
138
 
                if (err < 0) perror("Error waiting for AIO\n");
 
137
//              printf("%i,%i - %i [%i %i %i %i]\n", curio, schedio, events, done[0], done[1], done[2], done[3]);
 
138
                
 
139
                if (curio < schedio) {
 
140
                    err = io_getevents(aio, 1, AIO_MODE + EXTRA_BUFFERS - events, &ev[events], NULL);
 
141
                    if (err < 0) {
 
142
                        printf("Error waiting for AIO (%i)\n", -err);
 
143
                        exit(-1);
 
144
                    }
 
145
                } else {
 
146
                    err = 0;
 
147
                }
139
148
                
140
149
                if ((!ready)&&(err > 1)) {
141
150
                    printf("*** Multiple read requests (%i of %i) are finished simultaneously. It is either:\n", err, AIO_MODE);
154
163
                events += err;
155
164
                
156
165
                for (i = events - 1; (i >= 0)&&((schedio - curio) < (AIO_MODE + EXTRA_BUFFERS)); i--) {
 
166
//                  printf("sched (%i): %i\n", i, schedio);
157
167
                    struct iocb *newio = (struct iocb *)ev[i].obj;
158
168
                    memset(newio, 0, sizeof(struct iocb));
159
169
                    io_prep_pread(newio, fd, buffer + (schedio % (AIO_MODE + EXTRA_BUFFERS)) * BLOCK_SIZE, BLOCK_SIZE, schedio * BLOCK_SIZE);