From: Jeffrey Altman Date: Sat, 27 Mar 2010 20:13:27 +0000 (-0400) Subject: Windows: buffers whose offsets are beyond EOF should be zero filled and locally allocated X-Git-Tag: openafs-devel-1_5_73_1~10 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=5d5da6eb4d5db9323ad0b89417d17ea577a0eb98;hp=1bb3522983ec7ee8e99ca28bb744601f1c15837c Windows: buffers whose offsets are beyond EOF should be zero filled and locally allocated When a buffer is being allocated for an offset that exceeds the file length as known to the file server, that buffer should be zero filled and it does not require server validation. Previously all buffers were populated with a FetchData call. This is wasteful of time and server resources when there is a valid callback registration because the serverLength is known to be valid. LICENSE MIT Change-Id: I13f9a8dbd6387c3ba71638a682e995d7a7d0862f Reviewed-on: http://gerrit.openafs.org/1664 Tested-by: Jeffrey Altman Tested-by: Asanka Herath Reviewed-by: Asanka Herath Reviewed-by: Jeffrey Altman --- diff --git a/src/WINNT/afsd/cm_dcache.c b/src/WINNT/afsd/cm_dcache.c index 1f47843..32dcf29 100644 --- a/src/WINNT/afsd/cm_dcache.c +++ b/src/WINNT/afsd/cm_dcache.c @@ -457,7 +457,7 @@ long cm_StoreMini(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp) long cm_BufRead(cm_buf_t *bufp, long nbytes, long *bytesReadp, cm_user_t *userp) { - *bytesReadp = cm_data.buf_blockSize; + *bytesReadp = 0; /* now return a code that means that I/O is done */ return 0; @@ -535,6 +535,8 @@ int cm_HaveBuffer(cm_scache_t *scp, cm_buf_t *bufp, int isBufLocked) return 1; if (bufp->dataVersion <= scp->dataVersion && bufp->dataVersion >= scp->bufDataVersionLow) return 1; + if (bufp->offset.QuadPart >= scp->serverLength.QuadPart) + return 1; if (!isBufLocked) { code = lock_TryMutex(&bufp->mx); if (code == 0) {