From: adrian <> Date: Sun, 12 Aug 2001 20:02:01 +0000 (+0000) Subject: * oops - move the aiocb array to the queue, rather than the queue entry. X-Git-Tag: SQUID_3_0_PRE1~1447 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca77fd7fdcf20ec48a1683e86a322fce0f5d20ae;p=thirdparty%2Fsquid.git * oops - move the aiocb array to the queue, rather than the queue entry. * Write some comments outlining what the code is going to ahve to do. --- diff --git a/src/fs/coss/async_io.cc b/src/fs/coss/async_io.cc index 53851f1845..3288d977ee 100644 --- a/src/fs/coss/async_io.cc +++ b/src/fs/coss/async_io.cc @@ -11,7 +11,7 @@ * supports are read/write, and since COSS works on a single file * per storedir it should work just fine. * - * $Id: async_io.cc,v 1.1 2001/08/12 10:20:41 adrian Exp $ + * $Id: async_io.cc,v 1.2 2001/08/12 14:02:01 adrian Exp $ */ #include "squid.h" @@ -26,13 +26,47 @@ * with the dequeueing) */ + +/* Internal routines */ + +/* + * find a free aio slot. + * Return the index, or -1 if we can't find one. + */ +static int +a_file_findslot(async_queue_t *q) +{ + int i; + + /* Later we should use something a little more .. efficient :) */ + for (i = 0; i < MAX_ASYNCOP; i++) { + if (q->aq_queue[i].aq_e_state == AQ_ENTRY_FREE) + /* Found! */ + return i; + } + /* found nothing */ + return -1; +} + + + + +/* Exported routines */ + void a_file_read(async_queue_t *q, int fd, void *buf, int req_len, off_t offset, DRCB *callback, void *data) { assert(q->aq_state == AQ_STATE_SETUP); +#if 0 file_read(fd, buf, req_len, offset, callback, data); +#endif + /* Find a free slot */ + /* No free slot? Callback error, and return */ + + /* Mark slot as ours */ + /* Initiate aio */ } @@ -42,15 +76,36 @@ a_file_write(async_queue_t *q, int fd, off_t offset, void *buf, int len, { assert(q->aq_state == AQ_STATE_SETUP); +#if 0 file_write(fd, offset, buf, len, callback, data, freefunc); +#endif + /* Find a free slot */ + /* No free slot? Callback error, and return */ + /* Mark slot as ours */ + /* Initiate aio */ } +/* + * Note: we grab the state and free the state before calling the callback + * because this allows us to cut down the amount of time it'll take + * to find a free slot (since if we call the callback first, we're going + * to probably be allocated the slot _after_ this one..) + * + * I'll make it much more optimal later. + */ int a_file_callback(async_queue_t *q) { assert(q->aq_state == AQ_STATE_SETUP); + /* Loop through all slots */ + /* Active, get status */ + /* Ready? Grab the state locally */ + /* Free the state */ + /* Call callback */ + + return 0; } @@ -76,6 +131,7 @@ a_file_syncqueue(async_queue_t *q) { assert(q->aq_state == AQ_STATE_SETUP); + /* Good point? :-) */ } diff --git a/src/fs/coss/async_io.h b/src/fs/coss/async_io.h index 8202545ce5..348a5a58f2 100644 --- a/src/fs/coss/async_io.h +++ b/src/fs/coss/async_io.h @@ -20,7 +20,7 @@ typedef struct _async_queue async_queue_t; /* An async queue entry */ struct _async_queue_entry { async_queue_entry_state_t aq_e_state; - struct aiocb aq_e_queue[MAX_ASYNCOP]; + struct aiocb aq_e_aiocb; union { DRCB *read; DWCB *write; @@ -31,7 +31,7 @@ struct _async_queue_entry { /* An async queue */ struct _async_queue { async_queue_state_t aq_state; - async_queue_entry_t aq_queue; /* queued operations */ + async_queue_entry_t aq_queue[MAX_ASYNCOP]; /* queued ops */ int aq_numpending; /* Num of pending ops */ };