X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Fafs%2Fafs_chunkops.h;h=3babf8979b57170b893c314e8585b64a0f64f624;hp=1a4d38b34acceb83e8c320d3efc9f5bab353709d;hb=20b0c65a289e2b55fb6922c8f60e873f1f4c6f97;hpb=fb5eccb2fe30b04497e3e12efab6080ef03d896d diff --git a/src/afs/afs_chunkops.h b/src/afs/afs_chunkops.h index 1a4d38b..3babf89 100644 --- a/src/afs/afs_chunkops.h +++ b/src/afs/afs_chunkops.h @@ -60,7 +60,7 @@ struct afs_cacheOps { int (*close) (struct osi_file * fp); 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 needvalid); + struct dcache *(*GetDSlot) (afs_int32 aslot, int indexvalid, int datavalid); struct volume *(*GetVolSlot) (void); int (*HandleLink) (struct vcache * avc, struct vrequest * areq); }; @@ -71,11 +71,20 @@ struct afs_cacheOps { #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_GetValidDSlot(slot) (*(afs_cacheType->GetDSlot))(slot, 1) -#define afs_GetNewDSlot(slot) (*(afs_cacheType->GetDSlot))(slot, 0) #define afs_GetVolSlot() (*(afs_cacheType->GetVolSlot))() #define afs_HandleLink(avc, areq) (*(afs_cacheType->HandleLink))(avc, areq) +/* Use afs_GetValidDSlot to get a dcache from a dcache slot number when we + * know the dcache contains data we want (e.g. it's on the hash table) */ +#define afs_GetValidDSlot(slot) (*(afs_cacheType->GetDSlot))(slot, 1, 1) +/* Use afs_GetUnusedDSlot when loading a dcache entry that is on the free or + * discard lists (the dcache does not contain valid data, but we know the + * dcache entry itself exists). */ +#define afs_GetUnusedDSlot(slot) (*(afs_cacheType->GetDSlot))(slot, 1, 0) +/* Use afs_GetNewDSlot only when initializing dcache slots (the given slot + * number may not exist at all). */ +#define afs_GetNewDSlot(slot) (*(afs_cacheType->GetDSlot))(slot, 0, 0) + /* These memcpys should get optimised to simple assignments when afs_dcache_id_t * is simple */ static_inline void afs_copy_inode(afs_dcache_id_t *dst, afs_dcache_id_t *src) {