windows-store-biod-20070204

Add a 'failed' parameter to the cm_ReleaseBIOD function.  This enables
the clearing of the CM_BUF_DIRTY flag to be conditional upon successful
completion of the store operation.
This commit is contained in:
Jeffrey Altman 2007-02-04 15:37:34 +00:00
parent 78c83150f6
commit 333005c463
3 changed files with 17 additions and 9 deletions

View File

@ -95,6 +95,8 @@ void cm_BkgDaemon(long parm)
osi_assert(cm_bkgQueueCount-- > 0); osi_assert(cm_bkgQueueCount-- > 0);
lock_ReleaseWrite(&cm_daemonLock); lock_ReleaseWrite(&cm_daemonLock);
osi_Log1(afsd_logp,"cm_BkgDaemon processing request 0x%p", rp);
#ifdef DEBUG_REFCOUNT #ifdef DEBUG_REFCOUNT
osi_Log2(afsd_logp,"cm_BkgDaemon (before) scp 0x%x ref %d",rp->scp, rp->scp->refCount); osi_Log2(afsd_logp,"cm_BkgDaemon (before) scp 0x%x ref %d",rp->scp, rp->scp->refCount);
#endif #endif
@ -111,7 +113,10 @@ void cm_BkgDaemon(long parm)
lock_ObtainWrite(&cm_daemonLock); lock_ObtainWrite(&cm_daemonLock);
switch ( code ) { switch ( code ) {
case CM_ERROR_TIMEDOUT: case 0: /* success */
osi_Log1(afsd_logp,"cm_BkgDaemon SUCCESS: request 0x%p", rp);
break;
case CM_ERROR_TIMEDOUT: /* or server restarting */
case CM_ERROR_RETRY: case CM_ERROR_RETRY:
case CM_ERROR_WOULDBLOCK: case CM_ERROR_WOULDBLOCK:
case CM_ERROR_ALLBUSY: case CM_ERROR_ALLBUSY:
@ -124,7 +129,7 @@ void cm_BkgDaemon(long parm)
osi_QAddT((osi_queue_t **) &cm_bkgListp, (osi_queue_t **)&cm_bkgListEndp, &rp->q); osi_QAddT((osi_queue_t **) &cm_bkgListp, (osi_queue_t **)&cm_bkgListEndp, &rp->q);
break; break;
default: default:
osi_Log2(afsd_logp,"cm_BkgDaemon failed request dropped 0x%p code 0x%x", osi_Log2(afsd_logp,"cm_BkgDaemon FAILED: request dropped 0x%p code 0x%x",
rp, code); rp, code);
} }
} }

View File

@ -99,7 +99,7 @@ long cm_BufWrite(void *vscp, osi_hyper_t *offsetp, long length, long flags,
if (biod.length == 0) { if (biod.length == 0) {
osi_Log0(afsd_logp, "cm_SetupStoreBIOD length 0"); osi_Log0(afsd_logp, "cm_SetupStoreBIOD length 0");
lock_ReleaseMutex(&scp->mx); lock_ReleaseMutex(&scp->mx);
cm_ReleaseBIOD(&biod, 1); /* should be a NOOP */ cm_ReleaseBIOD(&biod, 1, 0); /* should be a NOOP */
return 0; return 0;
} }
@ -303,7 +303,7 @@ long cm_BufWrite(void *vscp, osi_hyper_t *offsetp, long length, long flags,
scp->flags |= CM_SCACHEFLAG_OVERQUOTA; scp->flags |= CM_SCACHEFLAG_OVERQUOTA;
} }
lock_ReleaseMutex(&scp->mx); lock_ReleaseMutex(&scp->mx);
cm_ReleaseBIOD(&biod, 1); cm_ReleaseBIOD(&biod, 1, code);
return code; return code;
} }
@ -1209,7 +1209,7 @@ long cm_SetupFetchBIOD(cm_scache_t *scp, osi_hyper_t *offsetp,
/* release a bulk I/O structure that was setup by cm_SetupFetchBIOD or by /* release a bulk I/O structure that was setup by cm_SetupFetchBIOD or by
* cm_SetupStoreBIOD * cm_SetupStoreBIOD
*/ */
void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore) void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed)
{ {
cm_scache_t *scp; /* do not release; not held in biop */ cm_scache_t *scp; /* do not release; not held in biop */
cm_buf_t *bufp; cm_buf_t *bufp;
@ -1250,7 +1250,10 @@ void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore)
osi_Log2(afsd_logp, "cm_ReleaseBIOD Waking [scp 0x%p] bp 0x%p", scp, bufp); osi_Log2(afsd_logp, "cm_ReleaseBIOD Waking [scp 0x%p] bp 0x%p", scp, bufp);
osi_Wakeup((LONG_PTR) bufp); osi_Wakeup((LONG_PTR) bufp);
} }
bufp->flags &= ~(CM_BUF_WRITING | CM_BUF_DIRTY); if (failed)
bufp->flags &= ~CM_BUF_WRITING;
else
bufp->flags &= ~(CM_BUF_WRITING | CM_BUF_DIRTY);
} }
lock_ReleaseMutex(&scp->mx); lock_ReleaseMutex(&scp->mx);
@ -1340,7 +1343,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *up,
bufp->dataVersion = scp->dataVersion; bufp->dataVersion = scp->dataVersion;
} }
lock_ReleaseMutex(&scp->mx); lock_ReleaseMutex(&scp->mx);
cm_ReleaseBIOD(&biod, 0); cm_ReleaseBIOD(&biod, 0, 0);
lock_ObtainMutex(&scp->mx); lock_ObtainMutex(&scp->mx);
return 0; return 0;
} }
@ -1647,7 +1650,7 @@ long cm_GetBuffer(cm_scache_t *scp, cm_buf_t *bufp, int *cpffp, cm_user_t *up,
/* release scatter/gather I/O structure (buffers, locks) */ /* release scatter/gather I/O structure (buffers, locks) */
lock_ReleaseMutex(&scp->mx); lock_ReleaseMutex(&scp->mx);
cm_ReleaseBIOD(&biod, 0); cm_ReleaseBIOD(&biod, 0, code);
lock_ObtainMutex(&scp->mx); lock_ObtainMutex(&scp->mx);
if (code == 0) if (code == 0)

View File

@ -37,7 +37,7 @@ extern long cm_CheckFetchRange(cm_scache_t *scp, osi_hyper_t *startBasep,
extern long cm_SetupFetchBIOD(cm_scache_t *scp, osi_hyper_t *offsetp, extern long cm_SetupFetchBIOD(cm_scache_t *scp, osi_hyper_t *offsetp,
cm_bulkIO_t *biop, cm_user_t *up, cm_req_t *reqp); cm_bulkIO_t *biop, cm_user_t *up, cm_req_t *reqp);
extern void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore); extern void cm_ReleaseBIOD(cm_bulkIO_t *biop, int isStore, int failed);
extern long cm_SetupStoreBIOD(cm_scache_t *scp, osi_hyper_t *inOffsetp, extern long cm_SetupStoreBIOD(cm_scache_t *scp, osi_hyper_t *inOffsetp,
long inSize, cm_bulkIO_t *biop, cm_user_t *userp, cm_req_t *reqp); long inSize, cm_bulkIO_t *biop, cm_user_t *userp, cm_req_t *reqp);