-/* vlocation.c: volume location management
+/* volume location management
*
* Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
};
#endif
-/*****************************************************************************/
/*
* iterate through the VL servers in a cell until one of them admits knowing
* about the volume in question
cell->vl_curr_svix %= cell->vl_naddrs;
}
- out:
+out:
_leave(" = %d", ret);
return ret;
+}
-} /* end afs_vlocation_access_vl_by_name() */
-
-/*****************************************************************************/
/*
* iterate through the VL servers in a cell until one of them admits knowing
* about the volume in question
cell->vl_curr_svix %= cell->vl_naddrs;
}
- out:
+out:
_leave(" = %d", ret);
return ret;
+}
-} /* end afs_vlocation_access_vl_by_id() */
-
-/*****************************************************************************/
/*
* lookup volume location
* - caller must have cell->vol_sem write-locked
goto found_on_vlserver;
- found_in_graveyard:
+found_in_graveyard:
/* found in the graveyard - resurrect */
_debug("found in graveyard");
atomic_inc(&vlocation->usage);
afs_kafstimod_del_timer(&vlocation->timeout);
goto active;
- found_in_memory:
+found_in_memory:
/* found in memory - check to see if it's active */
_debug("found in memory");
atomic_inc(&vlocation->usage);
- active:
+active:
active = 1;
#ifdef AFS_CACHING_SUPPORT
- found_in_cache:
+found_in_cache:
#endif
/* try to look up a cached volume in the cell VL databases by ID */
_debug("found in cache");
if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) {
vid = vlocation->vldb.vid[0];
voltype = AFSVL_RWVOL;
- }
- else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
+ } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
vid = vlocation->vldb.vid[1];
voltype = AFSVL_ROVOL;
- }
- else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
+ } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
vid = vlocation->vldb.vid[2];
voltype = AFSVL_BACKVOL;
- }
- else {
+ } else {
BUG();
vid = 0;
voltype = 0;
goto error;
}
- found_on_vlserver:
+found_on_vlserver:
_debug("Done VL Lookup: %*.*s %02x { %08x(%x) %08x(%x) %08x(%x) }",
namesz, namesz, name,
vldb.vidmask,
_leave(" = 0 (%p)",vlocation);
return 0;
- error:
+error:
if (vlocation) {
if (active) {
__afs_put_vlocation(vlocation);
- }
- else {
+ } else {
list_del(&vlocation->link);
#ifdef AFS_CACHING_SUPPORT
cachefs_relinquish_cookie(vlocation->cache, 0);
_leave(" = %d", ret);
return ret;
-} /* end afs_vlocation_lookup() */
+}
-/*****************************************************************************/
/*
* finish using a volume location record
* - caller must have cell->vol_sem write-locked
spin_unlock(&cell->vl_gylock);
_leave(" [killed]");
-} /* end __afs_put_vlocation() */
+}
-/*****************************************************************************/
/*
* finish using a volume location record
*/
__afs_put_vlocation(vlocation);
up_write(&cell->vl_sem);
}
-} /* end afs_put_vlocation() */
+}
-/*****************************************************************************/
/*
* timeout vlocation record
* - removes from the cell's graveyard if the usage count is zero
kfree(vlocation);
_leave(" [destroyed]");
-} /* end afs_vlocation_do_timeout() */
+}
-/*****************************************************************************/
/*
* send an update operation to the currently selected server
*/
if (vlocation->vldb.vidmask & AFS_VOL_VTM_RW) {
vid = vlocation->vldb.vid[0];
voltype = AFSVL_RWVOL;
- }
- else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
+ } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_RO) {
vid = vlocation->vldb.vid[1];
voltype = AFSVL_ROVOL;
- }
- else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
+ } else if (vlocation->vldb.vidmask & AFS_VOL_VTM_BAK) {
vid = vlocation->vldb.vid[2];
voltype = AFSVL_BACKVOL;
- }
- else {
+ } else {
BUG();
vid = 0;
voltype = 0;
_leave(" = %d", ret);
return ret;
-} /* end afs_vlocation_update_begin() */
+}
-/*****************************************************************************/
/*
* abandon updating a VL record
* - does not restart the update timer
spin_unlock(&afs_vlocation_update_lock);
_leave("");
-} /* end afs_vlocation_update_abandon() */
+}
-/*****************************************************************************/
/*
* handle periodic update timeouts and busy retry timeouts
* - called from kafstimod
if (afs_vlocation_update) {
list_add(&vlocation->upd_op.link,
&afs_vlocation_update_pendq);
- }
- else {
+ } else {
afs_get_vlocation(vlocation);
afs_vlocation_update = vlocation;
vlocation->upd_state = AFS_VLUPD_INPROGRESS;
_leave("");
return;
- out_unlock2:
+out_unlock2:
spin_unlock(&afs_vlocation_update_lock);
- out_unlock1:
+out_unlock1:
spin_unlock(&vlocation->cell->vl_gylock);
_leave("");
- return;
-
-} /* end afs_vlocation_update_timer() */
+}
-/*****************************************************************************/
/*
* attend to an update operation upon which an event happened
* - called in kafsasyncd context
}
/* try contacting the next server */
- try_next:
+try_next:
vlocation->upd_busy_cnt = 0;
/* discard the server record */
}
/* abandon the update */
- abandon:
+abandon:
afs_vlocation_update_abandon(vlocation, AFS_VLUPD_SLEEP, ret);
afs_kafstimod_add_timer(&vlocation->upd_timer, HZ * 10);
afs_put_vlocation(vlocation);
_leave(" [abandoned]");
+}
-} /* end afs_vlocation_update_attend() */
-
-/*****************************************************************************/
/*
* deal with an update operation being discarded
* - called in kafsasyncd context when it's dying due to rmmod
afs_put_vlocation(vlocation);
_leave("");
-} /* end afs_vlocation_update_discard() */
+}
-/*****************************************************************************/
/*
* match a VLDB record stored in the cache
* - may also load target from entry
vlocation->valid = 1;
_leave(" = SUCCESS [c->m]");
return CACHEFS_MATCH_SUCCESS;
- }
- /* need to update cache if cached info differs */
- else if (memcmp(&vlocation->vldb, vldb, sizeof(*vldb)) != 0) {
+ } else if (memcmp(&vlocation->vldb, vldb, sizeof(*vldb)) != 0) {
/* delete if VIDs for this name differ */
if (memcmp(&vlocation->vldb.vid,
&vldb->vid,
_leave(" = UPDATE");
return CACHEFS_MATCH_SUCCESS_UPDATE;
- }
- else {
+ } else {
_leave(" = SUCCESS");
return CACHEFS_MATCH_SUCCESS;
}
_leave(" = FAILED");
return CACHEFS_MATCH_FAILED;
-} /* end afs_vlocation_cache_match() */
+}
#endif
-/*****************************************************************************/
/*
* update a VLDB record stored in the cache
*/
_enter("");
*vldb = vlocation->vldb;
-
-} /* end afs_vlocation_cache_update() */
+}
#endif