struct fd_event *event, uint16 flags,
void *p)
{
+ struct aio_extra *aio_ex = NULL;
struct aio_child *child = (struct aio_child *)p;
- uint64_t mid;
DEBUG(10, ("handle_aio_completion called with flags=%d\n", flags));
child->retval.size);
}
- /* FIXME - this won't work for SMB2. */
- mid = (uint64_t)child->aiocb->aio_sigevent.sigev_value.sival_int;
-
- DEBUG(10, ("mid %d finished\n", (int)mid));
-
- smbd_aio_complete_mid(mid);
+ smbd_aio_complete_aio_ex(aio_ex);
}
static int aio_child_destructor(struct aio_child *child)
struct aio_extra *aio_ex = (struct aio_extra *)
info->si_value.sival_ptr;
- smbd_aio_complete_mid(aio_ex->req->mid);
+ smbd_aio_complete_aio_ex(aio_ex);
}
return aio_ex;
}
-/****************************************************************************
- Given the mid find the extended aio struct containing it.
-*****************************************************************************/
-
-static struct aio_extra *find_aio_ex(uint64_t mid)
-{
- struct aio_extra *p;
-
- for( p = aio_list_head; p; p = p->next) {
- if (mid == p->req->mid) {
- return p;
- }
- }
- return NULL;
-}
-
-/****************************************************************************
- We can have these many aio buffers in flight.
-*****************************************************************************/
-
/****************************************************************************
Set up an aio request from a SMBreadX call.
*****************************************************************************/
Handle any aio completion inline.
*****************************************************************************/
-void smbd_aio_complete_mid(uint64_t mid)
+void smbd_aio_complete_aio_ex(struct aio_extra *aio_ex)
{
files_struct *fsp = NULL;
- struct aio_extra *aio_ex = find_aio_ex(mid);
int ret = 0;
outstanding_aio_calls--;
DEBUG(10,("smbd_aio_complete_mid: mid[%llu]\n",
- (unsigned long long)mid));
-
- if (!aio_ex) {
- DEBUG(3,("smbd_aio_complete_mid: Can't find record to "
- "match mid %llu.\n",
- (unsigned long long)mid));
- return;
- }
+ (unsigned long long)aio_ex->req->mid));
fsp = aio_ex->fsp;
if (fsp == NULL) {
* ignore. */
DEBUG( 3,( "smbd_aio_complete_mid: file closed whilst "
"aio outstanding (mid[%llu]).\n",
- (unsigned long long)mid));
+ (unsigned long long)aio_ex->req->mid));
return;
}