int (*vreadUIO) (afs_dcache_id_t *, struct uio *);
int (*vwriteUIO) (struct vcache *, afs_dcache_id_t *, struct uio *);
struct dcache *(*GetDSlot) (afs_int32 aslot, int indexvalid, int datavalid);
- struct volume *(*GetVolSlot) (void);
+ struct volume *(*GetVolSlot) (afs_int32 volid, struct cell *cell);
int (*HandleLink) (struct vcache * avc, struct vrequest * areq);
};
#define afs_CFileRead(file, offset, data, size) (*(afs_cacheType->fread))(file, offset, data, size)
#define afs_CFileWrite(file, offset, data, size) (*(afs_cacheType->fwrite))(file, offset, data, size)
#define afs_CFileClose(handle) (*(afs_cacheType->close))(handle)
-#define afs_GetVolSlot() (*(afs_cacheType->GetVolSlot))()
+#define afs_GetVolSlot(volid, cell) (*(afs_cacheType->GetVolSlot))((volid),(cell))
#define afs_HandleLink(avc, areq) (*(afs_cacheType->HandleLink))(avc, areq)
/* Use afs_GetValidDSlot to get a dcache from a dcache slot number when we
int acell, struct cell *tcell,
struct vrequest *areq);
extern void afs_ResetVolumeInfo(struct volume *tv);
-extern struct volume *afs_MemGetVolSlot(void);
+extern struct volume *afs_MemGetVolSlot(afs_int32 volid, struct cell *cell);
extern void afs_ResetVolumes(struct server *srvp, struct volume *tv);
extern struct volume *afs_GetVolume(struct VenusFid *afid,
struct vrequest *areq,
afs_int32 acell, int agood,
struct vrequest *areq,
afs_int32 locktype);
-extern struct volume *afs_UFSGetVolSlot(void);
+extern struct volume *afs_UFSGetVolSlot(afs_int32 volid, struct cell *cell);
extern void afs_CheckVolumeNames(int flags);
/* Prototypes for generated files that aren't really in src/afs/ */
* @return
*/
struct volume *
-afs_UFSGetVolSlot(void)
+afs_UFSGetVolSlot(afs_int32 volid, struct cell *tcell)
{
struct volume *tv = NULL, **lv;
struct osi_file *tfile;
struct volume *bestVp, *oldLp = NULL, **bestLp = NULL;
char *oldname = NULL;
afs_int32 oldvtix = -2; /* Initialize to a value that doesn't occur */
+ struct fvolume *tf = NULL;
+ int j = 0;
AFS_STATCNT(afs_UFSGetVolSlot);
if (!afs_freeVolList) {
tv = afs_freeVolList;
afs_freeVolList = tv->next;
}
+
+ /* read volume item data from disk for the gotten slot */
+ for (j = fvTable[FVHash(tcell->cellNum, volid)]; j != 0; j = tf->next) {
+ if (afs_FVIndex != j) {
+ tfile = osi_UFSOpen(&volumeInode);
+ code =
+ afs_osi_Read(tfile, sizeof(struct fvolume) * j,
+ &staticFVolume, sizeof(struct fvolume));
+ osi_UFSClose(tfile);
+ if (code != sizeof(struct fvolume)) {
+ afs_warn("afs_SetupVolume: error %d reading volumeinfo\n",
+ (int)code);
+ /* put tv back on the free list; the data in it is not valid */
+ tv->next = afs_freeVolList;
+ afs_freeVolList = tv;
+ /* staticFVolume contents are not valid */
+ afs_FVIndex = -1;
+ return NULL;
+ }
+ afs_FVIndex = j;
+ }
+ if (j != 0) { /* volume items record 0 is not used */
+ tf = &staticFVolume;
+ if (tf->cell == tcell->cellNum && tf->volume == volid) {
+ break;
+ }
+ }
+ }
+
+ afs_InitVolSlot(tv, tf, volid, tcell);
return tv;
error:
* @return
*/
struct volume *
-afs_MemGetVolSlot(void)
+afs_MemGetVolSlot(afs_int32 volid, struct cell *tcell)
{
struct volume *tv;
}
tv = afs_freeVolList;
afs_freeVolList = tv->next;
+
+ afs_InitVolSlot(tv, NULL, volid, tcell);
return tv;
} /*afs_MemGetVolSlot */
struct uvldbentry *uve = (struct uvldbentry *)ve;
int whichType; /* which type of volume to look for */
- int i, j, err = 0;
+ int i;
if (!volid) {
int len;
}
}
if (!tv) {
- struct fvolume *tf = 0;
-
- tv = afs_GetVolSlot();
+ tv = afs_GetVolSlot(volid, tcell);
if (!tv) {
ReleaseWriteLock(&afs_xvolume);
return NULL;
}
-
- for (j = fvTable[FVHash(tcell->cellNum, volid)]; j != 0; j = tf->next) {
- if (afs_FVIndex != j) {
- struct osi_file *tfile;
- tfile = osi_UFSOpen(&volumeInode);
- err =
- afs_osi_Read(tfile, sizeof(struct fvolume) * j,
- &staticFVolume, sizeof(struct fvolume));
- osi_UFSClose(tfile);
- if (err != sizeof(struct fvolume)) {
- afs_warn("afs_SetupVolume: error %d reading volumeinfo\n",
- (int)err);
- /* put tv back on the free list; the data in it is not valid */
- tv->next = afs_freeVolList;
- afs_freeVolList = tv;
- /* staticFVolume contents are not valid */
- afs_FVIndex = -1;
- ReleaseWriteLock(&afs_xvolume);
- return NULL;
- }
- afs_FVIndex = j;
- }
- if (j != 0) { /* volume items record 0 is not used */
- tf = &staticFVolume;
- if (tf->cell == tcell->cellNum && tf->volume == volid) {
- break;
- }
- }
- }
-
- afs_InitVolSlot(tv, tf, volid, tcell);
tv->next = afs_volumes[i]; /* thread into list */
afs_volumes[i] = tv;
}