From cac8dea092d62141da700c691b3609ed4dc08c04 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 22 Jan 2013 12:46:20 -0500 Subject: [PATCH] Windows: RDR_CleanupFile FSync only files If the cm_scache type is something other than a file, there is no point performing an FSync. Do not incur the overhead. Take into account any outstanding AsyncStore operations that might be in-flight. Change-Id: I66cd59cbcd81f2a7639e478832f921ac393ea3ae Reviewed-on: http://gerrit.openafs.org/8972 Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman --- src/WINNT/afsrdr/user/RDRFunction.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/WINNT/afsrdr/user/RDRFunction.c b/src/WINNT/afsrdr/user/RDRFunction.c index 0ecc03211..167491def 100644 --- a/src/WINNT/afsrdr/user/RDRFunction.c +++ b/src/WINNT/afsrdr/user/RDRFunction.c @@ -1796,7 +1796,7 @@ RDR_CleanupFileEntry( IN cm_user_t *userp, } cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS); - if ((bLastHandle || bFlushFile) && + if (bLastHandle && (scp->fileType == CM_SCACHETYPE_FILE) && scp->redirBufCount > 0) { LARGE_INTEGER heldExtents; @@ -1862,14 +1862,9 @@ RDR_CleanupFileEntry( IN cm_user_t *userp, /* If not a readonly object, flush dirty data and update metadata */ if (!(scp->flags & CM_SCACHEFLAG_RO)) { - if ((bLastHandle || bFlushFile) && - buf_DirtyBuffersExist(&scp->fid)) { - if (!bScpLocked) { - lock_ObtainWrite(&scp->rw); - bScpLocked = TRUE; - } - code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_WRITE, - CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS); + if ((scp->fileType == CM_SCACHETYPE_FILE) && (bLastHandle || bFlushFile)) { + /* Serialize with any outstanding AsyncStore operation */ + code = cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_ASYNCSTORE); if (code == 0) { if (bScpLocked) { lock_ReleaseWrite(&scp->rw); -- 2.39.5