#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
#include <rx/xdr.h>
#include <afs/afsint.h>
#ifdef AFS_DEMAND_ATTACH_FS
pthread_mutex_t vol_salvsync_mutex;
+
+/*
+ * Set this to 1 to disallow SALVSYNC communication in all threads; used
+ * during shutdown, since the salvageserver may have gone away.
+ */
+static volatile sig_atomic_t vol_disallow_salvsync = 0;
#endif /* AFS_DEMAND_ATTACH_FS */
#ifdef AFS_OSF_ENV
static void FreeVolumeHeader(register Volume * vp);
static void AddVolumeToHashTable(register Volume * vp, int hashid);
static void DeleteVolumeFromHashTable(register Volume * vp);
+#if 0
static int VHold(Volume * vp);
+#endif
static int VHold_r(Volume * vp);
static void VGetBitmap_r(Error * ec, Volume * vp, VnodeClass class);
static void VReleaseVolumeHandles_r(Volume * vp);
static int VCheckOffline(register Volume * vp);
static int VCheckDetach(register Volume * vp);
static Volume * GetVolume(Error * ec, Error * client_ec, VolId volumeId, Volume * hint, int flags);
+#ifdef AFS_DEMAND_ATTACH_FS
static int VolumeExternalName_r(VolumeId volumeId, char * name, size_t len);
+#endif
int LogLevel; /* Vice loglevel--not defined as extern so that it will be
* defined when not linked with vice, XXXX */
/* online salvager */
static int VCheckSalvage(register Volume * vp);
static int VUpdateSalvagePriority_r(Volume * vp);
+#ifdef SALVSYNC_BUILD_CLIENT
static int VScheduleSalvage_r(Volume * vp);
-static int VCancelSalvage_r(Volume * vp, int reason);
+#endif
/* Volume hash table */
static void VReorderHash_r(VolumeHashChainHead * head, Volume * pp, Volume * vp);
/* VLRU */
static void VLRU_ComputeConstants(void);
static void VInitVLRU(void);
-static void VLRU_Init_Node_r(volatile Volume * vp);
-static void VLRU_Add_r(volatile Volume * vp);
-static void VLRU_Delete_r(volatile Volume * vp);
-static void VLRU_UpdateAccess_r(volatile Volume * vp);
+static void VLRU_Init_Node_r(Volume * vp);
+static void VLRU_Add_r(Volume * vp);
+static void VLRU_Delete_r(Volume * vp);
+static void VLRU_UpdateAccess_r(Volume * vp);
static void * VLRU_ScannerThread(void * args);
static void VLRU_Scan_r(int idx);
static void VLRU_Promote_r(int idx);
static void VLRU_Demote_r(int idx);
-static void VLRU_SwitchQueues(volatile Volume * vp, int new_idx, int append);
+static void VLRU_SwitchQueues(Volume * vp, int new_idx, int append);
/* soft detach */
-static int VCheckSoftDetach(volatile Volume * vp, afs_uint32 thresh);
-static int VCheckSoftDetachCandidate(volatile Volume * vp, afs_uint32 thresh);
-static int VSoftDetachVolume_r(volatile Volume * vp, afs_uint32 thresh);
+static int VCheckSoftDetach(Volume * vp, afs_uint32 thresh);
+static int VCheckSoftDetachCandidate(Volume * vp, afs_uint32 thresh);
+static int VSoftDetachVolume_r(Volume * vp, afs_uint32 thresh);
pthread_key_t VThread_key;
assert(pthread_cond_destroy(¶ms.thread_done_cv) == 0);
#else /* AFS_PTHREAD_ENV */
- DIR *dirp;
- struct dirent *dp;
/* Attach all the volumes in this partition */
for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
#ifdef AFS_PTHREAD_ENV
static void *
VInitVolumePackageThread(void * args) {
- int errors = 0; /* Number of errors while finding vice partitions. */
- DIR *dirp;
- struct dirent *dp;
struct DiskPartition64 *diskP;
struct vinitvolumepackage_thread_t * params;
struct diskpartition_queue_t * dpq;
* shutdown all remaining volumes
*/
+#ifdef AFS_DEMAND_ATTACH_FS
+
void
VShutdown_r(void)
{
int i;
- register Volume *vp, *np;
- register afs_int32 code;
-#ifdef AFS_DEMAND_ATTACH_FS
struct DiskPartition64 * diskP;
struct diskpartition_queue_t * dpq;
vshutdown_thread_t params;
}
Log("VShutdown: complete.\n");
+}
+
#else /* AFS_DEMAND_ATTACH_FS */
+
+void
+VShutdown_r(void)
+{
+ int i;
+ register Volume *vp, *np;
+ register afs_int32 code;
Log("VShutdown: shutting down on-line volumes...\n");
for (i = 0; i < VolumeHashTable.Size; i++) {
/* try to hold first volume in the hash table */
}
}
Log("VShutdown: complete.\n");
-#endif /* AFS_DEMAND_ATTACH_FS */
}
+#endif /* AFS_DEMAND_ATTACH_FS */
+
void
VShutdown(void)
VOL_UNLOCK;
}
+/**
+ * stop new activity (e.g. SALVSYNC) from occurring
+ *
+ * Use this to make the volume package less busy; for example, during
+ * shutdown. This doesn't actually shutdown/detach anything in the
+ * volume package, but prevents certain processes from ocurring. For
+ * example, preventing new SALVSYNC communication in DAFS. In theory, we
+ * could also use this to prevent new volume attachment, or prevent
+ * other programs from checking out volumes, etc.
+ */
+void
+VSetTranquil(void)
+{
+#ifdef AFS_DEMAND_ATTACH_FS
+ /* make sure we don't try to contact the salvageserver, since it may
+ * not be around anymore */
+ vol_disallow_salvsync = 1;
+#endif
+}
+
#ifdef AFS_DEMAND_ATTACH_FS
/*
* demand attach fs
if (thr_left) {
/* try to assign any leftover threads to partitions that
* had volume lengths closer to needing thread_target+1 */
- int max_residue, max_id;
+ int max_residue, max_id = 0;
/* compute the residues */
for (diskP = DiskPartitionList; diskP; diskP = diskP->next) {
static void *
VShutdownThread(void * args)
{
- struct rx_queue *qp;
- Volume * vp;
vshutdown_thread_t * params;
- int part, code, found, pass, schedule_version_save, count;
+ int found, pass, schedule_version_save, count;
struct DiskPartition64 *diskP;
struct diskpartition_queue_t * dpq;
Device id;
int
VShutdownByPartition_r(struct DiskPartition64 * dp)
{
- int pass, retVal;
+ int pass;
int pass_stats[4];
int total;
Log("VShutdownByPartition: shut down %d volumes on %s (pass[0]=%d, pass[1]=%d, pass[2]=%d, pass[3]=%d)\n",
total, VPartitionPath(dp), pass_stats[0], pass_stats[1], pass_stats[2], pass_stats[3]);
- return retVal;
+ return 0;
}
/* internal shutdown functionality
switch(V_attachState(vp)) {
case VOL_STATE_SALVAGING:
- /* make sure salvager knows we don't want
- * the volume back */
- VCancelSalvage_r(vp, SALVSYNC_SHUTDOWN);
+ /* Leave salvaging volumes alone. Any in-progress salvages will
+ * continue working after viced shuts down. This is intentional.
+ */
+
case VOL_STATE_PREATTACHED:
case VOL_STATE_ERROR:
VChangeState_r(vp, VOL_STATE_UNATTACHED);
VOffline_r(vp, "File server was shut down");
}
break;
+ default:
+ break;
}
VCancelReservation_r(vp);
VolumeHeaderToDisk(VolumeDiskHeader_t * dh, VolumeHeader_t * h)
{
- memset((char *)dh, 0, sizeof(VolumeDiskHeader_t));
+ memset(dh, 0, sizeof(VolumeDiskHeader_t));
dh->stamp = h->stamp;
dh->id = h->id;
dh->parent = h->parent;
void
DiskToVolumeHeader(VolumeHeader_t * h, VolumeDiskHeader_t * dh)
{
- memset((char *)h, 0, sizeof(VolumeHeader_t));
+ memset(h, 0, sizeof(VolumeHeader_t));
h->stamp = dh->stamp;
h->id = dh->id;
h->parent = dh->parent;
Volume *
VAttachVolumeByName_r(Error * ec, char *partition, char *name, int mode)
{
- register Volume *vp = NULL, *svp = NULL;
+ register Volume *vp = NULL;
int fd, n;
struct afs_stat status;
struct VolumeDiskHeader diskHeader;
VolId volumeId;
#ifdef AFS_DEMAND_ATTACH_FS
VolumeStats stats_save;
+ Volume *svp = NULL;
#endif /* AFS_DEMAND_ATTACH_FS */
*ec = 0;
char path[64];
int isbusy = 0;
VolId volumeId;
- Volume * nvp;
+ Volume * nvp = NULL;
VolumeStats stats_save;
*ec = 0;
Log("VAttachVolume: Error reading diskDataHandle vol header %s; error=%u\n", path, *ec);
}
- disk_header_loaded:
-
#ifdef AFS_DEMAND_ATTACH_FS
+# ifdef FSSYNC_BUILD_CLIENT
+ disk_header_loaded:
+#endif
if (!*ec) {
/* check for pending volume operations */
if (vp->pending_vol_op) {
/* see if the pending volume op requires exclusive access */
- if (!VVolOpLeaveOnline_r(vp, vp->pending_vol_op)) {
+ switch (vp->pending_vol_op->vol_op_state) {
+ case FSSYNC_VolOpPending:
+ /* this should never happen */
+ assert(vp->pending_vol_op->vol_op_state != FSSYNC_VolOpPending);
+ break;
+
+ case FSSYNC_VolOpRunningUnknown:
+ if (VVolOpLeaveOnline_r(vp, vp->pending_vol_op)) {
+ vp->pending_vol_op->vol_op_state = FSSYNC_VolOpRunningOnline;
+ break;
+ } else {
+ vp->pending_vol_op->vol_op_state = FSSYNC_VolOpRunningOffline;
+ /* fall through to take volume offline */
+ }
+
+ case FSSYNC_VolOpRunningOffline:
/* mark the volume down */
*ec = VOFFLINE;
VChangeState_r(vp, VOL_STATE_UNATTACHED);
if (VVolOpSetVBusy_r(vp, vp->pending_vol_op)) {
vp->specialStatus = VBUSY;
}
+ default:
+ break;
}
}
* area and mark it as initialized.
*/
if (!(V_stat_initialized(vp))) {
- memset((char *)(V_stat_area(vp)), 0, VOL_STATS_BYTES);
+ memset((V_stat_area(vp)), 0, VOL_STATS_BYTES);
V_stat_initialized(vp) = 1;
}
#endif /* OPENAFS_VOL_STATS */
V_offlineMessage(vp)[0] = '\0';
}
} else {
- V_inUse(vp) = programType;
+ if ((mode != V_PEEK) && (mode != V_SECRETLY))
+ V_inUse(vp) = programType;
V_checkoutMode(vp) = mode;
}
}
#endif /* AFS_DEMAND_ATTACH_FS */
+#if 0
static int
VHold(register Volume * vp)
{
VOL_UNLOCK;
return retVal;
}
+#endif
/***************************************************/
* - VOL_STATE_SHUTTING_DOWN
*/
if ((V_attachState(vp) == VOL_STATE_ERROR) ||
- (V_attachState(vp) == VOL_STATE_SHUTTING_DOWN)) {
+ (V_attachState(vp) == VOL_STATE_SHUTTING_DOWN) ||
+ (V_attachState(vp) == VOL_STATE_GOING_OFFLINE)) {
*ec = VNOVOL;
vp = NULL;
break;
/* allowable states:
* - PREATTACHED
* - ATTACHED
- * - GOING_OFFLINE
* - SALVAGING
*/
/*
* this test MUST happen after the volume header is loaded
*/
- if (vp->pending_vol_op && !VVolOpLeaveOnline_r(vp, vp->pending_vol_op)) {
+
+ /* only valid before/during demand attachment */
+ assert(!vp->pending_vol_op || vp->pending_vol_op->vol_op_state != FSSYNC_VolOpRunningUnknown);
+
+ /* deny getvolume due to running mutually exclusive vol op */
+ if (vp->pending_vol_op && vp->pending_vol_op->vol_op_state==FSSYNC_VolOpRunningOffline) {
/*
* volume cannot remain online during this volume operation.
* notify client.
void
VOffline_r(Volume * vp, char *message)
{
+#ifndef AFS_DEMAND_ATTACH_FS
Error error;
VolumeId vid = V_id(vp);
+#endif
assert(programType != volumeUtility);
if (!V_inUse(vp)) {
#endif /* AFS_DEMAND_ATTACH_FS */
}
+#ifdef AFS_DEMAND_ATTACH_FS
+/**
+ * Take a volume offline in order to perform a volume operation.
+ *
+ * @param[inout] ec address in which to store error code
+ * @param[in] vp volume object pointer
+ * @param[in] message volume offline status message
+ *
+ * @pre
+ * - VOL_LOCK is held
+ * - caller MUST hold a heavyweight ref on vp
+ *
+ * @post
+ * - volume is taken offline
+ * - if possible, volume operation is promoted to running state
+ * - on failure, *ec is set to nonzero
+ *
+ * @note Although this function does not return any value, it may
+ * still fail to promote our pending volume operation to
+ * a running state. Any caller MUST check the value of *ec,
+ * and MUST NOT blindly assume success.
+ *
+ * @warning if the caller does not hold a lightweight ref on vp,
+ * then it MUST NOT reference vp after this function
+ * returns to the caller.
+ *
+ * @internal volume package internal use only
+ */
+void
+VOfflineForVolOp_r(Error *ec, Volume *vp, char *message)
+{
+ assert(vp->pending_vol_op);
+ if (!V_inUse(vp)) {
+ VPutVolume_r(vp);
+ *ec = 1;
+ return;
+ }
+ if (V_offlineMessage(vp)[0] == '\0')
+ strncpy(V_offlineMessage(vp), message, sizeof(V_offlineMessage(vp)));
+ V_offlineMessage(vp)[sizeof(V_offlineMessage(vp)) - 1] = '\0';
+
+ vp->goingOffline = 1;
+ VChangeState_r(vp, VOL_STATE_GOING_OFFLINE);
+ VCreateReservation_r(vp);
+ VPutVolume_r(vp);
+
+ /* Wait for the volume to go offline */
+ while (!VIsOfflineState(V_attachState(vp))) {
+ /* do not give corrupted volumes to the volserver */
+ if (vp->salvage.requested && vp->pending_vol_op->com.programType != salvageServer) {
+ *ec = 1;
+ goto error;
+ }
+ VWaitStateChange_r(vp);
+ }
+ *ec = 0;
+ error:
+ VCancelReservation_r(vp);
+}
+#endif /* AFS_DEMAND_ATTACH_FS */
+
void
VOffline(Volume * vp, char *message)
{
DeleteVolumeFromVByPList_r(vp);
VLRU_Delete_r(vp);
VChangeState_r(vp, VOL_STATE_SHUTTING_DOWN);
+#else
+ if (programType != fileServer)
+ V_inUse(vp) = 0;
#endif /* AFS_DEMAND_ATTACH_FS */
VPutVolume_r(vp);
/* Will be detached sometime in the future--this is OK since volume is offline */
if ((programType != fileServer) &&
(V_inUse(vp) == programType) &&
((V_checkoutMode(vp) == V_VOLUPD) ||
+ (V_checkoutMode(vp) == V_SECRETLY) ||
((V_checkoutMode(vp) == V_CLONE) &&
(VolumeWriteable(vp))))) {
V_inUse(vp) = 0;
if ((programType != fileServer) &&
(V_inUse(vp) == programType) &&
((V_checkoutMode(vp) == V_VOLUPD) ||
+ (V_checkoutMode(vp) == V_SECRETLY) ||
((V_checkoutMode(vp) == V_CLONE) &&
(VolumeWriteable(vp))))) {
V_inUse(vp) = 0;
static int
VCheckOffline(register Volume * vp)
{
- Volume * rvp = NULL;
int ret = 0;
if (vp->goingOffline && !vp->nUsers) {
static int
VCheckOffline(register Volume * vp)
{
- Volume * rvp = NULL;
int ret = 0;
if (vp->goingOffline && !vp->nUsers) {
int
VVolOpLeaveOnline_r(Volume * vp, FSSYNC_VolOp_info * vopinfo)
{
- return (vopinfo->com.command == FSYNC_VOL_NEEDVOLUME &&
+ return (vopinfo->vol_op_state == FSSYNC_VolOpRunningOnline ||
+ (vopinfo->com.command == FSYNC_VOL_NEEDVOLUME &&
(vopinfo->com.reason == V_READONLY ||
(!VolumeWriteable(vp) &&
(vopinfo->com.reason == V_CLONE ||
- vopinfo->com.reason == V_DUMP))));
+ vopinfo->com.reason == V_DUMP)))));
}
/**
vp->salvage.requested = 1;
vp->salvage.reason = reason;
vp->stats.last_salvage = FT_ApproxTime();
+ if (VIsSalvager(V_inUse(vp))) {
+ Log("VRequestSalvage: volume %u appears to be salvaging, but we\n", vp->hashid);
+ Log(" didn't request a salvage. Forcing it offline waiting for the\n");
+ Log(" salvage to finish; if you are sure no salvage is running,\n");
+ Log(" run a salvage manually.\n");
+
+ /* make sure neither VScheduleSalvage_r nor
+ * VUpdateSalvagePriority_r try to schedule another salvage */
+ vp->salvage.requested = vp->salvage.scheduled = 0;
+
+ /* these stats aren't correct, but doing this makes them
+ * slightly closer to being correct */
+ vp->stats.salvages++;
+ vp->stats.last_salvage_req = FT_ApproxTime();
+ IncUInt64(&VStats.salvages);
+
+ VChangeState_r(vp, VOL_STATE_ERROR);
+ *ec = VSALVAGE;
+ code = 1;
+
+ } else if (vp->stats.salvages < SALVAGE_COUNT_MAX) {
+ VChangeState_r(vp, VOL_STATE_SALVAGING);
+ *ec = VSALVAGING;
+ } else {
+ Log("VRequestSalvage: volume %u online salvaged too many times; forced offline.\n", vp->hashid);
+ VChangeState_r(vp, VOL_STATE_ERROR);
+ *ec = VSALVAGE;
+ code = 1;
+ }
if (flags & VOL_SALVAGE_INVALIDATE_HEADER) {
/* Instead of ReleaseVolumeHeader, we do FreeVolumeHeader()
so that the the next VAttachVolumeByVp_r() invocation
*/
FreeVolumeHeader(vp);
}
- if (vp->stats.salvages < SALVAGE_COUNT_MAX) {
- VChangeState_r(vp, VOL_STATE_SALVAGING);
- *ec = VSALVAGING;
- } else {
- Log("VRequestSalvage: volume %u online salvaged too many times; forced offline.\n", vp->hashid);
- VChangeState_r(vp, VOL_STATE_ERROR);
- *ec = VSALVAGE;
- code = 1;
- }
}
return code;
}
static int
VUpdateSalvagePriority_r(Volume * vp)
{
- int code, ret=0;
- afs_uint32 now;
+ int ret=0;
#ifdef SALVSYNC_BUILD_CLIENT
+ afs_uint32 now;
+ int code;
+
vp->salvage.prio++;
now = FT_ApproxTime();
}
+#ifdef SALVSYNC_BUILD_CLIENT
/**
* schedule a salvage with the salvage server.
*
static int
VScheduleSalvage_r(Volume * vp)
{
- int code, ret=0;
-#ifdef SALVSYNC_BUILD_CLIENT
+ int ret=0;
+ int code;
VolState state_save;
VThreadOptions_t * thread_opts;
char partName[16];
if (thread_opts == NULL) {
thread_opts = &VThread_defaults;
}
- if (thread_opts->disallow_salvsync) {
+ if (thread_opts->disallow_salvsync || vol_disallow_salvsync) {
return 1;
}
}
}
}
-#endif /* SALVSYNC_BUILD_CLIENT */
- return ret;
-}
-
-/**
- * ask salvageserver to cancel a scheduled salvage operation.
- *
- * @param[in] vp pointer to volume object
- * @param[in] reason SALVSYNC protocol reason code
- *
- * @return operation status
- * @retval 0 success
- * @retval 1 request failed
- *
- * @pre VOL_LOCK is held.
- *
- * @post salvageserver is sent a request to cancel the volume salvage.
- * volume is transitioned to a hard error state.
- *
- * @internal volume package internal use only.
- */
-static int
-VCancelSalvage_r(Volume * vp, int reason)
-{
- int code, ret = 0;
-
-#ifdef SALVSYNC_BUILD_CLIENT
- if (vp->salvage.scheduled) {
- VChangeState_r(vp, VOL_STATE_SALVSYNC_REQ);
- VOL_UNLOCK;
-
- /* can't use V_id() since there's no guarantee
- * we have the disk data header at this point */
- code = SALVSYNC_SalvageVolume(vp->hashid,
- VPartitionPath(vp->partition),
- SALVSYNC_CANCEL,
- reason,
- 0,
- NULL);
-
- VOL_LOCK;
- VChangeState_r(vp, VOL_STATE_ERROR);
-
- if (code == SYNC_OK) {
- vp->salvage.scheduled = 0;
- vp->salvage.requested = 0;
- } else {
- ret = 1;
- }
- }
-#endif /* SALVSYNC_BUILD_CLIENT */
return ret;
}
-
-#ifdef SALVSYNC_BUILD_CLIENT
/**
* connect to the salvageserver SYNC service.
*
int
VDisconnectSALV(void)
{
- int retVal;
VOL_LOCK;
VDisconnectSALV_r();
VOL_UNLOCK;
- return retVal;
+ return 0;
}
/**
*ec = 0;
name[0] = '/';
- (void)afs_snprintf(&name[1], (sizeof name) - 1, VFORMAT, volumeId);
+ (void)afs_snprintf(&name[1], (sizeof name) - 1, VFORMAT, afs_printable_uint32_lu(volumeId));
for (dp = DiskPartitionList; dp; dp = dp->next) {
struct afs_stat status;
strcpy(path, VPartitionPath(dp));
VolumeExternalName(VolumeId volumeId)
{
static char name[VMAXPATHLEN];
- (void)afs_snprintf(name, sizeof name, VFORMAT, volumeId);
+ (void)afs_snprintf(name, sizeof name, VFORMAT, afs_printable_uint32_lu(volumeId));
return name;
}
*
* @internal volume package internal use only.
*/
+#ifdef AFS_DEMAND_ATTACH_FS
static int
VolumeExternalName_r(VolumeId volumeId, char * name, size_t len)
{
- return afs_snprintf(name, len, VFORMAT, volumeId);
+ return afs_snprintf(name, len, VFORMAT, afs_printable_uint32_lu(volumeId));
}
+#endif
/***************************************************/
* All we need to do is bzero the entire VOL_STATS_BYTES of
* the detailed volume statistics area.
*/
- memset((char *)(V_stat_area(vp)), 0, VOL_STATS_BYTES);
+ memset((V_stat_area(vp)), 0, VOL_STATS_BYTES);
#endif /* OPENAFS_VOL_STATS */
}
VBumpVolumeUsage_r(register Volume * vp)
{
unsigned int now = FT_ApproxTime();
+ V_accessDate(vp) = now;
if (now - V_dayUseDate(vp) > OneDay)
VAdjustVolumeStatistics_r(vp);
/*
* @internal volume package interal use only.
*/
static void
-VLRU_Init_Node_r(volatile Volume * vp)
+VLRU_Init_Node_r(Volume * vp)
{
if (!VLRU_enabled)
return;
* @internal volume package internal use only.
*/
static void
-VLRU_Add_r(volatile Volume * vp)
+VLRU_Add_r(Volume * vp)
{
int idx;
VolState state_save;
* @internal volume package internal use only.
*/
static void
-VLRU_Delete_r(volatile Volume * vp)
+VLRU_Delete_r(Volume * vp)
{
int idx;
* @internal volume package internal use only.
*/
static void
-VLRU_UpdateAccess_r(volatile Volume * vp)
+VLRU_UpdateAccess_r(Volume * vp)
{
- afs_uint32 live_interval;
Volume * rvp = NULL;
if (!VLRU_enabled)
* @internal volume package internal use only.
*/
static void
-VLRU_SwitchQueues(volatile Volume * vp, int new_idx, int append)
+VLRU_SwitchQueues(Volume * vp, int new_idx, int append)
{
if (queue_IsNotOnQueue(&vp->vlru))
return;
VLRU_ScannerThread(void * args)
{
afs_uint32 now, min_delay, delay;
- afs_uint32 next_scan[VLRU_GENERATIONS];
- afs_uint32 next_promotion[VLRU_GENERATIONS];
int i, min_idx, min_op, overdue, state;
/* set t=0 for promotion cycle to be
int len, chaining, promote;
afs_uint32 now, thresh;
struct rx_queue *qp, *nqp;
- Volume * vp, *start, *end;
+ Volume * vp, *start = NULL, *end = NULL;
/* get exclusive access to two chains, and drop the glock */
VLRU_Wait_r(&volume_LRU.q[idx]);
int len, chaining, demote;
afs_uint32 now, thresh;
struct rx_queue *qp, *nqp;
- Volume * vp, *start, *end;
+ Volume * vp, *start = NULL, *end = NULL;
Volume ** salv_flag_vec = NULL;
int salv_vec_offset = 0;
{
afs_uint32 now, thresh;
struct rx_queue *qp, *nqp;
- volatile Volume * vp;
+ Volume * vp;
int i, locked = 1;
assert(idx == VLRU_QUEUE_NEW || idx == VLRU_QUEUE_CANDIDATE);
/* check whether volume is safe to soft detach
* caller MUST NOT hold a ref count on vp */
static int
-VCheckSoftDetach(volatile Volume * vp, afs_uint32 thresh)
+VCheckSoftDetach(Volume * vp, afs_uint32 thresh)
{
int ret=0;
/* check whether volume should be made a
* soft detach candidate */
static int
-VCheckSoftDetachCandidate(volatile Volume * vp, afs_uint32 thresh)
+VCheckSoftDetachCandidate(Volume * vp, afs_uint32 thresh)
{
int idx, ret = 0;
if (vp->nUsers || vp->nWaiters)
*
* caller MUST NOT hold a ref count on vp */
static int
-VSoftDetachVolume_r(volatile Volume * vp, afs_uint32 thresh)
+VSoftDetachVolume_r(Volume * vp, afs_uint32 thresh)
{
afs_uint32 ts_save;
int ret = 0;
V_attachFlags(vp) &= ~(VOL_ON_VLRU);
VCancelReservation_r(vp);
return 0;
+ default:
+ break;
}
/* hold the volume and take it offline.
static int everLogged = 0;
#ifdef AFS_DEMAND_ATTACH_FS
- VolState vp_save, back_save;
+ VolState vp_save = 0, back_save = 0;
/* XXX debug 9/19/05 we've apparently got
* a ref counting bug somewhere that's
VLookupVolume_r(Error * ec, VolId volumeId, Volume * hint)
{
register int looks = 0;
- Volume * vp, *np, *pp;
+ Volume * vp, *np;
+#ifdef AFS_DEMAND_ATTACH_FS
+ Volume *pp;
+#endif
VolumeHashChainHead * head;
*ec = 0;
void
VPrintExtendedCacheStats_r(int flags)
{
- int i, j;
+ int i;
afs_uint32 vol_sum = 0;
struct stats {
double min;