Lines Matching defs:vol

55 	rw_lock_read_lock(&vol->vcache.lock)
58 rw_lock_write_lock(&vol->vcache.lock)
61 rw_lock_read_unlock(&vol->vcache.lock)
64 rw_lock_write_unlock(&vol->vcache.lock)
66 #define hash(v) ((v) & (vol->vcache.cache_size-1))
78 dump_vcache(nspace *vol)
84 vol->vcache.cache_size, vol->vcache.cur_vnid);
85 for (i = 0; i < vol->vcache.cache_size; i++) {
86 for (c = vol->vcache.by_vnid[i]; c ; c = c->next_vnid)
93 init_vcache(nspace *vol)
98 vol->vcache.cur_vnid = ARTIFICIAL_VNID_BITS;
100 vol->vcache.cache_size = 1;
102 vol->vcache.cache_size = 512; /* must be power of 2 */
105 vol->vcache.by_vnid = calloc(sizeof(struct vache_entry *),
106 vol->vcache.cache_size);
107 if (vol->vcache.by_vnid == NULL) {
112 vol->vcache.by_loc = calloc(sizeof(struct vache_entry *),
113 vol->vcache.cache_size);
114 if (vol->vcache.by_loc == NULL) {
116 free(vol->vcache.by_vnid);
117 vol->vcache.by_vnid = NULL;
121 sprintf(name, "fat cache %lx", vol->id);
122 rw_lock_init(&vol->vcache.lock, "fat cache");
125 vol->vcache.cache_size));
132 uninit_vcache(nspace *vol)
141 for (i = 0; i < vol->vcache.cache_size; i++) {
142 c = vol->vcache.by_vnid[i];
153 free(vol->vcache.by_vnid); vol->vcache.by_vnid = NULL;
154 free(vol->vcache.by_loc); vol->vcache.by_loc = NULL;
156 rw_lock_destroy(&vol->vcache.lock);
162 generate_unique_vnid(nspace *vol)
167 return vol->vcache.cur_vnid++;
172 _add_to_vcache_(nspace *vol, ino_t vnid, ino_t loc)
187 c = p = vol->vcache.by_vnid[hash1];
199 vol->vcache.by_vnid[hash1] = e;
203 c = p = vol->vcache.by_loc[hash2];
215 vol->vcache.by_loc[hash2] = e;
224 _remove_from_vcache_(nspace *vol, ino_t vnid)
231 c = p = vol->vcache.by_vnid[hash1];
243 vol->vcache.by_vnid[hash1] = c->next_vnid;
250 c = p = vol->vcache.by_loc[hash2];
262 vol->vcache.by_loc[hash2] = c->next_loc;
273 _find_vnid_in_vcache_(nspace *vol, ino_t vnid)
277 c = vol->vcache.by_vnid[hash1];
291 _find_loc_in_vcache_(nspace *vol, ino_t loc)
295 c = vol->vcache.by_loc[hash2];
309 add_to_vcache(nspace *vol, ino_t vnid, ino_t loc)
314 result = _add_to_vcache_(vol,vnid,loc);
324 _update_loc_in_vcache_(nspace *vol, ino_t vnid, ino_t loc)
328 result = _remove_from_vcache_(vol, vnid);
330 result = _add_to_vcache_(vol, vnid, loc);
337 remove_from_vcache(nspace *vol, ino_t vnid)
342 result = _remove_from_vcache_(vol, vnid);
351 vcache_vnid_to_loc(nspace *vol, ino_t vnid, ino_t *loc)
358 e = _find_vnid_in_vcache_(vol, vnid);
368 vcache_loc_to_vnid(nspace *vol, ino_t loc, ino_t *vnid)
375 e = _find_loc_in_vcache_(vol, loc);
385 vcache_set_entry(nspace *vol, ino_t vnid, ino_t loc)
392 /*if (is_vnode_removed(vol->id, vnid) > 0) {
396 ASSERT(is_vnode_removed(vol->id, vnid) == 0);
401 e = _find_vnid_in_vcache_(vol, vnid);
405 result = _remove_from_vcache_(vol, vnid);
407 result = _update_loc_in_vcache_(vol, vnid, loc);
410 result = _add_to_vcache_(vol,vnid,loc);
424 nspace *vol;
431 vol = (nspace *)strtoul(argv[1], NULL, 0);
432 if (vol == NULL)
438 if ((e = _find_vnid_in_vcache_(vol, vnid)) != NULL) {
453 nspace *vol;
460 vol = (nspace *)strtoul(argv[1], NULL, 0);
461 if (vol == NULL)
467 if ((e = _find_loc_in_vcache_(vol, loc)) != NULL) {