From b651ece9bdb2ea9dc19907a5686e9d084f3c03d6 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Wed, 5 Mar 2008 21:51:19 +0000 Subject: [PATCH] large-partition-support-20080305 LICENSE IPL10 FIXES 88811 support partitions over 2tb --- src/config/stds.h | 13 ++++- src/fsint/afsint.xg | 77 ++++++++++++++++++++++++++ src/fsprobe/fsprobe.c | 56 ++++++++++++++----- src/viced/afsfileprocs.c | 121 +++++++++++++++++++++++++++++++++++++++-- src/vol/clone.c | 1 - src/vol/fssync-debug.c | 16 +++--- src/vol/fssync-server.c | 8 +-- src/vol/listinodes.c | 2 +- src/vol/namei_ops.c | 2 +- src/vol/partition.c | 61 +++++++++++---------- src/vol/partition.h | 38 ++++++------- src/vol/purge.c | 2 +- src/vol/salvaged.c | 4 +- src/vol/salvager.c | 2 +- src/vol/salvsync-server.c | 4 +- src/vol/vol-info.c | 26 ++++----- src/vol/vol-salvage.c | 12 ++-- src/vol/vol-salvage.h | 8 +-- src/vol/volume.c | 58 ++++++++++---------- src/vol/volume.h | 10 ++-- src/vol/vutil.c | 2 +- src/volser/dumpstuff.c | 13 ++++- src/volser/vol-dump.c | 14 ++--- src/volser/volint.xg | 15 +++++ src/volser/volprocs.c | 41 ++++++++++---- src/volser/volser_prototypes.h | 4 +- src/volser/vos.c | 24 ++++---- src/volser/vsprocs.c | 22 ++++++-- 28 files changed, 470 insertions(+), 186 deletions(-) diff --git a/src/config/stds.h b/src/config/stds.h index 9266b0c..4e5d9d1 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 0x7FFFFFFF +#define MAX_AFS_UINT32 0xFFFFFFFF +#define MAX_AFS_INT64 0x7FFFFFFFFFFFFFFFL +#define MAX_AFS_UINT64 0xFFFFFFFFFFFFFFFFL + typedef short afs_int16; typedef unsigned short afs_uint16; #ifdef AFS_64BIT_ENV @@ -73,9 +78,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) = (h); (t) <<= 32; (t) |= (l); -#define SplitInt64(t,h,l) (h) = (t) >> 32; (l) = (t) & 0xFFFFFFFF; +#define SplitInt64(t,h,l) (h) = (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; @@ -111,6 +118,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; #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 634c397..f659163 100644 --- a/src/fsint/afsint.xg +++ b/src/fsint/afsint.xg @@ -698,3 +698,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 f512aec..c9ce4ac 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) @@ -242,7 +243,9 @@ fsprobe_LWP() struct fsprobe_ConnectionInfo *curr_conn; /*Current connection */ struct ProbeViceStatistics *curr_stats; /*Current stats region */ int *curr_probeOK; /*Current probeOK field */ - + ViceStatistics64 stats64; /*Current stats region */ + stats64.ViceStatistics64_val = (afs_uint64 *)malloc(STATS64_VERSION * + sizeof(afs_uint64)); while (1) { /*Service loop */ /* * Iterate through the server connections, gathering data. @@ -274,8 +277,19 @@ fsprobe_LWP() "[%s] Connection valid, calling RXAFS_GetStatistics\n", rn); *curr_probeOK = - RXAFS_GetStatistics(curr_conn->rxconn, curr_stats); - + 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() int i, code; char pname[10]; struct diskPartition partition; + struct diskPartition64 *partition64p = + (struct diskPartition64 *)malloc(sizeof(struct diskPartition64)); if (fsprobe_debug) fprintf(stderr, @@ -299,22 +315,36 @@ fsprobe_LWP() MapPartIdIntoName(curr_conn->partList.partId[i], pname); code = - AFSVolPartitionInfo(curr_conn->rxVolconn, pname, - &partition); + 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,7 +388,7 @@ fsprobe_LWP() if (code) fprintf(stderr, "[%s] IOMGR_Select returned code %d\n", rn, code); } /*Service loop */ - + free(stats64.ViceStatistics64_val); } /*fsprobe_LWP */ /*list all the partitions on */ diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index 8c60b13..6c72723 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -1850,8 +1850,8 @@ RXGetVolumeStatus(AFSFetchVolumeStatus * status, char **name, char **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); /* now allocate and copy these things; they're freed by the RXGEN stub */ temp = strlen(V_name(volptr)) + 1; @@ -5451,13 +5451,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 = RoundInt64ToInt32(part->totalUsable); + stats->Disks[i].BlocksAvailable = RoundInt64ToInt32(part->free); memset(stats->Disks[i].Name, 0, AFS_DISKNAMESIZE); strncpy(stats->Disks[i].Name, part->name, AFS_DISKNAMESIZE); i++; @@ -5532,6 +5532,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; + + 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 432b3f2..c1bf016 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/fssync-debug.c b/src/vol/fssync-debug.c index f694a84..1084e6d 100644 --- a/src/vol/fssync-debug.c +++ b/src/vol/fssync-debug.c @@ -105,7 +105,7 @@ static int StatsQuery(struct cmd_syndesc * as, void * rock); static int VnQuery(struct cmd_syndesc * as, void * rock); static void print_vol_stats_general(VolPkgStats * stats); -static void print_vol_stats_viceP(struct DiskPartitionStats * stats); +static void print_vol_stats_viceP(struct DiskPartitionStats64 * stats); static void print_vol_stats_hash(struct VolumeHashChainStats * stats); #ifdef AFS_DEMAND_ATTACH_FS static void print_vol_stats_hdr(struct volume_hdr_LRU_stats * stats); @@ -1045,7 +1045,7 @@ StatsQuery(struct cmd_syndesc * as, void * rock) #ifdef AFS_DEMAND_ATTACH_FS struct volume_hdr_LRU_stats * hdr_stats; #endif - struct DiskPartitionStats * vicep_stats; + struct DiskPartitionStats64 * vicep_stats; } sres; sres.ptr = res_buf; @@ -1222,13 +1222,13 @@ print_vol_stats_general(VolPkgStats * stats) } static void -print_vol_stats_viceP(struct DiskPartitionStats * stats) +print_vol_stats_viceP(struct DiskPartitionStats64 * stats) { - printf("DiskPartitionStats = {\n"); - printf("\tfree = %d\n", stats->free); - printf("\tminFree = %d\n", stats->minFree); - printf("\ttotalUsable = %d\n", stats->totalUsable); - printf("\tf_files = %d\n", stats->f_files); + printf("DiskPartitionStats64 = {\n"); + printf("\tfree = %lld\n", stats->free); + printf("\tminFree = %lld\n", stats->minFree); + printf("\ttotalUsable = %lld\n", stats->totalUsable); + printf("\tf_files = %lld\n", stats->f_files); #ifdef AFS_DEMAND_ATTACH_FS printf("\tvol_list_len = %d\n", stats->vol_list_len); #endif diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c index 8914f53..9eb0bfd 100644 --- a/src/vol/fssync-server.c +++ b/src/vol/fssync-server.c @@ -1078,8 +1078,8 @@ static afs_int32 FSYNC_com_StatsOpViceP(FSSYNC_StatsOp_command * scom, SYNC_response * res) { afs_int32 code = SYNC_OK; - struct DiskPartition * dp; - struct DiskPartitionStats * stats; + struct DiskPartition64 * dp; + struct DiskPartitionStats64 * stats; if (SYNC_verifyProtocolString(scom->sop->args.partName, sizeof(scom->sop->args.partName))) { res->hdr.reason = SYNC_REASON_MALFORMED_PACKET; @@ -1091,14 +1091,14 @@ FSYNC_com_StatsOpViceP(FSSYNC_StatsOp_command * scom, SYNC_response * res) if (!dp) { code = SYNC_FAILED; } else { - stats = (struct DiskPartitionStats *) res->payload.buf; + stats = (struct DiskPartitionStats64 *) res->payload.buf; stats->free = dp->free; stats->totalUsable = dp->totalUsable; stats->minFree = dp->minFree; stats->f_files = dp->f_files; stats->vol_list_len = dp->vol_list.len; - res->hdr.response_len += sizeof(struct DiskPartitionStats); + res->hdr.response_len += sizeof(struct DiskPartitionStats64); } done: diff --git a/src/vol/listinodes.c b/src/vol/listinodes.c index e0c39db..526bd00 100644 --- a/src/vol/listinodes.c +++ b/src/vol/listinodes.c @@ -1443,7 +1443,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 c070911..b6e1c1c 100644 --- a/src/vol/namei_ops.c +++ b/src/vol/namei_ops.c @@ -1564,7 +1564,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 8963854..6874522 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -181,14 +181,14 @@ RCSID /*@printflike@*/ extern void Log(const char *format, ...); int aixlow_water = 8; /* default 8% */ -struct DiskPartition *DiskPartitionList; +struct DiskPartition64 *DiskPartitionList; #ifdef AFS_DEMAND_ATTACH_FS -static struct DiskPartition *DiskPartitionTable[VOLMAXPARTS+1]; +static struct DiskPartition64 *DiskPartitionTable[VOLMAXPARTS+1]; -static struct DiskPartition * VLookupPartition_r(char * path); -static void AddPartitionToTable_r(struct DiskPartition *); -static void DeletePartitionFromTable_r(struct DiskPartition *); +static struct DiskPartition64 * VLookupPartition_r(char * path); +static void AddPartitionToTable_r(struct DiskPartition64 *); +static void DeletePartitionFromTable_r(struct DiskPartition64 *); #endif /* AFS_DEMAND_ATTACH_FS */ #ifdef AFS_SGI_XFS_IOPS_ENV @@ -241,8 +241,8 @@ VInitPartitionPackage(void) 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) @@ -733,7 +733,7 @@ VCheckPartition(char *partName) int VAttachPartitions(void) { - struct DiskPartition *partP, *prevP, *nextP; + struct DiskPartition64 *partP, *prevP, *nextP; struct vpt_iter iter; struct vptab entry; @@ -834,7 +834,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; @@ -844,10 +844,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; #ifdef AFS_DEMAND_ATTACH_FS dp = VLookupPartition_r(name); #else /* AFS_DEMAND_ATTACH_FS */ @@ -861,10 +861,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; @@ -873,7 +873,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; @@ -897,9 +897,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; + int fd, bsize, code; + afs_int64 totalblks, free, used, availblks; int reserved; #ifdef afs_statvfs struct afs_statvfs statbuf; @@ -962,7 +963,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); @@ -972,7 +973,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 @@ -1061,7 +1062,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); @@ -1086,7 +1087,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) @@ -1111,7 +1112,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) @@ -1134,7 +1135,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; @@ -1237,7 +1238,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); @@ -1266,10 +1267,10 @@ VUnlockPartition(char *name) /* XXX not sure this will work on AFS_NT40_ENV * needs to be tested! */ -struct DiskPartition * +struct DiskPartition64 * VGetPartitionById_r(afs_int32 id, int abortp) { - struct DiskPartition * dp = NULL; + struct DiskPartition64 *dp = NULL; if ((id >= 0) && (id <= VOLMAXPARTS)) { dp = DiskPartitionTable[id]; @@ -1281,10 +1282,10 @@ VGetPartitionById_r(afs_int32 id, int abortp) return dp; } -struct DiskPartition * +struct DiskPartition64 * VGetPartitionById(afs_int32 id, int abortp) { - struct Diskpartition * dp; + struct Diskpartition64 * dp; VOL_LOCK; dp = VGetPartitionById_r(id, abortp); @@ -1293,7 +1294,7 @@ VGetPartitionById(afs_int32 id, int abortp) return dp; } -static struct DiskPartition * +static struct DiskPartition64 * VLookupPartition_r(char * path) { afs_int32 id = volutil_GetPartitionID(path); @@ -1305,14 +1306,14 @@ VLookupPartition_r(char * path) } static void -AddPartitionToTable_r(struct DiskPartition * dp) +AddPartitionToTable_r(struct DiskPartition64 *dp) { assert(dp->index >= 0 && dp->index <= VOLMAXPARTS); DiskPartitionTable[dp->index] = dp; } static void -DeletePartitionFromTable_r(struct DiskPartition * dp) +DeletePartitionFromTable_r(struct DiskPartition64 *dp) { assert(dp->index >= 0 && dp->index <= VOLMAXPARTS); DiskPartitionTable[dp->index] = NULL; diff --git a/src/vol/partition.h b/src/vol/partition.h index 7d869df..afdb8d1 100644 --- a/src/vol/partition.h +++ b/src/vol/partition.h @@ -51,15 +51,15 @@ * 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 */ afs_int32 index; /* partition index (0<=x<=VOLMAXPARTS) */ 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 @@ -69,7 +69,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 @@ -77,10 +77,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 */ #ifdef AFS_DEMAND_ATTACH_FS struct { struct rx_queue head; /* list of volumes on this partition (VByPList) */ @@ -91,11 +91,11 @@ struct DiskPartition { #endif /* AFS_DEMAND_ATTACH_FS */ }; -struct DiskPartitionStats { - afs_int32 free; - afs_int32 totalUsable; - afs_int32 minFree; - afs_int32 f_files; +struct DiskPartitionStats64 { + afs_int64 free; + afs_int64 totalUsable; + afs_int64 minFree; + afs_int64 f_files; #ifdef AFS_DEMAND_ATTACH_FS afs_int32 vol_list_len; #endif @@ -115,12 +115,12 @@ extern int VValidVPTEntry(struct vptab *vptp); struct Volume; /* Potentially forward definition */ -extern struct DiskPartition *DiskPartitionList; -extern struct DiskPartition *VGetPartition(char * name, int abortp); -extern struct DiskPartition *VGetPartition_r(char * name, int abortp); +extern struct DiskPartition64 *DiskPartitionList; +extern struct DiskPartition64 *VGetPartition(char * name, int abortp); +extern struct DiskPartition64 *VGetPartition_r(char * name, int abortp); #ifdef AFS_DEMAND_ATTACH_FS -extern struct DiskPartition *VGetPartitionById(afs_int32 index, int abortp); -extern struct DiskPartition *VGetPartitionById_r(afs_int32 index, int abortp); +extern struct DiskPartition64 *VGetPartitionById(afs_int32 index, int abortp); +extern struct DiskPartition64 *VGetPartitionById_r(afs_int32 index, int abortp); #endif extern int VAttachPartitions(void); extern void VLockPartition(char *name); @@ -129,9 +129,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 87ecc99..a617270 100644 --- a/src/vol/purge.c +++ b/src/vol/purge.c @@ -63,7 +63,7 @@ static void PurgeHeader(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/salvaged.c b/src/vol/salvaged.c index f8e2329..3002780 100644 --- a/src/vol/salvaged.c +++ b/src/vol/salvaged.c @@ -186,7 +186,7 @@ handleit(struct cmd_syndesc *as, void *arock) 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 @@ -578,7 +578,7 @@ DoSalvageVolume(struct SalvageQueueNode * node, int slot) { char childLog[AFSDIR_PATH_MAX]; int ret; - struct DiskPartition * partP; + struct DiskPartition64 * partP; /* do not allow further forking inside salvager */ canfork = 0; diff --git a/src/vol/salvager.c b/src/vol/salvager.c index d7dab03..3cd862d 100644 --- a/src/vol/salvager.c +++ b/src/vol/salvager.c @@ -142,7 +142,7 @@ handleit(struct cmd_syndesc *as, void *arock) 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) { diff --git a/src/vol/salvsync-server.c b/src/vol/salvsync-server.c index 8d69b3a..b28a42f 100644 --- a/src/vol/salvsync-server.c +++ b/src/vol/salvsync-server.c @@ -619,7 +619,7 @@ static afs_int32 SALVSYNC_com_CancelAll(SALVSYNC_command * com, SALVSYNC_response * res) { struct SalvageQueueNode * np, *nnp; - struct DiskPartition * dp; + struct DiskPartition64 * dp; for (dp = DiskPartitionList ; dp ; dp = dp->next) { for (queue_Scan(&salvageQueue.part[dp->index], np, nnp, SalvageQueueNode)) { @@ -1148,7 +1148,7 @@ struct SalvageQueueNode * SALVSYNC_getWork(void) { int i, ret; - struct DiskPartition * dp = NULL, * fdp; + struct DiskPartition64 * dp = NULL, * fdp; static afs_int32 next_part_sched = 0; struct SalvageQueueNode *node = NULL, *np; diff --git a/src/vol/vol-info.c b/src/vol/vol-info.c index d88df7e..a4bea72 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 56eb2a8..86445ea 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -269,7 +269,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 */ @@ -439,7 +439,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]; @@ -480,10 +480,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 */ @@ -671,7 +671,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); @@ -703,7 +703,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/vol-salvage.h b/src/vol/vol-salvage.h index da9fbec..ad5b5f9 100644 --- a/src/vol/vol-salvage.h +++ b/src/vol/vol-salvage.h @@ -156,7 +156,7 @@ extern char *fileSysPath; /* The path of the mounted partition currently extern char *fileSysPathName; /* NT needs this to make name pretty in log. */ extern IHandle_t *VGLinkH; /* Link handle for current volume group. */ extern int VGLinkH_cnt; /* # of references to lnk handle. */ -extern struct DiskPartition *fileSysPartition; /* Partition being salvaged */ +extern struct DiskPartition64 *fileSysPartition; /* Partition being salvaged */ #ifndef AFS_NT40_ENV extern char *fileSysDeviceName; /* The block device where the file system * being salvaged was mounted */ @@ -251,9 +251,9 @@ extern void RemoveTheForce(char *path); extern void SalvageDir(char *name, VolumeId rwVid, struct VnodeInfo *dirVnodeInfo, IHandle_t * alinkH, int i, struct DirSummary *rootdir, int *rootdirfound); -extern void SalvageFileSysParallel(struct DiskPartition *partP); -extern void SalvageFileSys(struct DiskPartition *partP, VolumeId singleVolumeNumber); -extern void SalvageFileSys1(struct DiskPartition *partP, +extern void SalvageFileSysParallel(struct DiskPartition64 *partP); +extern void SalvageFileSys(struct DiskPartition64 *partP, VolumeId singleVolumeNumber); +extern void SalvageFileSys1(struct DiskPartition64 *partP, VolumeId singleVolumeNumber); extern int SalvageHeader(register struct stuff *sp, struct InodeSummary *isp, int check, int *deleteMe); diff --git a/src/vol/volume.c b/src/vol/volume.c index 379541f..e97f7c8 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -170,7 +170,7 @@ extern void *calloc(), *realloc(); /* Forward declarations */ static Volume *attach2(Error * ec, VolId vid, char *path, register struct VolumeHeader *header, - struct DiskPartition *partp, Volume * vp, + struct DiskPartition64 *partp, Volume * vp, int isbusy, int mode); static void ReallyFreeVolume(Volume * vp); #ifdef AFS_DEMAND_ATTACH_FS @@ -278,7 +278,7 @@ ffs(x) #ifdef AFS_PTHREAD_ENV 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; @@ -288,7 +288,7 @@ typedef struct vinitvolumepackage_thread_t { static void * VInitVolumePackageThread(void * args); #endif /* AFS_PTHREAD_ENV */ -static int VAttachVolumesByPartition(struct DiskPartition *diskP, +static int VAttachVolumesByPartition(struct DiskPartition64 *diskP, int * nAttached, int * nUnattached); @@ -345,9 +345,9 @@ static int VCheckFree(Volume * vp); /* VByP List */ static void AddVolumeToVByPList_r(Volume * vp); static void DeleteVolumeFromVByPList_r(Volume * vp); -static void VVByPListBeginExclusive_r(struct DiskPartition * dp); -static void VVByPListEndExclusive_r(struct DiskPartition * dp); -static void VVByPListWait_r(struct DiskPartition * dp); +static void VVByPListBeginExclusive_r(struct DiskPartition64 * dp); +static void VVByPListEndExclusive_r(struct DiskPartition64 * dp); +static void VVByPListWait_r(struct DiskPartition64 * dp); /* online salvager */ static int VCheckSalvage(register Volume * vp); @@ -362,8 +362,8 @@ static void VHashEndExclusive_r(VolumeHashChainHead * head); static void VHashWait_r(VolumeHashChainHead * head); /* shutdown */ -static int ShutdownVByPForPass_r(struct DiskPartition * dp, int pass); -static int ShutdownVolumeWalk_r(struct DiskPartition * dp, int pass, +static int ShutdownVByPForPass_r(struct DiskPartition64 * dp, int pass); +static int ShutdownVolumeWalk_r(struct DiskPartition64 * dp, int pass, struct rx_queue ** idx); static void ShutdownController(vshutdown_thread_t * params); static void ShutdownCreateSchedule(vshutdown_thread_t * params); @@ -497,7 +497,7 @@ VInitVolumePackage(ProgramType pt, afs_uint32 nLargeVnodes, afs_uint32 nSmallVno 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; @@ -602,7 +602,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; @@ -636,7 +636,7 @@ VInitVolumePackageThread(void * args) { * attach all volumes on a given disk partition */ static int -VAttachVolumesByPartition(struct DiskPartition *diskP, int * nAttached, int * nUnattached) +VAttachVolumesByPartition(struct DiskPartition64 *diskP, int * nAttached, int * nUnattached) { DIR * dirp; struct dirent * dp; @@ -747,7 +747,7 @@ VShutdown_r(void) register Volume *vp, *np; register afs_int32 code; #ifdef AFS_DEMAND_ATTACH_FS - struct DiskPartition * diskP; + struct DiskPartition64 * diskP; struct diskpartition_queue_t * dpq; vshutdown_thread_t params; pthread_t tid; @@ -898,7 +898,7 @@ static void ShutdownController(vshutdown_thread_t * params) { /* XXX debug */ - struct DiskPartition * diskP; + struct DiskPartition64 * diskP; Device id; vshutdown_thread_t shadow; @@ -943,7 +943,7 @@ ShutdownController(vshutdown_thread_t * params) static void ShutdownCreateSchedule(vshutdown_thread_t * params) { - struct DiskPartition * diskP; + struct DiskPartition64 * diskP; int sum, thr_workload, thr_left; int part_residue[VOLMAXPARTS+1]; Device id; @@ -1065,7 +1065,7 @@ VShutdownThread(void * args) Volume * vp; vshutdown_thread_t * params; int part, code, found, pass, schedule_version_save, count; - struct DiskPartition *diskP; + struct DiskPartition64 *diskP; struct diskpartition_queue_t * dpq; Device id; @@ -1214,7 +1214,7 @@ VShutdownThread(void * args) * note that this function will not allow mp-fast * shutdown of a partition */ int -VShutdownByPartition_r(struct DiskPartition * dp) +VShutdownByPartition_r(struct DiskPartition64 * dp) { int pass, retVal; int pass_stats[4]; @@ -1265,7 +1265,7 @@ VShutdownByPartition_r(struct DiskPartition * dp) * traversal */ static int -ShutdownVByPForPass_r(struct DiskPartition * dp, int pass) +ShutdownVByPForPass_r(struct DiskPartition64 * dp, int pass) { struct rx_queue * q = queue_First(&dp->vol_list, rx_queue); register int i = 0; @@ -1280,7 +1280,7 @@ ShutdownVByPForPass_r(struct DiskPartition * dp, int pass) * returns 1 if a volume was shutdown in this pass, * 0 otherwise */ static int -ShutdownVolumeWalk_r(struct DiskPartition * dp, int pass, +ShutdownVolumeWalk_r(struct DiskPartition64 * dp, int pass, struct rx_queue ** idx) { struct rx_queue *qp, *nqp; @@ -1587,7 +1587,7 @@ VPreAttachVolumeById_r(Error * ec, VolId volumeId) { Volume *vp; - struct DiskPartition *partp; + struct DiskPartition64 *partp; *ec = 0; @@ -1635,7 +1635,7 @@ VPreAttachVolumeById_r(Error * ec, */ Volume * VPreAttachVolumeByVp_r(Error * ec, - struct DiskPartition * partp, + struct DiskPartition64 * partp, Volume * vp, VolId vid) { @@ -1746,7 +1746,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; VolId volumeId; @@ -2069,7 +2069,7 @@ VAttachVolumeByVp_r(Error * ec, Volume * vp, int mode) struct afs_stat status; struct VolumeDiskHeader diskHeader; struct VolumeHeader iheader; - struct DiskPartition *partp; + struct DiskPartition64 *partp; char path[64]; int isbusy = 0; VolId volumeId; @@ -2236,7 +2236,7 @@ VAttachVolumeByVp_r(Error * ec, Volume * vp, int mode) */ private Volume * attach2(Error * ec, VolId volumeId, char *path, register struct VolumeHeader * header, - struct DiskPartition * partp, register Volume * vp, int isbusy, int mode) + struct DiskPartition64 * partp, register Volume * vp, int isbusy, int mode) { vp->specialStatus = (byte) (isbusy ? VBUSY : 0); IH_INIT(vp->vnodeIndex[vLarge].handle, partp->device, header->parent, @@ -3123,7 +3123,7 @@ void VDetachVolume_r(Error * ec, Volume * vp) { VolumeId volume; - struct DiskPartition *tpartp; + struct DiskPartition64 *tpartp; int notifyServer, useDone = FSYNC_VOL_ON; *ec = 0; /* always "succeeds" */ @@ -4682,7 +4682,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] = '/'; @@ -6840,7 +6840,7 @@ DeleteVolumeFromVByPList_r(Volume * vp) */ /* take exclusive control over the list */ static void -VVByPListBeginExclusive_r(struct DiskPartition * dp) +VVByPListBeginExclusive_r(struct DiskPartition64 * dp) { assert(dp->vol_list.busy == 0); dp->vol_list.busy = 1; @@ -6864,7 +6864,7 @@ VVByPListBeginExclusive_r(struct DiskPartition * dp) * @internal volume package internal use only. */ static void -VVByPListEndExclusive_r(struct DiskPartition * dp) +VVByPListEndExclusive_r(struct DiskPartition64 * dp) { assert(dp->vol_list.busy); dp->vol_list.busy = 0; @@ -6896,7 +6896,7 @@ VVByPListEndExclusive_r(struct DiskPartition * dp) * @internal volume package internal use only. */ static void -VVByPListWait_r(struct DiskPartition * dp) +VVByPListWait_r(struct DiskPartition64 * dp) { while (dp->vol_list.busy) { VOL_CV_WAIT(&dp->vol_list.cv); @@ -7147,7 +7147,7 @@ VPrintExtendedCacheStats_r(int flags) /* print extended disk related statistics */ { - struct DiskPartition * diskP; + struct DiskPartition64 * diskP; afs_uint32 vol_count[VOLMAXPARTS+1]; byte part_exists[VOLMAXPARTS+1]; Device id; diff --git a/src/vol/volume.h b/src/vol/volume.h index 049e900..48c8774 100644 --- a/src/vol/volume.h +++ b/src/vol/volume.h @@ -581,7 +581,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 */ @@ -758,8 +758,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, afs_uint32 nLargeVnodes, afs_uint32 nSmallVnodes, int connect, afs_uint32 volcache); extern void DiskToVolumeHeader(VolumeHeader_t * h, VolumeDiskHeader_t * dh); @@ -773,10 +773,10 @@ extern Volume *VPreAttachVolumeByName(Error * ec, char *partition, char *name); extern Volume *VPreAttachVolumeByName_r(Error * ec, char *partition, char *name); extern Volume *VPreAttachVolumeById_r(Error * ec, char * partition, VolId volumeId); -extern Volume *VPreAttachVolumeByVp_r(Error * ec, struct DiskPartition * partp, +extern Volume *VPreAttachVolumeByVp_r(Error * ec, struct DiskPartition64 * partp, Volume * vp, VolId volume_id); extern Volume *VGetVolumeByVp_r(Error * ec, Volume * vp); -extern int VShutdownByPartition_r(struct DiskPartition * dp); +extern int VShutdownByPartition_r(struct DiskPartition64 * dp); extern int VShutdownVolume_r(Volume * vp); extern int VConnectSALV(void); extern int VConnectSALV_r(void); diff --git a/src/vol/vutil.c b/src/vol/vutil.c index 38d7e1f..789f0e3 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 67bbbaf..10bce4c 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -77,7 +77,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 */ @@ -987,6 +987,10 @@ ProcessIndex(Volume * vp, VnodeClass class, afs_int32 ** Bufp, int *sizep, (size <= vcp->diskSize ? 0 : size - vcp->diskSize) >> vcp->logSize; if (nVnodes > 0) { + if (DoLogging) { + Log("RestoreVolume ProcessIndex: Set up %d inodes for volume %d\n", + nVnodes, V_id(vp)); + } Buf = (afs_int32 *) malloc(nVnodes * sizeof(afs_int32)); if (Buf == NULL) { STREAM_CLOSE(afile); @@ -1006,6 +1010,9 @@ ProcessIndex(Volume * vp, VnodeClass class, afs_int32 ** Bufp, int *sizep, } offset += vcp->diskSize; } + if (DoLogging) { + Log("RestoreVolume ProcessIndex: found %d inodes\n", cnt); + } *Bufp = Buf; *sizep = nVnodes; } @@ -1146,6 +1153,10 @@ ReadVnodes(register struct iod *iodp, Volume * vp, int incremental, if (!ReadInt32(iodp, &vnode->uniquifier)) return VOLSERREAD_DUMPERROR; + + if (DoLogging) { + Log("ReadVnodes: setup %d/%d\n", vnodeNumber, vnode->uniquifier); + } while ((tag = iod_getc(iodp)) > D_MAX && tag != EOF) { haveStuff = 1; switch (tag) { diff --git a/src/volser/vol-dump.c b/src/volser/vol-dump.c index 0686add..7376257 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; @@ -833,7 +833,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 46bd974..292536f 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]; /* Mounted partition name */ + 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 c020648..20e22b2 100644 --- a/src/volser/volprocs.c +++ b/src/volser/volprocs.c @@ -101,7 +101,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 */ @@ -287,6 +287,27 @@ 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; + partition->free=RoundInt64ToInt32(dp->free); + partition->minFree=RoundInt64ToInt32(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); @@ -294,10 +315,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; @@ -841,7 +862,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_VolOp(cloneId, tpartp->name, FSYNC_VOL_BREAKCBKS, 0, NULL); } return 0; @@ -1671,7 +1692,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 */ @@ -2058,7 +2079,7 @@ VolListOneVolume(struct rx_call *acid, afs_int32 partid, afs_int32 volumeId, volEntries *volumeInfo) { volintInfo *pntr; - struct DiskPartition *partP; + struct DiskPartition64 *partP; char pname[9], volname[20]; afs_int32 error = 0; DIR *dirp; @@ -2156,7 +2177,7 @@ VolXListOneVolume(struct rx_call *a_rxCidP, afs_int32 a_partID, { /*SAFSVolXListOneVolume */ volintXInfo *xInfoP; /*Ptr to the extended vol info */ - 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 */ DIR *dirp; /*Partition directory ptr */ @@ -2265,7 +2286,7 @@ VolListVolumes(struct rx_call *acid, afs_int32 partid, afs_int32 flags, volEntries *volumeInfo) { volintInfo *pntr; - struct DiskPartition *partP; + struct DiskPartition64 *partP; afs_int32 allocSize = 1000; /*to be changed to a larger figure */ char pname[9], volname[20]; afs_int32 error = 0; @@ -2390,7 +2411,7 @@ VolXListVolumes(struct rx_call *a_rxCidP, afs_int32 a_partID, { /*SAFSVolXListVolumes */ volintXInfo *xInfoP; /*Ptr to the extended vol info */ - struct DiskPartition *partP; /*Ptr to partition */ + struct DiskPartition64 *partP; /*Ptr to partition */ afs_int32 allocSize = 1000; /*To be changed to a larger figure */ char pname[9], volname[20]; /*Partition, volume names */ afs_int32 error = 0; /*Return code */ @@ -2706,7 +2727,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 71a65f4..f2f0d2f 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 cc63064..b436a66 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -2102,7 +2102,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); @@ -2171,7 +2171,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); @@ -2227,7 +2227,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); @@ -2322,7 +2322,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); @@ -2374,7 +2374,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; @@ -2507,7 +2507,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); @@ -4994,7 +4994,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; @@ -5043,7 +5043,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); @@ -5051,13 +5051,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 dde6ebd..75a7c1a 100644 --- a/src/volser/vsprocs.c +++ b/src/volser/vsprocs.c @@ -592,16 +592,28 @@ 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); -- 1.9.4