Lines Matching defs:cmap

6003 static kern_return_t	vfs_drt_free_map(struct vfs_drt_clustermap *cmap);
6004 static kern_return_t vfs_drt_search_index(struct vfs_drt_clustermap *cmap,
6017 struct vfs_drt_clustermap *cmap,
6036 struct vfs_drt_clustermap *cmap, *ocmap;
6092 kret = kmem_alloc(kernel_map, (vm_offset_t *)&cmap,
6096 cmap->scm_magic = DRT_SCM_MAGIC;
6097 cmap->scm_modulus = nsize;
6098 cmap->scm_buckets = 0;
6099 cmap->scm_lastclean = 0;
6100 cmap->scm_iskips = 0;
6101 for (i = 0; i < cmap->scm_modulus; i++) {
6102 DRT_HASH_CLEAR(cmap, i);
6103 DRT_HASH_VACATE(cmap, i);
6104 DRT_BITVECTOR_CLEAR(cmap, i);
6119 kret = vfs_drt_get_index(&cmap, offset, &index, 1);
6126 DRT_HASH_COPY(ocmap, i, cmap, index);
6132 vfs_drt_trace(cmap, DRT_DEBUG_ALLOC, copycount, 0, 0, 0);
6139 *cmapp = cmap;
6158 vfs_drt_free_map(struct vfs_drt_clustermap *cmap)
6160 kmem_free(kernel_map, (vm_offset_t)cmap,
6161 (cmap->scm_modulus == DRT_HASH_SMALL_MODULUS) ? DRT_SMALL_ALLOCATION : DRT_LARGE_ALLOCATION);
6170 vfs_drt_search_index(struct vfs_drt_clustermap *cmap, u_int64_t offset, int *indexp)
6176 index = DRT_HASH(cmap, offset);
6179 for (i = 0; i < cmap->scm_modulus; i++) {
6184 if (DRT_HASH_VACANT(cmap, index))
6190 if (DRT_HASH_GET_ADDRESS(cmap, index) == offset) {
6198 index = DRT_HASH_NEXT(cmap, index);
6215 struct vfs_drt_clustermap *cmap;
6220 cmap = *cmapp;
6223 kret = vfs_drt_search_index(cmap, offset, indexp);
6229 index = DRT_HASH(cmap, offset);
6232 for (i = 0; i < cmap->scm_modulus; i++) {
6234 if (DRT_HASH_VACANT(cmap, index) || DRT_HASH_GET_COUNT(cmap,index) == 0) {
6235 cmap->scm_buckets++;
6236 if (index < cmap->scm_lastclean)
6237 cmap->scm_lastclean = index;
6238 DRT_HASH_SET_ADDRESS(cmap, index, offset);
6239 DRT_HASH_SET_COUNT(cmap, index, 0);
6240 DRT_BITVECTOR_CLEAR(cmap, index);
6242 vfs_drt_trace(cmap, DRT_DEBUG_INSERT, (int)offset, i, 0, 0);
6245 cmap->scm_iskips += i;
6246 index = DRT_HASH_NEXT(cmap, index);
6276 struct vfs_drt_clustermap *cmap, **cmapp;
6281 cmap = *cmapp;
6283 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_START, (int)offset, (int)length, dirty, 0);
6289 if (cmap == NULL) {
6292 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 1, 0, 0, 0);
6297 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 2, 0, 0, 0);
6314 cmap = *cmapp; /* may have changed! */
6319 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 3, (int)length, 0, 0);
6334 ecount = DRT_HASH_GET_COUNT(cmap, index);
6337 if (!DRT_HASH_TEST_BIT(cmap, index, pgoff + i)) {
6338 DRT_HASH_SET_BIT(cmap, index, pgoff + i);
6343 if (DRT_HASH_TEST_BIT(cmap, index, pgoff + i)) {
6344 DRT_HASH_CLEAR_BIT(cmap, index, pgoff + i);
6350 DRT_HASH_SET_COUNT(cmap, index, ecount);
6358 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 0, setcount, 0, 0);
6425 struct vfs_drt_clustermap *cmap;
6434 cmap = *cmapp;
6437 for (offset = 0, j = 0; j < cmap->scm_modulus; offset += (DRT_BITVECTOR_PAGES * PAGE_SIZE), j++) {
6438 index = DRT_HASH(cmap, offset);
6440 if (DRT_HASH_VACANT(cmap, index) || (DRT_HASH_GET_COUNT(cmap, index) == 0))
6447 if (DRT_HASH_TEST_BIT(cmap, index, i)) {
6457 if (!DRT_HASH_TEST_BIT(cmap, index, i))
6462 offset = DRT_HASH_GET_ADDRESS(cmap, index) + (PAGE_SIZE * fs);
6465 cmap->scm_lastclean = index;
6471 vfs_drt_trace(cmap, DRT_DEBUG_RETCLUSTER, (int)offset, (int)length, 0, 0);
6479 vfs_drt_trace(cmap, DRT_DEBUG_SCMDATA,
6480 cmap->scm_modulus,
6481 cmap->scm_buckets,
6482 cmap->scm_lastclean,
6483 cmap->scm_iskips);
6485 vfs_drt_free_map(cmap);
6495 struct vfs_drt_clustermap *cmap;
6500 cmap = *cmapp;
6505 vfs_drt_trace(cmap, DRT_DEBUG_SCMDATA,
6506 cmap->scm_modulus,
6507 cmap->scm_buckets,
6508 cmap->scm_lastclean,
6509 cmap->scm_iskips);
6511 vfs_drt_free_map(cmap);
6516 cmap->scm_lastclean = 0;
6530 vfs_drt_trace(__unused struct vfs_drt_clustermap *cmap, int code, int arg1, int arg2, int arg3, int arg4)
6536 vfs_drt_trace(__unused struct vfs_drt_clustermap *cmap, __unused int code,
6549 vfs_drt_sanity(struct vfs_drt_clustermap *cmap)
6554 for (index = 0; index < cmap->scm_modulus; index++) {
6555 if (DRT_HASH_VACANT(cmap, index))
6559 if (DRT_HASH_TEST_BIT(cmap, index, i))
6562 if (bits_on != DRT_HASH_GET_COUNT(cmap, index))