if (targetptr->disk.type == vDirectory) DFlush(); /* just in case? */
- size = targetptr->disk.length;
+ VN_GET_LEN(size, targetptr);
buff = (char *)malloc(COPYBUFFSIZE);
if (buff == NULL) {
return EIO;
}
}
VN_SET_INO(*targetptr, (Inode)0);
- VAdjustDiskUsage(&errorCode, volptr,
- -(int)nBlocks((*targetptr)->disk.length), 0);
+ {
+ afs_fsize_t adjLength;
+ VN_GET_LEN(adjLength, *targetptr);
+ VAdjustDiskUsage(&errorCode, volptr,
+ -(int)nBlocks(adjLength), 0);
+ }
}
(*targetptr)->changed_newTime = 1; /* Status change of deleted file/dir */
#endif /* FS_STATS_DETAILED */
)
{
- afs_uint32 newlength; /* Holds new directory length */
+ afs_fsize_t newlength; /* Holds new directory length */
+ afs_fsize_t parentLength;
int errorCode;
#if FS_STATS_DETAILED
Date currDate; /*Current date*/
* XXX But we still don't check the error since we're dealing with dirs here and really the increase
* of a new entry would be too tiny to worry about failures (since we have all the existing cushion)
*/
- if (nBlocks(newlength) != nBlocks(parentptr->disk.length))
+ VN_GET_LEN(parentLength, parentptr);
+ if (nBlocks(newlength) != nBlocks(parentLength)) {
VAdjustDiskUsage(&errorCode, volptr,
- (int)(nBlocks(newlength) - nBlocks(parentptr->disk.length)),
- (int)(nBlocks(newlength) - nBlocks(parentptr->disk.length)));
- parentptr->disk.length = newlength;
+ (nBlocks(newlength) - nBlocks(parentLength)),
+ (nBlocks(newlength) - nBlocks(parentLength)));
+ }
+ VN_SET_LEN(parentptr, newlength);
#if FS_STATS_DETAILED
/*
AFSStoreStatus *InStatus,
Vnode *parentptr,
Volume *volptr,
- afs_int32 length)
+ afs_fsize_t length)
{
#if FS_STATS_DETAILED
Date currDate; /*Current date*/
if (Caller & (TVS_CFILE|TVS_SLINK|TVS_MKDIR)) { /* initialize new file */
targetptr->disk.parent = parentptr->vnodeNumber;
- targetptr->disk.length = length;
+ VN_SET_LEN(targetptr, length);
/* targetptr->disk.group = 0; save some cycles */
targetptr->disk.modeBits = 0777;
targetptr->disk.owner = client->ViceId;
else
status->FileType = Invalid; /*invalid type field */
status->LinkCount = targetptr->disk.linkCount;
- status->Length_hi = 0;
- status->Length = targetptr->disk.length;
+ {
+ afs_fsize_t targetLen;
+ VN_GET_LEN(targetLen, targetptr);
+ SplitOffsetOrSize(targetLen, status->Length_hi, status->Length);
+ }
status->DataVersion = targetptr->disk.dataVersion;
status->Author = targetptr->disk.author;
status->Owner = targetptr->disk.owner;
} /*SRXAFS_FetchStatus*/
-
-afs_int32 SRXAFS_StoreData (struct rx_call *acall,
- struct AFSFid *Fid,
- struct AFSStoreStatus *InStatus,
- afs_uint32 Pos,
- afs_uint32 Length,
- afs_uint32 FileLength,
- struct AFSFetchStatus *OutStatus,
- struct AFSVolSync *Sync)
+static
+afs_int32 common_StoreData64 (struct rx_call *acall,
+ struct AFSFid *Fid,
+ struct AFSStoreStatus *InStatus,
+ afs_uint32 Pos,
+ afs_uint32 Length,
+ afs_uint32 FileLength,
+ struct AFSFetchStatus *OutStatus,
+ struct AFSVolSync *Sync)
{
Vnode * targetptr = 0; /* pointer to input fid */
Vnode * parentwhentargetnotdir = 0; /* parent of Fid to get ACL */
osi_auditU (acall, StoreDataEvent, errorCode, AUD_FID, Fid, AUD_END);
return(errorCode);
+} /*common_StoreData64*/
+
+afs_int32 SRXAFS_StoreData (struct rx_call *acall,
+ struct AFSFid *Fid,
+ struct AFSStoreStatus *InStatus,
+ afs_uint32 Pos,
+ afs_uint32 Length,
+ afs_uint32 FileLength,
+ struct AFSFetchStatus *OutStatus,
+ struct AFSVolSync *Sync)
+{
+ int code;
+
+ code = common_StoreData64 (acall, Fid, InStatus, Pos, Length, FileLength,
+ OutStatus, Sync);
+ return code;
+
} /*SRXAFS_StoreData*/
afs_int32 SRXAFS_StoreData64 (struct rx_call *acall,
tFileLength = FileLength.low;
#endif /* AFS_64BIT_ENV */
- code = SRXAFS_StoreData (acall, Fid, InStatus, tPos, tLength, tFileLength,
- OutStatus, Sync);
+ code = common_StoreData64 (acall, Fid, InStatus, tPos, tLength, tFileLength,
+ OutStatus, Sync);
return code;
}
/* Drop the link count */
newfileptr->disk.linkCount--;
if (newfileptr->disk.linkCount == 0) { /* Link count 0 - delete */
- VAdjustDiskUsage(&errorCode, volptr,
- -(int)nBlocks(newfileptr->disk.length), 0);
+ afs_fsize_t newSize;
+ VN_GET_LEN(newSize, newfileptr);
+ VAdjustDiskUsage(&errorCode, volptr, -nBlocks(newSize), 0);
if (VN_GET_INO(newfileptr)) {
IH_REALLYCLOSE(newfileptr->handle);
errorCode = IH_DEC(V_linkHandle(volptr),
SetDirHandle(&dir, targetptr);
assert(!(MakeDir(&dir, OutFid, DirFid)));
DFlush();
- targetptr->disk.length = Length(&dir);
+ VN_SET_LEN(targetptr, Length(&dir));
/* set up return status */
GetStatus(targetptr, OutFidStatus, rights, anyrights, parentptr);
AFSCallStats.TotalFetchedBytes = AFSCallStats.AccumFetchTime = 0;
AFSCallStats.AccumFetchTime += ((StopTime.tv_sec - StartTime.tv_sec) * 1000) +
((StopTime.tv_usec - StartTime.tv_usec) / 1000);
- AFSCallStats.TotalFetchedBytes += targetptr->disk.length;
- AFSCallStats.FetchSize1++;
- if (targetptr->disk.length < SIZE2)
- AFSCallStats.FetchSize2++;
- else if (targetptr->disk.length < SIZE3)
- AFSCallStats.FetchSize3++;
- else if (targetptr->disk.length < SIZE4)
- AFSCallStats.FetchSize4++;
- else
- AFSCallStats.FetchSize5++;
+ {
+ afs_fsize_t targLen;
+ VN_GET_LEN(targLen, targetptr);
+ AFSCallStats.TotalFetchedBytes += targLen;
+ AFSCallStats.FetchSize1++;
+ if (targLen < SIZE2)
+ AFSCallStats.FetchSize2++;
+ else if (targLen < SIZE3)
+ AFSCallStats.FetchSize3++;
+ else if (targLen < SIZE4)
+ AFSCallStats.FetchSize4++;
+ else
+ AFSCallStats.FetchSize5++;
+ }
FS_UNLOCK
return (0);
}
if (linkCount != 1) {
- afs_uint32 size;
+ afs_fsize_t size;
ViceLog(25, ("StoreData_RXStyle : inode %s has more than onelink\n",
PrintInode(NULL, VN_GET_INO(targetptr))));
/* other volumes share this data, better copy it first */
* of the disk will be recorded...
*/
FDH_CLOSE(fdP);
- size = targetptr->disk.length;
+ VN_GET_LEN(size, targetptr);
volptr->partition->flags &= ~PART_DONTUPDATE;
VSetPartitionDiskUsage(volptr->partition);
volptr->partition->flags |= PART_DONTUPDATE;
NewLength = Pos+Length; /* and write */
/* adjust the disk block count by the difference in the files */
- adjustSize = (int) (nBlocks(NewLength) - nBlocks(targetptr->disk.length));
+ {
+ afs_fsize_t targSize;
+ VN_GET_LEN(targSize, targetptr);
+ adjustSize = nBlocks(NewLength) - nBlocks(targSize);
+ }
if((errorCode = AdjustDiskUsage(volptr, adjustSize,
adjustSize - SpareComp(volptr)))) {
FDH_CLOSE(fdP);
FDH_SYNC(fdP);
}
if (errorCode) {
+ afs_fsize_t nfSize = FDH_SIZE(fdP);
/* something went wrong: adjust size and return */
- targetptr->disk.length = FDH_SIZE(fdP); /* set new file size. */
+ VN_SET_LEN(targetptr, nfSize); /* set new file size. */
/* changed_newTime is tested in StoreData to detemine if we
* need to update the target vnode.
*/
FDH_CLOSE(fdP);
/* set disk usage to be correct */
VAdjustDiskUsage(&errorCode, volptr,
- (int)(nBlocks(targetptr->disk.length)
- - nBlocks(NewLength)), 0);
+ (int)(nBlocks(nfSize) - nBlocks(NewLength)), 0);
return errorCode;
}
FDH_CLOSE(fdP);
TM_GetTimeOfDay(&StopTime, 0);
- targetptr->disk.length = NewLength;
+ VN_SET_LEN(targetptr, NewLength);
/* Update all StoreData related stats */
FS_LOCK
if (AFSCallStats.TotalStoredBytes > 2000000000) /* reset if over 2 billion */
AFSCallStats.TotalStoredBytes = AFSCallStats.AccumStoreTime = 0;
AFSCallStats.StoreSize1++; /* Piggybacked data */
- if (targetptr->disk.length < SIZE2)
- AFSCallStats.StoreSize2++;
- else if (targetptr->disk.length < SIZE3)
- AFSCallStats.StoreSize3++;
- else if (targetptr->disk.length < SIZE4)
- AFSCallStats.StoreSize4++;
- else
- AFSCallStats.StoreSize5++;
+ {
+ afs_fsize_t targLen;
+ VN_GET_LEN(targLen, targetptr);
+ if (targLen < SIZE2)
+ AFSCallStats.StoreSize2++;
+ else if (targLen < SIZE3)
+ AFSCallStats.StoreSize3++;
+ else if (targLen < SIZE4)
+ AFSCallStats.StoreSize4++;
+ else
+ AFSCallStats.StoreSize5++;
+ }
FS_UNLOCK
return(errorCode);
int err = 0;
StreamHandle_t *file;
struct VnodeClassInfo *vcp;
- int size;
+ afs_sfsize_t size;
+ afs_fsize_t vnodeLength;
int vnodeIndex, nVnodes;
afs_ino_str_t stmp1, stmp2;
IHandle_t *handle;
VNDISK_SET_INO(vnode, ip->inodeNumber);
vnodeChanged = 1;
}
- if (ip->byteCount != vnode->length) {
+ VNDISK_GET_LEN(vnodeLength, vnode);
+ if (ip->byteCount != vnodeLength) {
if (check) {
if (!Showmode) Log("Vnode %d: length incorrect; (is %d should be %d)\n",
- vnodeNumber, vnode->length, ip->byteCount);
+ vnodeNumber, vnodeLength, ip->byteCount);
err = -1;
goto zooks;
}
if (!Showmode) Log("Vnode %d: length incorrect; changed from %d to %d\n",
- vnodeNumber, vnode->length, ip->byteCount);
- vnode->length = ip->byteCount;
+ vnodeNumber, vnodeLength, ip->byteCount);
+ VNDISK_SET_LEN(vnode, ip->byteCount);
vnodeChanged = 1;
}
if (!check)
}
vnode.cloned = 0;
VNDISK_SET_INO(&vnode, newinode);
- vnode.length = Length(&newdir);
+ VNDISK_SET_LEN(&vnode, Length(&newdir));
code = IH_IWRITE(vnodeInfo[vLarge].handle,
vnodeIndexOffset(vcp, dir->vnodeNumber),
(char*)&vnode, sizeof (vnode));
nVnodes--, vnodeIndex++) {
if (vnode->type != vNull) {
register struct VnodeEssence *vep = &vip->vnodes[vnodeIndex];
+ afs_fsize_t vnodeLength;
vip->nAllocatedVnodes++;
vep->count = vnode->linkCount;
- vep->blockCount = nBlocks(vnode->length);
+ VNDISK_GET_LEN(vnodeLength, vnode);
+ vep->blockCount = nBlocks(vnodeLength);
vip->volumeBlockCount += vep->blockCount;
vep->parent = vnode->parent;
vep->unique = vnode->uniquifier;