From b8d8c54c53edebb0987de107ddd644fc68a4c807 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Sat, 16 Aug 2008 20:15:45 +0000 Subject: [PATCH] STABLE14-large-partition-support-20080305 LICENSE IPL10 FIXES 88811 support partitions over 2tb (cherry picked from commit b651ece9bdb2ea9dc19907a5686e9d084f3c03d6) --- src/config/stds.h | 13 +++- src/fsint/afsint.xg | 77 +++++++++++++++++++++ src/fsprobe/fsprobe.c | 61 +++++++++++++---- src/viced/afsfileprocs.c | 121 +++++++++++++++++++++++++++++++-- src/vol/clone.c | 1 - src/vol/listinodes.c | 2 +- src/vol/namei_ops.c | 2 +- src/vol/partition.c | 39 +++++------ src/vol/partition.h | 22 +++--- src/vol/purge.c | 2 +- src/vol/vol-info.c | 26 +++---- src/vol/vol-salvage.c | 20 +++--- src/vol/volume.c | 16 ++--- src/vol/volume.h | 6 +- src/vol/vutil.c | 2 +- src/volser/dumpstuff.c | 2 +- src/volser/vol-dump.c | 14 ++-- src/volser/volint.xg | 15 ++++ src/volser/volprocs.c | 47 ++++++++++--- src/volser/volser_prototypes.h | 4 +- src/volser/vos.c | 24 +++---- src/volser/vsprocs.c | 21 ++++-- 22 files changed, 408 insertions(+), 129 deletions(-) diff --git a/src/config/stds.h b/src/config/stds.h index 05dadd812..2ac240114 100644 --- a/src/config/stds.h +++ b/src/config/stds.h @@ -44,6 +44,11 @@ pragma Off(Prototype_override_warnings); #error We require size of long and pointers to be equal #endif */ +#define MAX_AFS_INT32 0x7FFFFFFFL +#define MAX_AFS_UINT32 0xFFFFFFFFL +#define MAX_AFS_INT64 0x7FFFFFFFFFFFFFFFL +#define MAX_AFS_UINT64 0xFFFFFFFFFFFFFFFFL + typedef short afs_int16; typedef unsigned short afs_uint16; #ifdef AFS_64BIT_ENV @@ -65,9 +70,11 @@ typedef unsigned long long afs_uint64; #define CompareInt64(a,b) (afs_int64)(a) - (afs_int64)(b) #define CompareUInt64(a,b) (afs_uint64)(a) - (afs_uint64)(b) #define NonZeroInt64(a) (a) -#define Int64ToInt32(a) (a) & 0xFFFFFFFFL +#define Int64ToInt32(a) (a) & MAX_AFS_UINT32 #define FillInt64(t,h,l) (t) = ((afs_int64)(h) << 32) | (l); -#define SplitInt64(t,h,l) (h) = ((afs_int64)t) >> 32; (l) = (t) & 0xFFFFFFFF; +#define SplitInt64(t,h,l) (h) = ((afs_int64)t) >> 32; (l) = (t) & MAX_AFS_UINT32; +#define RoundInt64ToInt32(a) (a > MAX_AFS_UINT32) ? MAX_AFS_UINT32 : a; +#define RoundInt64ToInt31(a) (a > MAX_AFS_INT32) ? MAX_AFS_INT32 : a; #else /* AFS_64BIT_ENV */ typedef long afs_int32; typedef unsigned long afs_uint32; @@ -95,6 +102,8 @@ typedef struct u_Int64 afs_uint64; #define Int64ToInt32(a) (a).low #define FillInt64(t,h,l) (t).high = (h); (t).low = (l); #define SplitInt64(t,h,l) (h) = (t).high; (l) = (t).low; +#define RoundInt64ToInt32(a) (a.high > 0) ? MAX_AFS_UINT32 : a.low; +#define RoundInt64ToInt31(a) (a.high > 0) ? MAX_AFS_INT32 : (a.low & MAX_AFS_INT32); #endif /* AFS_64BIT_ENV */ /* AFS_64BIT_CLIENT should presently be set only for AFS_64BIT_ENV systems */ diff --git a/src/fsint/afsint.xg b/src/fsint/afsint.xg index c50037797..b2b12d7e8 100644 --- a/src/fsint/afsint.xg +++ b/src/fsint/afsint.xg @@ -702,3 +702,80 @@ GetCapabilities( CallBackRxConnAddr( IN afs_int32 *addr ) = 65541; + +%#define STATS64_CURRENTTIME 0 +%#define STATS64_BOOTTIME 1 +%#define STATS64_STARTTIME 2 +%#define STATS64_CURRENTCONNECTIONS 3 +%#define STATS64_TOTALFETCHES 4 +%#define STATS64_FETCHDATAS 5 +%#define STATS64_FETCHEDBYTES 6 +%#define STATS64_FETCHDATARATE 7 +%#define STATS64_TOTALSTORES 8 +%#define STATS64_STOREDATAS 9 +%#define STATS64_STOREDBYTES 10 +%#define STATS64_STOREDATARATE 11 +%#define STATS64_TOTALVICECALLS 12 +%#define STATS64_WORKSTATIONS 13 +%#define STATS64_ACTIVEWORKSTATIONS 14 +%#define STATS64_PROCESSSIZE 15 + +const STATS64_VERSION = 16; +typedef afs_uint64 ViceStatistics64; + +/* the "version" is a number representing the number of + array elements to return, from 0 to N-1 */ + +GetStatistics64( + IN afs_int32 statsVersion, + OUT ViceStatistics64 *Statistics +) = 65542; + +/* rx osd. put here now to hold version numbers. +ServerPath( + IN AFSFid *Fid, + afs_int32 writing, + OUT FilePath *NameiInfo, + AFSFetchStatus *OutStatus, + AFSCallBack *CallBack +) = 65551; + +PerfTest( + IN afs_int32 type, + afs_int64 bytes, + afs_int32 bufsize +) split = 65552; + +GetOSDlocation( + IN AFSFid *Fid, + afs_uint64 offset, + afs_uint64 length, + afs_int32 flag, + afsUUID uuid, + OUT AFSFetchStatus *OutStatus, + AFSCallBack *CallBack, + struct osd_file *osd +) = 65557; + +InverseLookup( + IN AFSFid *Fid, + afs_uint32 parent, + OUT struct afs_filename *file, + afs_uint32 *nextparent +) = 65558; + +CheckOSDconns() = 65559; + +OsdPolicy(IN AFSFid *Fid, + afs_uint64 length, + OUT afs_uint32 *protocol +) = 65560; + +SetOsdFileReady( + IN AFSFid *Fid +) = 65561; + +GetOsdMetadata( + IN AFSFid *Fid +) split = 65562; +*/ diff --git a/src/fsprobe/fsprobe.c b/src/fsprobe/fsprobe.c index a51efdc40..ce69a9b8e 100644 --- a/src/fsprobe/fsprobe.c +++ b/src/fsprobe/fsprobe.c @@ -25,6 +25,7 @@ RCSID #include /*Interface for this module */ #include /*Lightweight process package */ #include +#include #define LWP_STACK_SIZE (16 * 1024) @@ -240,9 +241,11 @@ fsprobe_LWP(void *unused) struct timeval tv; /*Time structure */ int conn_idx; /*Connection index */ struct fsprobe_ConnectionInfo *curr_conn; /*Current connection */ - struct ProbeViceStatistics *curr_stats; /*Current stats region */ + struct ProbeViceStatistics *curr_stats; /*Current stats region */ int *curr_probeOK; /*Current probeOK field */ - + ViceStatistics64 stats64; + stats64.ViceStatistics64_val = (afs_uint64 *)malloc(STATS64_VERSION * + sizeof(afs_uint64)); while (1) { /*Service loop */ /* * Iterate through the server connections, gathering data. @@ -273,9 +276,20 @@ fsprobe_LWP(void *unused) fprintf(stderr, "[%s] Connection valid, calling RXAFS_GetStatistics\n", rn); - *curr_probeOK = - RXAFS_GetStatistics(curr_conn->rxconn, curr_stats); - + *curr_probeOK = RXGEN_OPCODE; + RXAFS_GetStatistics64(curr_conn->rxconn, STATS64_VERSION, &stats64); + if (*curr_probeOK == RXGEN_OPCODE) + *curr_probeOK = + RXAFS_GetStatistics(curr_conn->rxconn, curr_stats); + else if (*curr_probeOK == 0) { + curr_stats->CurrentTime = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_CURRENTTIME]); + curr_stats->BootTime = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_BOOTTIME]); + curr_stats->StartTime = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_STARTTIME]); + curr_stats->CurrentConnections = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_CURRENTCONNECTIONS]); + curr_stats->TotalFetchs = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_TOTALFETCHES]); + curr_stats->TotalStores = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_TOTALSTORES]); + curr_stats->WorkStations = RoundInt64ToInt32(stats64.ViceStatistics64_val[STATS64_WORKSTATIONS]); + } } /*Valid Rx connection */ @@ -289,6 +303,8 @@ fsprobe_LWP(void *unused) int i, code; char pname[10]; struct diskPartition partition; + struct diskPartition64 *partition64p = + (struct diskPartition64 *)malloc(sizeof(struct diskPartition64)); if (fsprobe_debug) fprintf(stderr, @@ -298,23 +314,37 @@ fsprobe_LWP(void *unused) if (curr_conn->partList.partFlags[i] & PARTVALID) { MapPartIdIntoName(curr_conn->partList.partId[i], pname); - code = - AFSVolPartitionInfo(curr_conn->rxVolconn, pname, - &partition); + code = + AFSVolPartitionInfo64(curr_conn->rxVolconn, pname, + partition64p); + + if (!code) { + curr_stats->Disk[i].BlocksAvailable = + RoundInt64ToInt31(partition64p->free); + curr_stats->Disk[i].TotalBlocks = + RoundInt64ToInt31(partition64p->minFree); + strcpy(curr_stats->Disk[i].Name, pname); + } + if (code == RXGEN_OPCODE) { + code = + AFSVolPartitionInfo(curr_conn->rxVolconn, + pname, &partition); + if (!code) { + curr_stats->Disk[i].BlocksAvailable = + partition.free; + curr_stats->Disk[i].TotalBlocks = + partition.minFree; + strcpy(curr_stats->Disk[i].Name, pname); + } + } if (code) { fprintf(stderr, "Could not get information on server %s partition %s\n", curr_conn->hostName, pname); - } else { - curr_stats->Disk[i].BlocksAvailable = - partition.free; - curr_stats->Disk[i].TotalBlocks = - partition.minFree; - strcpy(curr_stats->Disk[i].Name, pname); } } - } + free(partition64p); } @@ -358,6 +388,7 @@ fsprobe_LWP(void *unused) if (code) fprintf(stderr, "[%s] IOMGR_Select returned code %d\n", rn, code); } /*Service loop */ + free(stats64.ViceStatistics64_val); return NULL; } /*fsprobe_LWP */ diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 68a6bdd78..c59f7a0d8 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -1919,8 +1919,8 @@ GetVolumeStatus(VolumeStatus * status, struct BBS *name, struct BBS *offMsg, status->MinQuota = V_minquota(volptr); status->MaxQuota = V_maxquota(volptr); status->BlocksInUse = V_diskused(volptr); - status->PartBlocksAvail = volptr->partition->free; - status->PartMaxBlocks = volptr->partition->totalUsable; + status->PartBlocksAvail = RoundInt64ToInt32(volptr->partition->free); + status->PartMaxBlocks = RoundInt64ToInt32(volptr->partition->totalUsable); strncpy(name->SeqBody, V_name(volptr), (int)name->MaxSeqLen); name->SeqLen = strlen(V_name(volptr)) + 1; if (name->SeqLen > name->MaxSeqLen) @@ -5577,13 +5577,13 @@ SetAFSStats(struct AFSStatistics *stats) void SetVolumeStats(struct AFSStatistics *stats) { - struct DiskPartition *part; + struct DiskPartition64 *part; int i = 0; for (part = DiskPartitionList; part && i < AFS_MSTATDISKS; part = part->next) { - stats->Disks[i].TotalBlocks = part->totalUsable; - stats->Disks[i].BlocksAvailable = part->free; + stats->Disks[i].TotalBlocks = RoundInt64ToInt31(part->totalUsable); + stats->Disks[i].BlocksAvailable = RoundInt64ToInt31(part->free); memset(stats->Disks[i].Name, 0, AFS_DISKNAMESIZE); strncpy(stats->Disks[i].Name, part->name, AFS_DISKNAMESIZE); i++; @@ -5658,6 +5658,117 @@ SRXAFS_GetStatistics(struct rx_call *acall, struct ViceStatistics *Statistics) } /*SRXAFS_GetStatistics */ +afs_int32 +SRXAFS_GetStatistics64(struct rx_call *acall, afs_int32 statsVersion, ViceStatistics64 *Statistics) +{ + extern afs_int32 StartTime, CurrentConnections; + int seconds; + afs_int32 code; + struct rx_connection *tcon = rx_ConnectionOf(acall); + struct host *thost; + struct client *t_client = NULL; /* tmp ptr to client data */ + struct timeval time; +#if FS_STATS_DETAILED + struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */ + struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */ + struct timeval elapsedTime; /* Transfer time */ + + /* + * Set our stats pointer, remember when the RPC operation started, and + * tally the operation. + */ + opP = &(afs_FullPerfStats.det.rpcOpTimes[FS_STATS_RPCIDX_GETSTATISTICS]); + FS_LOCK; + (opP->numOps)++; + FS_UNLOCK; + TM_GetTimeOfDay(&opStartTime, 0); +#endif /* FS_STATS_DETAILED */ + if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon, &thost))) + goto Bad_GetStatistics64; + if (statsVersion > STATS64_VERSION) + goto Bad_GetStatistics64; + ViceLog(1, ("SAFS_GetStatistics64 Received\n")); + Statistics->ViceStatistics64_val = + malloc(statsVersion*sizeof(afs_int64)); + Statistics->ViceStatistics64_len = statsVersion; + FS_LOCK; + AFSCallStats.GetStatistics++, AFSCallStats.TotalCalls++; + Statistics->ViceStatistics64_val[STATS64_STARTTIME] = StartTime; + Statistics->ViceStatistics64_val[STATS64_CURRENTCONNECTIONS] = + CurrentConnections; + Statistics->ViceStatistics64_val[STATS64_TOTALVICECALLS] = + AFSCallStats.TotalCalls; + Statistics->ViceStatistics64_val[STATS64_TOTALFETCHES] = + AFSCallStats.FetchData + AFSCallStats.FetchACL + + AFSCallStats.FetchStatus; + Statistics->ViceStatistics64_val[STATS64_FETCHDATAS] = + AFSCallStats.FetchData; + Statistics->ViceStatistics64_val[STATS64_FETCHEDBYTES] = + AFSCallStats.TotalFetchedBytes; + seconds = AFSCallStats.AccumFetchTime / 1000; + if (seconds <= 0) + seconds = 1; + Statistics->ViceStatistics64_val[STATS64_FETCHDATARATE] = + AFSCallStats.TotalFetchedBytes / seconds; + Statistics->ViceStatistics64_val[STATS64_TOTALSTORES] = + AFSCallStats.StoreData + AFSCallStats.StoreACL + + AFSCallStats.StoreStatus; + Statistics->ViceStatistics64_val[STATS64_STOREDATAS] = + AFSCallStats.StoreData; + Statistics->ViceStatistics64_val[STATS64_STOREDBYTES] = + AFSCallStats.TotalStoredBytes; + seconds = AFSCallStats.AccumStoreTime / 1000; + if (seconds <= 0) + seconds = 1; + Statistics->ViceStatistics64_val[STATS64_STOREDATARATE] = + AFSCallStats.TotalStoredBytes / seconds; +#ifdef AFS_NT40_ENV + Statistics->ViceStatistics64_val[STATS64_PROCESSSIZE] = -1; +#else + Statistics->ViceStatistics64_val[STATS64_PROCESSSIZE] = + (afs_int32) ((long)sbrk(0) >> 10); +#endif + FS_UNLOCK; + h_GetWorkStats((int *)&(Statistics->ViceStatistics64_val[STATS64_WORKSTATIONS]), + (int *)&(Statistics->ViceStatistics64_val[STATS64_ACTIVEWORKSTATIONS]), + (int *)0, + (afs_int32) (FT_ApproxTime()) - (15 * 60)); + + + + /* this works on all system types */ + TM_GetTimeOfDay(&time, 0); + Statistics->ViceStatistics64_val[STATS64_CURRENTTIME] = time.tv_sec; + + Bad_GetStatistics64: + code = CallPostamble(tcon, code, thost); + + t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key); + +#if FS_STATS_DETAILED + TM_GetTimeOfDay(&opStopTime, 0); + if (code == 0) { + FS_LOCK; + (opP->numSuccesses)++; + fs_stats_GetDiff(elapsedTime, opStartTime, opStopTime); + fs_stats_AddTo((opP->sumTime), elapsedTime); + fs_stats_SquareAddTo((opP->sqrTime), elapsedTime); + if (fs_stats_TimeLessThan(elapsedTime, (opP->minTime))) { + fs_stats_TimeAssign((opP->minTime), elapsedTime); + } + if (fs_stats_TimeGreaterThan(elapsedTime, (opP->maxTime))) { + fs_stats_TimeAssign((opP->maxTime), elapsedTime); + } + FS_UNLOCK; + } +#endif /* FS_STATS_DETAILED */ + + osi_auditU(acall, GetStatisticsEvent, code, + AUD_ID, t_client ? t_client->ViceId : 0, AUD_END); + return code; +} /*SRXAFS_GetStatistics */ + + /*------------------------------------------------------------------------ * EXPORTED SRXAFS_XStatsVersion * diff --git a/src/vol/clone.c b/src/vol/clone.c index 114171907..b4fdeed20 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -175,7 +175,6 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone) struct VnodeClassInfo *vcp = &VnodeClassInfo[class]; int ReadWriteOriginal = VolumeWriteable(rwvp); - struct DiskPartition *partition = rwvp->partition; Device device = rwvp->device; /* Open the RW volume's index file and seek to beginning */ diff --git a/src/vol/listinodes.c b/src/vol/listinodes.c index 172882416..c50a0a753 100644 --- a/src/vol/listinodes.c +++ b/src/vol/listinodes.c @@ -1651,7 +1651,7 @@ inode_ConvertROtoRWvolume(char *pname, afs_int32 volumeId) char *name; int fd, err, forcep, len, j, code; struct dirent *dp; - struct DiskPartition *partP; + struct DiskPartition64 *partP; struct ViceInodeInfo info; struct VolumeDiskHeader h; IHandle_t *ih, *ih2; diff --git a/src/vol/namei_ops.c b/src/vol/namei_ops.c index b589e9e5f..272cc489a 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -1563,7 +1563,7 @@ namei_ConvertROtoRWvolume(char *pname, afs_int32 volumeId) DIR *dirp; Inode ino; struct dirent *dp; - struct DiskPartition *partP; + struct DiskPartition64 *partP; struct ViceInodeInfo info; struct VolumeDiskHeader h; char volname[20]; diff --git a/src/vol/partition.c b/src/vol/partition.c index 851b20f1a..f3ba3ab8b 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -180,7 +180,7 @@ RCSID /*@printflike@*/ extern void Log(const char *format, ...); int aixlow_water = 8; /* default 8% */ -struct DiskPartition *DiskPartitionList; +struct DiskPartition64 *DiskPartitionList; #ifdef AFS_SGI_XFS_IOPS_ENV /* Verify that the on disk XFS inodes on the partition are large enough to @@ -224,8 +224,8 @@ VerifyXFSInodeSize(char *part, char *fstype) static void VInitPartition_r(char *path, char *devname, Device dev) { - struct DiskPartition *dp, *op; - dp = (struct DiskPartition *)malloc(sizeof(struct DiskPartition)); + struct DiskPartition64 *dp, *op; + dp = (struct DiskPartition64 *)malloc(sizeof(struct DiskPartition64)); /* Add it to the end, to preserve order when we print statistics */ for (op = DiskPartitionList; op; op = op->next) { if (!op->next) @@ -710,7 +710,7 @@ VCheckPartition(char *partName) int VAttachPartitions(void) { - struct DiskPartition *partP, *prevP, *nextP; + struct DiskPartition64 *partP, *prevP, *nextP; struct vpt_iter iter; struct vptab entry; @@ -811,7 +811,7 @@ VAttachPartitions(void) * is required. The canonical name is still in part->name. */ char * -VPartitionPath(struct DiskPartition *part) +VPartitionPath(struct DiskPartition64 *part) { #ifdef AFS_NT40_ENV return part->devName; @@ -821,10 +821,10 @@ VPartitionPath(struct DiskPartition *part) } /* get partition structure, abortp tells us if we should abort on failure */ -struct DiskPartition * +struct DiskPartition64 * VGetPartition_r(char *name, int abortp) { - register struct DiskPartition *dp; + register struct DiskPartition64 *dp; for (dp = DiskPartitionList; dp; dp = dp->next) { if (strcmp(dp->name, name) == 0) break; @@ -834,10 +834,10 @@ VGetPartition_r(char *name, int abortp) return dp; } -struct DiskPartition * +struct DiskPartition64 * VGetPartition(char *name, int abortp) { - struct DiskPartition *retVal; + struct DiskPartition64 *retVal; VOL_LOCK; retVal = VGetPartition_r(name, abortp); VOL_UNLOCK; @@ -846,7 +846,7 @@ VGetPartition(char *name, int abortp) #ifdef AFS_NT40_ENV void -VSetPartitionDiskUsage_r(register struct DiskPartition *dp) +VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp) { ULARGE_INTEGER free_user, total, free_total; int ufree, tot, tfree; @@ -870,9 +870,10 @@ VSetPartitionDiskUsage_r(register struct DiskPartition *dp) #else void -VSetPartitionDiskUsage_r(register struct DiskPartition *dp) +VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp) { - int fd, totalblks, free, used, availblks, bsize, code; + afs_int64 totalblks, free, used, availblks; + int fd, bsize, code; int reserved; #ifdef afs_statvfs struct afs_statvfs statbuf; @@ -935,7 +936,7 @@ VSetPartitionDiskUsage_r(register struct DiskPartition *dp) #endif /* AFS_NT40_ENV */ void -VSetPartitionDiskUsage(register struct DiskPartition *dp) +VSetPartitionDiskUsage(register struct DiskPartition64 *dp) { VOL_LOCK; VSetPartitionDiskUsage_r(dp); @@ -945,7 +946,7 @@ VSetPartitionDiskUsage(register struct DiskPartition *dp) void VResetDiskUsage_r(void) { - struct DiskPartition *dp; + struct DiskPartition64 *dp; for (dp = DiskPartitionList; dp; dp = dp->next) { VSetPartitionDiskUsage_r(dp); #ifndef AFS_PTHREAD_ENV @@ -1034,7 +1035,7 @@ VDiskUsage(Volume * vp, afs_sfsize_t blocks) void VPrintDiskStats_r(void) { - struct DiskPartition *dp; + struct DiskPartition64 *dp; for (dp = DiskPartitionList; dp; dp = dp->next) { Log("Partition %s: %d available 1K blocks (minfree=%d), ", dp->name, dp->totalUsable, dp->minFree); @@ -1059,7 +1060,7 @@ VPrintDiskStats(void) void VLockPartition_r(char *name) { - struct DiskPartition *dp = VGetPartition_r(name, 0); + struct DiskPartition64 *dp = VGetPartition_r(name, 0); OVERLAPPED lap; if (!dp) @@ -1084,7 +1085,7 @@ VLockPartition_r(char *name) void VUnlockPartition_r(char *name) { - register struct DiskPartition *dp = VGetPartition_r(name, 0); + register struct DiskPartition64 *dp = VGetPartition_r(name, 0); OVERLAPPED lap; if (!dp) @@ -1107,7 +1108,7 @@ VUnlockPartition_r(char *name) void VLockPartition_r(char *name) { - register struct DiskPartition *dp = VGetPartition_r(name, 0); + register struct DiskPartition64 *dp = VGetPartition_r(name, 0); char *partitionName; int retries, code; struct timeval pausing; @@ -1210,7 +1211,7 @@ VLockPartition_r(char *name) void VUnlockPartition_r(char *name) { - register struct DiskPartition *dp = VGetPartition_r(name, 0); + register struct DiskPartition64 *dp = VGetPartition_r(name, 0); if (!dp) return; /* no partition, will fail later */ close(dp->lock_fd); diff --git a/src/vol/partition.h b/src/vol/partition.h index 547ec94c1..3e0cea2e1 100644 --- a/src/vol/partition.h +++ b/src/vol/partition.h @@ -48,14 +48,14 @@ * variant for VGetPartition as well. Also, the VolPartitionInfo RPC does * a swap before sending the data out on the wire. */ -struct DiskPartition { - struct DiskPartition *next; +struct DiskPartition64 { + struct DiskPartition64 *next; char *name; /* Mounted partition name */ char *devName; /* Device mounted on */ Device device; /* device number */ int lock_fd; /* File descriptor of this partition if locked; otherwise -1; * Not used by the file server */ - int free; /* Total number of blocks (1K) presumed + afs_int64 free; /* Total number of blocks (1K) presumed * available on this partition (accounting * for the minfree parameter for the * partition). This is adjusted @@ -65,7 +65,7 @@ struct DiskPartition { * this is recomputed. This number can * be negative, if the partition starts * out too full */ - int totalUsable; /* Total number of blocks available on this + afs_int64 totalUsable; /* Total number of blocks available on this * partition, taking into account the minfree * parameter for the partition (see the * 4.2bsd command tunefs, but note that the @@ -73,10 +73,10 @@ struct DiskPartition { * is not reread--does not apply here. The * superblock is re-read periodically by * VSetPartitionDiskUsage().) */ - int minFree; /* Number blocks to be kept free, as last read + afs_int64 minFree; /* Number blocks to be kept free, as last read * from the superblock */ int flags; - int f_files; /* total number of files in this partition */ + afs_int64 f_files; /* total number of files in this partition */ }; #define PART_DONTUPDATE 1 #define PART_DUPLICATE 2 /* NT - used if we find more than one partition @@ -92,8 +92,8 @@ extern int VValidVPTEntry(struct vptab *vptp); struct Volume; /* Potentially forward definition */ -extern struct DiskPartition *DiskPartitionList; -extern struct DiskPartition *VGetPartition(); +extern struct DiskPartition64 *DiskPartitionList; +extern struct DiskPartition64 *VGetPartition(); extern int VAttachPartitions(void); extern void VLockPartition(char *name); extern void VLockPartition_r(char *name); @@ -101,9 +101,9 @@ extern void VUnlockPartition(char *name); extern void VUnlockPartition_r(char *name); extern void VResetDiskUsage(void); extern void VResetDiskUsage_r(void); -extern void VSetPartitionDiskUsage(register struct DiskPartition *dp); -extern void VSetPartitionDiskUsage_r(register struct DiskPartition *dp); -extern char *VPartitionPath(struct DiskPartition *p); +extern void VSetPartitionDiskUsage(register struct DiskPartition64 *dp); +extern void VSetPartitionDiskUsage_r(register struct DiskPartition64 *dp); +extern char *VPartitionPath(struct DiskPartition64 *p); extern void VAdjustDiskUsage(Error * ec, struct Volume *vp, afs_sfsize_t blocks, afs_sfsize_t checkBlocks); extern int VDiskUsage(struct Volume *vp, afs_sfsize_t blocks); diff --git a/src/vol/purge.c b/src/vol/purge.c index 2f9811bf4..0ed5c478e 100644 --- a/src/vol/purge.c +++ b/src/vol/purge.c @@ -58,7 +58,7 @@ void PurgeHeader_r(Volume * vp); void VPurgeVolume(Error * ec, Volume * vp) { - struct DiskPartition *tpartp = vp->partition; + struct DiskPartition64 *tpartp = vp->partition; char purgePath[MAXPATHLEN]; /* N.B. it's important here to use the partition pointed to by the diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index 024d88313..736611397 100644 --- a/src/vol/vol-info.c +++ b/src/vol/vol-info.c @@ -87,10 +87,10 @@ int VolumeChanged; /* Forward Declarations */ void PrintHeader(register Volume * vp); void HandleAllPart(void); -void HandlePart(struct DiskPartition *partP); -void HandleVolume(struct DiskPartition *partP, char *name); -struct DiskPartition *FindCurrentPartition(void); -Volume *AttachVolume(struct DiskPartition *dp, char *volname, +void HandlePart(struct DiskPartition64 *partP); +void HandleVolume(struct DiskPartition64 *partP, char *name); +struct DiskPartition64 *FindCurrentPartition(void); +Volume *AttachVolume(struct DiskPartition64 *dp, char *volname, register struct VolumeHeader *header); #if defined(AFS_NAMEI_ENV) void PrintVnode(int offset, VnodeDiskObject * vnode, VnodeId vnodeNumber, @@ -169,7 +169,7 @@ ReadHdr1(IHandle_t * ih, char *to, int size, u_int magic, u_int version) Volume * -AttachVolume(struct DiskPartition * dp, char *volname, +AttachVolume(struct DiskPartition64 * dp, char *volname, register struct VolumeHeader * header) { register Volume *vp; @@ -223,7 +223,7 @@ handleit(struct cmd_syndesc *as, void *arock) int err = 0; int volumeId = 0; char *partName = 0; - struct DiskPartition *partP = NULL; + struct DiskPartition64 *partP = NULL; #ifndef AFS_NT40_ENV @@ -333,11 +333,11 @@ handleit(struct cmd_syndesc *as, void *arock) #ifdef AFS_NT40_ENV #include -struct DiskPartition * +struct DiskPartition64 * FindCurrentPartition() { int dr = _getdrive(); - struct DiskPartition *dp; + struct DiskPartition64 *dp; dr--; for (dp = DiskPartitionList; dp; dp = dp->next) { @@ -350,13 +350,13 @@ FindCurrentPartition() return dp; } #else -struct DiskPartition * +struct DiskPartition64 * FindCurrentPartition() { char partName[1024]; char tmp = '\0'; char *p; - struct DiskPartition *dp; + struct DiskPartition64 *dp; if (!getcwd(partName, 1023)) { perror("pwd"); @@ -380,7 +380,7 @@ FindCurrentPartition() void HandleAllPart(void) { - struct DiskPartition *partP; + struct DiskPartition64 *partP; for (partP = DiskPartitionList; partP; partP = partP->next) { @@ -400,7 +400,7 @@ HandleAllPart(void) void -HandlePart(struct DiskPartition *partP) +HandlePart(struct DiskPartition64 *partP) { int nvols = 0; DIR *dirp; @@ -445,7 +445,7 @@ HandlePart(struct DiskPartition *partP) void -HandleVolume(struct DiskPartition *dp, char *name) +HandleVolume(struct DiskPartition64 *dp, char *name) { struct VolumeHeader header; struct VolumeDiskHeader diskHeader; diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 5bd514883..c1d5668c9 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -267,7 +267,7 @@ char *fileSysPath; /* The path of the mounted partition currently char *fileSysPathName; /* NT needs this to make name pretty in log. */ IHandle_t *VGLinkH; /* Link handle for current volume group. */ int VGLinkH_cnt; /* # of references to lnk handle. */ -struct DiskPartition *fileSysPartition; /* Partition being salvaged */ +struct DiskPartition64 *fileSysPartition; /* Partition being salvaged */ #ifndef AFS_NT40_ENV char *fileSysDeviceName; /* The block device where the file system * being salvaged was mounted */ @@ -449,9 +449,9 @@ void RemoveTheForce(char *path); void SalvageDir(char *name, VolumeId rwVid, struct VnodeInfo *dirVnodeInfo, IHandle_t * alinkH, int i, struct DirSummary *rootdir, int *rootdirfound); -void SalvageFileSysParallel(struct DiskPartition *partP); -void SalvageFileSys(struct DiskPartition *partP, VolumeId singleVolumeNumber); -void SalvageFileSys1(struct DiskPartition *partP, +void SalvageFileSysParallel(struct DiskPartition64 *partP); +void SalvageFileSys(struct DiskPartition64 *partP, VolumeId singleVolumeNumber); +void SalvageFileSys1(struct DiskPartition64 *partP, VolumeId singleVolumeNumber); int SalvageHeader(register struct stuff *sp, struct InodeSummary *isp, int check, int *deleteMe); @@ -507,7 +507,7 @@ handleit(struct cmd_syndesc *as) register struct cmd_item *ti; char pname[100], *temp; afs_int32 seenpart = 0, seenvol = 0, vid = 0, seenany = 0; - struct DiskPartition *partP; + struct DiskPartition64 *partP; #ifdef AFS_SGI_VNODE_GLUE if (afs_init_kernel_config(-1) < 0) { @@ -954,7 +954,7 @@ CheckIfBigFilesFS(char *mountPoint, char *devName) #define HDSTR "\\Device\\Harddisk" #define HDLEN (sizeof(HDSTR)-1) /* Length of "\Device\Harddisk" */ int -SameDisk(struct DiskPartition *p1, struct DiskPartition *p2) +SameDisk(struct DiskPartition64 *p1, struct DiskPartition64 *p2) { #define RES_LEN 256 char res[RES_LEN]; @@ -995,10 +995,10 @@ SameDisk(struct DiskPartition *p1, struct DiskPartition *p2) * PartsPerDisk are on the same disk. */ void -SalvageFileSysParallel(struct DiskPartition *partP) +SalvageFileSysParallel(struct DiskPartition64 *partP) { struct job { - struct DiskPartition *partP; + struct DiskPartition64 *partP; int pid; /* Pid for this job */ int jobnumb; /* Log file job number */ struct job *nextjob; /* Next partition on disk to salvage */ @@ -1186,7 +1186,7 @@ SalvageFileSysParallel(struct DiskPartition *partP) void -SalvageFileSys(struct DiskPartition *partP, VolumeId singleVolumeNumber) +SalvageFileSys(struct DiskPartition64 *partP, VolumeId singleVolumeNumber) { if (!canfork || debug || Fork() == 0) { SalvageFileSys1(partP, singleVolumeNumber); @@ -1218,7 +1218,7 @@ get_DevName(char *pbuffer, char *wpath) } void -SalvageFileSys1(struct DiskPartition *partP, VolumeId singleVolumeNumber) +SalvageFileSys1(struct DiskPartition64 *partP, VolumeId singleVolumeNumber) { char *name, *tdir; char inodeListPath[256]; diff --git a/src/vol/volume.c b/src/vol/volume.c index ea07fda2c..23e4ebd0a 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -164,7 +164,7 @@ extern void *calloc(), *realloc(); /* Forward declarations */ static Volume *attach2(Error * ec, char *path, register struct VolumeHeader *header, - struct DiskPartition *partp, int isbusy); + struct DiskPartition64 *partp, int isbusy); static void FreeVolume(Volume * vp); static void VScanUpdateList(void); static void InitLRU(int howMany); @@ -213,7 +213,7 @@ ffs(x) #include "rx/rx_queue.h" typedef struct diskpartition_queue_t { struct rx_queue queue; - struct DiskPartition * diskP; + struct DiskPartition64 * diskP; } diskpartition_queue_t; typedef struct vinitvolumepackage_thread_t { struct rx_queue queue; @@ -300,7 +300,7 @@ VInitVolumePackage(ProgramType pt, int nLargeVnodes, int nSmallVnodes, return -1; if (programType == fileServer) { - struct DiskPartition *diskP; + struct DiskPartition64 *diskP; #ifdef AFS_PTHREAD_ENV struct vinitvolumepackage_thread_t params; struct diskpartition_queue_t * dpq; @@ -396,7 +396,7 @@ VInitVolumePackageThread(void * args) { DIR *dirp; struct dirent *dp; - struct DiskPartition *diskP; + struct DiskPartition64 *diskP; struct vinitvolumepackage_thread_t * params; struct diskpartition_queue_t * dpq; @@ -697,7 +697,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode) struct afs_stat status; struct VolumeDiskHeader diskHeader; struct VolumeHeader iheader; - struct DiskPartition *partp; + struct DiskPartition64 *partp; char path[64]; int isbusy = 0; *ec = 0; @@ -838,7 +838,7 @@ VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode) private Volume * attach2(Error * ec, char *path, register struct VolumeHeader * header, - struct DiskPartition * partp, int isbusy) + struct DiskPartition64 * partp, int isbusy) { register Volume *vp; @@ -1355,7 +1355,7 @@ void VDetachVolume_r(Error * ec, Volume * vp) { VolumeId volume; - struct DiskPartition *tpartp; + struct DiskPartition64 *tpartp; int notifyServer, useDone; *ec = 0; /* always "succeeds" */ @@ -1676,7 +1676,7 @@ GetVolumePath(Error * ec, VolId volumeId, char **partitionp, char **namep) static char partition[VMAXPATHLEN], name[VMAXPATHLEN]; char path[VMAXPATHLEN]; int found = 0; - struct DiskPartition *dp; + struct DiskPartition64 *dp; *ec = 0; name[0] = '/'; diff --git a/src/vol/volume.h b/src/vol/volume.h index b5205a0f9..44401b6e5 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -301,7 +301,7 @@ typedef struct Volume { VolumeId hashid; /* Volume number -- for hash table lookup */ struct volHeader *header; /* Cached disk data */ Device device; /* Unix device for the volume */ - struct DiskPartition + struct DiskPartition64 *partition; /* Information about the Unix partition */ struct vnodeIndex { IHandle_t *handle; /* Unix inode holding this index */ @@ -455,8 +455,8 @@ extern void VSetDiskUsage(void); extern void VPrintCacheStats(void); extern void VReleaseVnodeFiles_r(Volume * vp); extern void VCloseVnodeFiles_r(Volume * vp); -extern struct DiskPartition *VGetPartition(char *name, int abortp); -extern struct DiskPartition *VGetPartition_r(char *name, int abortp); +extern struct DiskPartition64 *VGetPartition(char *name, int abortp); +extern struct DiskPartition64 *VGetPartition_r(char *name, int abortp); extern int VInitVolumePackage(ProgramType pt, int nLargeVnodes, int nSmallVnodes, int connect, int volcache); extern void DiskToVolumeHeader(VolumeHeader_t * h, VolumeDiskHeader_t * dh); diff --git a/src/vol/vutil.c b/src/vol/vutil.c index 38d7e1f97..789f0e33c 100644 --- a/src/vol/vutil.c +++ b/src/vol/vutil.c @@ -123,7 +123,7 @@ VCreateVolume_r(Error * ec, char *partname, VolId volumeId, VolId parentId) int fd, i; char headerName[32], volumePath[64]; Device device; - struct DiskPartition *partition; + struct DiskPartition64 *partition; struct VolumeDiskHeader diskHeader; IHandle_t *handle; FdHandle_t *fdP; diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index 1a4dd88c9..303021641 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -76,7 +76,7 @@ struct iod { struct rx_call *call; /* call to which to write, might be an array */ int device; /* dump device ID for volume */ int parentId; /* dump parent ID for volume */ - struct DiskPartition *dumpPartition; /* Dump partition. */ + struct DiskPartition64 *dumpPartition; /* Dump partition. */ struct rx_call **calls; /* array of pointers to calls */ int ncalls; /* how many calls/codes in array */ int *codes; /* one return code for each call */ diff --git a/src/volser/vol-dump.c b/src/volser/vol-dump.c index 28f25e4a6..e9a78cdaa 100644 --- a/src/volser/vol-dump.c +++ b/src/volser/vol-dump.c @@ -90,10 +90,10 @@ int VolumeChanged; /* needed by physio - leave alone */ int verbose = 0; /* Forward Declarations */ -void HandleVolume(struct DiskPartition *partP, char *name, char *filename); -Volume *AttachVolume(struct DiskPartition *dp, char *volname, +void HandleVolume(struct DiskPartition64 *partP, char *name, char *filename); +Volume *AttachVolume(struct DiskPartition64 *dp, char *volname, register struct VolumeHeader *header); -static void DoMyVolDump(Volume * vp, struct DiskPartition *dp, +static void DoMyVolDump(Volume * vp, struct DiskPartition64 *dp, char *dumpfile); #ifndef AFS_NT40_ENV @@ -118,7 +118,7 @@ ReadHdr1(IHandle_t * ih, char *to, int size, u_int magic, u_int version) Volume * -AttachVolume(struct DiskPartition * dp, char *volname, +AttachVolume(struct DiskPartition64 * dp, char *volname, register struct VolumeHeader * header) { register Volume *vp; @@ -173,7 +173,7 @@ handleit(struct cmd_syndesc *as, void *arock) int volumeId = 0; char *partName = 0; char *fileName = NULL; - struct DiskPartition *partP = NULL; + struct DiskPartition64 *partP = NULL; char name1[128]; char tmpPartName[20]; @@ -237,7 +237,7 @@ handleit(struct cmd_syndesc *as, void *arock) } void -HandleVolume(struct DiskPartition *dp, char *name, char *filename) +HandleVolume(struct DiskPartition64 *dp, char *name, char *filename) { struct VolumeHeader header; struct VolumeDiskHeader diskHeader; @@ -831,7 +831,7 @@ DumpPartial(int dumpfd, register Volume * vp, afs_int32 fromtime, static void -DoMyVolDump(Volume * vp, struct DiskPartition *dp, char *dumpfile) +DoMyVolDump(Volume * vp, struct DiskPartition64 *dp, char *dumpfile) { int code = 0; int fromtime = 0; diff --git a/src/volser/volint.xg b/src/volser/volint.xg index 62347d5ff..a03d3f01b 100644 --- a/src/volser/volint.xg +++ b/src/volser/volint.xg @@ -50,6 +50,7 @@ statindex 16 #define VOLCONVERTRO 65536 #define VOLGETSIZE 65537 #define VOLDUMPV2 65538 +#define VOLDISKPART64 65539 /* Bits for flags for DumpV2 */ %#define VOLDUMPV2_OMITDIRS 1 @@ -209,6 +210,16 @@ struct diskPartition { }; +struct diskPartition64 { + char name[256]; + char devName[256]; + int lock_fd; + afs_int64 totalUsable; + afs_int64 free; + afs_int64 minFree; + +}; + struct restoreCookie { char name[32]; afs_int32 type; @@ -419,3 +430,7 @@ proc DumpV2( IN afs_int32 flags ) split = VOLDUMPV2; +proc PartitionInfo64( + IN string name<>, + OUT struct diskPartition64 *partition +) = VOLDISKPART64; diff --git a/src/volser/volprocs.c b/src/volser/volprocs.c index 918d63ae3..4a83b01af 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -98,7 +98,7 @@ VolSetIdsTypes(), VolSetDate(), VolSetFlags(); int VPFullUnlock() { - register struct DiskPartition *tp; + register struct DiskPartition64 *tp; for (tp = DiskPartitionList; tp; tp = tp->next) { if (tp->lock_fd != -1) { close(tp->lock_fd); /* releases flock held on this partition */ @@ -286,6 +286,33 @@ SAFSVolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition *partition) { afs_int32 code; + struct diskPartition64 *dp = (struct diskPartition64 *) + malloc(sizeof(struct diskPartition64)); + + code = VolPartitionInfo(acid, pname, dp); + if (!code) { + strncpy(partition->name, dp->name, 32); + strncpy(partition->devName, dp->devName, 32); + partition->lock_fd = dp->lock_fd; + if (dp->free > MAX_AFS_INT32) + partition->free = MAX_AFS_INT32; + else + partition->free = dp->free; + if (dp->minFree > MAX_AFS_INT32) + partition->minFree = MAX_AFS_INT32; + else + partition->minFree = dp->minFree; + } + free(dp); + osi_auditU(acid, VS_ParInfEvent, code, AUD_STR, pname, AUD_END); + return code; +} + +afs_int32 +SAFSVolPartitionInfo64(struct rx_call *acid, char *pname, + struct diskPartition64 *partition) +{ + afs_int32 code; code = VolPartitionInfo(acid, pname, partition); osi_auditU(acid, VS_ParInfEvent, code, AUD_STR, pname, AUD_END); @@ -293,10 +320,10 @@ SAFSVolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition } afs_int32 -VolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition +VolPartitionInfo(struct rx_call *acid, char *pname, struct diskPartition64 *partition) { - register struct DiskPartition *dp; + register struct DiskPartition64 *dp; /* if (!afsconf_SuperUser(tdir, acid, caller)) return VOLSERBAD_ACCESS; @@ -844,7 +871,7 @@ VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId) DeleteTrans(ttc, 1); { - struct DiskPartition *tpartp = originalvp->partition; + struct DiskPartition64 *tpartp = originalvp->partition; FSYNC_askfs(cloneId, tpartp->name, FSYNC_RESTOREVOLUME, 0); } return 0; @@ -1687,7 +1714,7 @@ XVolListPartitions(struct rx_call *acid, struct partEntries *pEntries) struct stat rbuf, pbuf; char namehead[9]; struct partList partList; - struct DiskPartition *dp; + struct DiskPartition64 *dp; int i, j = 0, k; strcpy(namehead, "/vicep"); /*7 including null terminator */ @@ -1775,7 +1802,7 @@ VolListOneVolume(struct rx_call *acid, afs_int32 partid, afs_int32 { volintInfo *pntr; register struct Volume *tv; - struct DiskPartition *partP; + struct DiskPartition64 *partP; struct volser_trans *ttc; char pname[9], volname[20]; afs_int32 error = 0; @@ -1949,7 +1976,7 @@ VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, volintXInfo *xInfoP; /*Ptr to the extended vol info */ register struct Volume *tv; /*Volume ptr */ struct volser_trans *ttc; /*Volume transaction ptr */ - struct DiskPartition *partP; /*Ptr to partition */ + struct DiskPartition64 *partP; /*Ptr to partition */ char pname[9], volname[20]; /*Partition, volume names */ afs_int32 error; /*Error code */ afs_int32 code; /*Return code */ @@ -2163,7 +2190,7 @@ VolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags, { volintInfo *pntr; register struct Volume *tv; - struct DiskPartition *partP; + struct DiskPartition64 *partP; struct volser_trans *ttc; afs_int32 allocSize = 1000; /*to be changed to a larger figure */ char pname[9], volname[20]; @@ -2368,7 +2395,7 @@ VolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID, volintXInfo *xInfoP; /*Ptr to the extended vol info */ register struct Volume *tv; /*Volume ptr */ - struct DiskPartition *partP; /*Ptr to partition */ + struct DiskPartition64 *partP; /*Ptr to partition */ struct volser_trans *ttc; /*Volume transaction ptr */ afs_int32 allocSize = 1000; /*To be changed to a larger figure */ char pname[9], volname[20]; /*Partition, volume names */ @@ -2795,7 +2822,7 @@ SAFSVolConvertROtoRWvolume(struct rx_call *acid, afs_int32 partId, DIR *dirp; register struct volser_trans *ttc; char pname[16], volname[20]; - struct DiskPartition *partP; + struct DiskPartition64 *partP; afs_int32 ret = ENODEV; afs_int32 volid; diff --git a/src/volser/volser_prototypes.h b/src/volser/volser_prototypes.h index 71a65f473..f2f0d2f90 100644 --- a/src/volser/volser_prototypes.h +++ b/src/volser/volser_prototypes.h @@ -24,8 +24,8 @@ extern struct rx_connection *UV_Bind(afs_int32 aserver, afs_int32 port); extern void SubEnumerateEntry(struct nvldbentry *entry); extern void EnumerateEntry(struct nvldbentry *entry); extern int UV_NukeVolume(afs_int32 server, afs_int32 partid, afs_int32 volid); -extern int UV_PartitionInfo(afs_int32 server, char *pname, - struct diskPartition *partition); +extern int UV_PartitionInfo64(afs_int32 server, char *pname, + struct diskPartition64 *partition); extern int UV_CreateVolume(afs_int32 aserver, afs_int32 apart, char *aname, afs_int32 * anewid); extern int UV_CreateVolume2(afs_int32 aserver, afs_int32 apart, char *aname, diff --git a/src/volser/vos.c b/src/volser/vos.c index 53fe1e248..b61540216 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -2100,7 +2100,7 @@ MoveVolume(register struct cmd_syndesc *as, void *arock) afs_int32 flags, code, err; char fromPartName[10], toPartName[10]; - struct diskPartition partition; /* for space check */ + struct diskPartition64 partition; /* for space check */ volintInfo *p; volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); @@ -2169,7 +2169,7 @@ MoveVolume(register struct cmd_syndesc *as, void *arock) * check target partition for space to move volume */ - code = UV_PartitionInfo(toserver, toPartName, &partition); + code = UV_PartitionInfo64(toserver, toPartName, &partition); if (code) { fprintf(STDERR, "vos: cannot access partition %s\n", toPartName); exit(1); @@ -2225,7 +2225,7 @@ CopyVolume(register struct cmd_syndesc *as, void *arock) afs_int32 volid, fromserver, toserver, frompart, topart, code, err, flags; char fromPartName[10], toPartName[10], *tovolume; struct nvldbentry entry; - struct diskPartition partition; /* for space check */ + struct diskPartition64 partition; /* for space check */ volintInfo *p; volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); @@ -2320,7 +2320,7 @@ CopyVolume(register struct cmd_syndesc *as, void *arock) * check target partition for space to move volume */ - code = UV_PartitionInfo(toserver, toPartName, &partition); + code = UV_PartitionInfo64(toserver, toPartName, &partition); if (code) { fprintf(STDERR, "vos: cannot access partition %s\n", toPartName); exit(1); @@ -2372,7 +2372,7 @@ ShadowVolume(register struct cmd_syndesc *as, void *arock) afs_int32 code, err, flags; char fromPartName[10], toPartName[10], toVolName[32], *tovolume; struct nvldbentry entry; - struct diskPartition partition; /* for space check */ + struct diskPartition64 partition; /* for space check */ volintInfo *p, *q; p = (volintInfo *) 0; @@ -2505,7 +2505,7 @@ ShadowVolume(register struct cmd_syndesc *as, void *arock) * check target partition for space to move volume */ - code = UV_PartitionInfo(toserver, toPartName, &partition); + code = UV_PartitionInfo64(toserver, toPartName, &partition); if (code) { fprintf(STDERR, "vos: cannot access partition %s\n", toPartName); exit(1); @@ -4992,7 +4992,7 @@ PartitionInfo(register struct cmd_syndesc *as, void *arock) afs_int32 apart; afs_int32 aserver, code; char pname[10]; - struct diskPartition partition; + struct diskPartition64 partition; struct partList dummyPartList; int i, cnt; int printSummary=0, sumPartitions=0; @@ -5041,7 +5041,7 @@ PartitionInfo(register struct cmd_syndesc *as, void *arock) for (i = 0; i < cnt; i++) { if (dummyPartList.partFlags[i] & PARTVALID) { MapPartIdIntoName(dummyPartList.partId[i], pname); - code = UV_PartitionInfo(aserver, pname, &partition); + code = UV_PartitionInfo64(aserver, pname, &partition); if (code) { fprintf(STDERR, "Could not get information on partition %s\n", pname); @@ -5049,13 +5049,11 @@ PartitionInfo(register struct cmd_syndesc *as, void *arock) exit(1); } fprintf(STDOUT, - "Free space on partition %s: %d K blocks out of total %d\n", + "Free space on partition %s: %lld K blocks out of total %lld\n", pname, partition.free, partition.minFree); sumPartitions++; - FillInt64(tmp,0,partition.free); - AddUInt64(sumFree,tmp,&sumFree); - FillInt64(tmp,0,partition.minFree); - AddUInt64(sumStorage,tmp,&sumStorage); + AddUInt64(sumFree,partition.free,&sumFree); + AddUInt64(sumStorage,partition.minFree,&sumStorage); } } if (printSummary) { diff --git a/src/volser/vsprocs.c b/src/volser/vsprocs.c index a61123238..25d8ae796 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -593,16 +593,27 @@ UV_NukeVolume(afs_int32 server, afs_int32 partid, afs_int32 volid) /* like df. Return usage of on in */ int -UV_PartitionInfo(afs_int32 server, char *pname, - struct diskPartition *partition) +UV_PartitionInfo64(afs_int32 server, char *pname, + struct diskPartition64 *partition) { register struct rx_connection *aconn; - afs_int32 code; + afs_int32 code = 0; - code = 0; aconn = (struct rx_connection *)0; aconn = UV_Bind(server, AFSCONF_VOLUMEPORT); - code = AFSVolPartitionInfo(aconn, pname, partition); + code = AFSVolPartitionInfo64(aconn, pname, partition); + if (code == RXGEN_OPCODE) { + struct diskPartition *dpp = (struct diskPartition *)malloc(sizeof(struct diskPartition)); + code = AFSVolPartitionInfo(aconn, pname, dpp); + if (!code) { + strncpy(partition->name, dpp->name, 32); + strncpy(partition->devName, dpp->devName, 32); + partition->lock_fd = dpp->lock_fd; + partition->free = dpp->free; + partition->minFree = dpp->minFree; + } + free(dpp); + } if (code) { fprintf(STDERR, "Could not get information on partition %s\n", pname); PrintError("", code); -- 2.39.5