#define USE_RX_IOVEC 1
-/* we can access connp->serverp without holding a lock because that
- never changes since the connection is made. */
-#define SERVERHAS64BIT(connp) (!((connp)->serverp->flags & CM_SERVERFLAG_NO64BIT))
-#define SET_SERVERHASNO64BIT(connp) (cm_SetServerNo64Bit((connp)->serverp, TRUE))
-
/* functions called back from the buffer package when reading or writing data,
* or when holding or releasing a vnode pointer.
*/
/* reserve a chunk's worth of buffers */
lock_ReleaseWrite(&scp->rw);
- buf_ReserveBuffers(cm_chunkSize / cm_data.buf_blockSize);
+ biop->reserved = (cm_chunkSize / cm_data.buf_blockSize);
+ buf_ReserveBuffers(biop->reserved);
lock_ObtainWrite(&scp->rw);
bufp = NULL;
}
}
- biop->reserved = 1;
-
/* if we get here, if bufp is null, we didn't find any dirty buffers
* that weren't already being stored back, so we just quit now.
*/
/* Give back reserved buffers */
if (biop->reserved)
- buf_UnreserveBuffers(cm_chunkSize / cm_data.buf_blockSize);
+ buf_UnreserveBuffers(biop->reserved);
if (isStore)
flags = CM_SCACHESYNC_STOREDATA;
case CM_ERROR_READONLY:
case CM_ERROR_NOSUCHPATH:
case EIO:
+ case CM_ERROR_INVAL_NET_RESP:
+ case CM_ERROR_UNKNOWN:
/*
* Apply the fatal error to this buffer.
*/
_InterlockedAnd(&bufp->flags, ~CM_BUF_DIRTY);
_InterlockedOr(&bufp->flags, CM_BUF_ERROR);
- bufp->dirty_offset = 0;
bufp->dirty_length = 0;
bufp->error = code;
bufp->dataVersion = CM_BUF_VERSION_BAD;
afs_uint32 nbytes; /* bytes in transfer */
afs_uint32 nbytes_hi = 0; /* high-order 32 bits of bytes in transfer */
afs_uint64 length_found = 0;
- long rbytes; /* bytes in rx_Read call */
+ long rxbytes; /* bytes in rx_Read call */
long temp;
AFSFetchStatus afsStatus;
AFSCallBack callback;
iov = 0;
iov_offset = 0;
- rbytes = temp;
+ rxbytes = temp;
- while (rbytes > 0) {
+ while (rxbytes > 0) {
afs_int32 len;
osi_assertx(bufferp != NULL, "null cm_buf_t");
memcpy(bufferp + buffer_offset, tiov[iov].iov_base + iov_offset, len);
iov_offset += len;
buffer_offset += len;
- rbytes -= len;
+ rxbytes -= len;
if (iov_offset == tiov[iov].iov_len) {
iov++;
*/
osi_assertx(bufferp != NULL, "null cm_buf_t");
- /* read rbytes of data */
- rbytes = (afs_uint32)(length_found > cm_data.buf_blockSize ? cm_data.buf_blockSize : length_found);
- temp = rx_Read(rxcallp, bufferp, rbytes);
- if (temp < rbytes) {
+ /* read rxbytes of data */
+ rxbytes = (afs_uint32)(length_found > cm_data.buf_blockSize ? cm_data.buf_blockSize : length_found);
+ temp = rx_Read(rxcallp, bufferp, rxbytes);
+ if (temp < rxbytes) {
/*
* If the file server returned (filesize - offset),
* then the first rx_Read will return zero octets of data.
* all of the rest of the pages.
*/
#ifdef USE_RX_IOVEC
- rbytes = cm_data.buf_blockSize - buffer_offset;
+ rxbytes = cm_data.buf_blockSize - buffer_offset;
bufferp = tbufp->datap + buffer_offset;
#else /* USE_RX_IOVEC */
/* bytes fetched */
osi_assertx((bufferp - tbufp->datap) < LONG_MAX, "data >= LONG_MAX");
- rbytes = (long) (bufferp - tbufp->datap);
+ rxbytes = (long) (bufferp - tbufp->datap);
/* bytes left to zero */
- rbytes = cm_data.buf_blockSize - rbytes;
+ rxbytes = cm_data.buf_blockSize - rxbytes;
#endif /* USE_RX_IOVEC */
while(qdp) {
- if (rbytes != 0)
- memset(bufferp, 0, rbytes);
+ if (rxbytes != 0)
+ memset(bufferp, 0, rxbytes);
qdp = (osi_queueData_t *) osi_QPrev(&qdp->q);
if (qdp == NULL)
break;
tbufp = osi_GetQData(qdp);
bufferp = tbufp->datap;
/* bytes to clear in this page */
- rbytes = cm_data.buf_blockSize;
+ rxbytes = cm_data.buf_blockSize;
}
}
afs_uint64 length_found = 0;
char *bufferp = datap;
afs_uint32 buffer_offset = 0;
- long rbytes; /* bytes in rx_Read call */
+ long rxbytes; /* bytes in rx_Read call */
long temp;
AFSFetchStatus afsStatus;
AFSCallBack callback;
iov = 0;
iov_offset = 0;
- rbytes = temp;
+ rxbytes = temp;
- while (rbytes > 0) {
+ while (rxbytes > 0) {
afs_int32 len;
osi_assertx(bufferp != NULL, "null cm_buf_t");
memcpy(bufferp + buffer_offset, tiov[iov].iov_base + iov_offset, len);
iov_offset += len;
buffer_offset += len;
- rbytes -= len;
+ rxbytes -= len;
if (iov_offset == tiov[iov].iov_len) {
iov++;
*/
osi_assertx(bufferp != NULL, "null cm_buf_t");
- /* read rbytes of data */
- rbytes = (afs_uint32)(length_found > data_length ? data_length : length_found);
- temp = rx_Read(rxcallp, bufferp, rbytes);
- if (temp < rbytes) {
+ /* read rxbytes of data */
+ rxbytes = (afs_uint32)(length_found > data_length ? data_length : length_found);
+ temp = rx_Read(rxcallp, bufferp, rxbytes);
+ if (temp < rxbytes) {
/*
* If the file server returned (filesize - offset),
* then the first rx_Read will return zero octets of data.
* all of the rest of the pages.
*/
#ifdef USE_RX_IOVEC
- rbytes = data_length - buffer_offset;
+ rxbytes = data_length - buffer_offset;
bufferp = datap + buffer_offset;
#else /* USE_RX_IOVEC */
/* bytes fetched */
osi_assertx((bufferp - datap) < LONG_MAX, "data >= LONG_MAX");
- rbytes = (long) (bufferp - datap);
+ rxbytes = (long) (bufferp - datap);
/* bytes left to zero */
- rbytes = data_length - rbytes;
+ rxbytes = data_length - rxbytes;
#endif /* USE_RX_IOVEC */
- if (rbytes != 0)
- memset(bufferp, 0, rbytes);
+ if (rxbytes != 0)
+ memset(bufferp, 0, rxbytes);
}
if (code == 0) {
afs_uint32 nbytes; /* bytes in transfer */
afs_uint32 nbytes_hi = 0; /* high-order 32 bits of bytes in transfer */
afs_uint64 length_found = 0;
- long rbytes; /* bytes in rx_Read call */
+ long rxbytes; /* bytes in rx_Read call */
long temp;
AFSFetchStatus afsStatus;
AFSCallBack callback;
*/
osi_assertx(bufferp != NULL, "null cm_buf_t");
- /* read rbytes of data */
- rbytes = (afs_uint32)(length_found > biod->length ? biod->length : length_found);
- temp = rx_Read(rxcallp, bufferp, rbytes);
- if (temp < rbytes) {
+ /* read rxbytes of data */
+ rxbytes = (afs_uint32)(length_found > biod->length ? biod->length : length_found);
+ temp = rx_Read(rxcallp, bufferp, rxbytes);
+ if (temp < rxbytes) {
/*
* If the file server returned (filesize - offset),
* then the first rx_Read will return zero octets of data.