Lines Matching refs:cmap

6030 static kern_return_t	vfs_drt_free_map(struct vfs_drt_clustermap *cmap);
6031 static kern_return_t vfs_drt_search_index(struct vfs_drt_clustermap *cmap,
6044 struct vfs_drt_clustermap *cmap,
6063 struct vfs_drt_clustermap *cmap, *ocmap;
6119 kret = kmem_alloc(kernel_map, (vm_offset_t *)&cmap,
6123 cmap->scm_magic = DRT_SCM_MAGIC;
6124 cmap->scm_modulus = nsize;
6125 cmap->scm_buckets = 0;
6126 cmap->scm_lastclean = 0;
6127 cmap->scm_iskips = 0;
6128 for (i = 0; i < cmap->scm_modulus; i++) {
6129 DRT_HASH_CLEAR(cmap, i);
6130 DRT_HASH_VACATE(cmap, i);
6131 DRT_BITVECTOR_CLEAR(cmap, i);
6146 kret = vfs_drt_get_index(&cmap, offset, &index, 1);
6153 DRT_HASH_COPY(ocmap, i, cmap, index);
6159 vfs_drt_trace(cmap, DRT_DEBUG_ALLOC, copycount, 0, 0, 0);
6166 *cmapp = cmap;
6185 vfs_drt_free_map(struct vfs_drt_clustermap *cmap)
6187 kmem_free(kernel_map, (vm_offset_t)cmap,
6188 (cmap->scm_modulus == DRT_HASH_SMALL_MODULUS) ? DRT_SMALL_ALLOCATION : DRT_LARGE_ALLOCATION);
6197 vfs_drt_search_index(struct vfs_drt_clustermap *cmap, u_int64_t offset, int *indexp)
6203 index = DRT_HASH(cmap, offset);
6206 for (i = 0; i < cmap->scm_modulus; i++) {
6211 if (DRT_HASH_VACANT(cmap, index))
6217 if (DRT_HASH_GET_ADDRESS(cmap, index) == offset) {
6225 index = DRT_HASH_NEXT(cmap, index);
6242 struct vfs_drt_clustermap *cmap;
6247 cmap = *cmapp;
6250 kret = vfs_drt_search_index(cmap, offset, indexp);
6256 index = DRT_HASH(cmap, offset);
6259 for (i = 0; i < cmap->scm_modulus; i++) {
6261 if (DRT_HASH_VACANT(cmap, index) || DRT_HASH_GET_COUNT(cmap,index) == 0) {
6262 cmap->scm_buckets++;
6263 if (index < cmap->scm_lastclean)
6264 cmap->scm_lastclean = index;
6265 DRT_HASH_SET_ADDRESS(cmap, index, offset);
6266 DRT_HASH_SET_COUNT(cmap, index, 0);
6267 DRT_BITVECTOR_CLEAR(cmap, index);
6269 vfs_drt_trace(cmap, DRT_DEBUG_INSERT, (int)offset, i, 0, 0);
6272 cmap->scm_iskips += i;
6273 index = DRT_HASH_NEXT(cmap, index);
6303 struct vfs_drt_clustermap *cmap, **cmapp;
6308 cmap = *cmapp;
6310 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_START, (int)offset, (int)length, dirty, 0);
6316 if (cmap == NULL) {
6319 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 1, 0, 0, 0);
6324 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 2, 0, 0, 0);
6341 cmap = *cmapp; /* may have changed! */
6346 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 3, (int)length, 0, 0);
6361 ecount = DRT_HASH_GET_COUNT(cmap, index);
6364 if (!DRT_HASH_TEST_BIT(cmap, index, pgoff + i)) {
6365 DRT_HASH_SET_BIT(cmap, index, pgoff + i);
6370 if (DRT_HASH_TEST_BIT(cmap, index, pgoff + i)) {
6371 DRT_HASH_CLEAR_BIT(cmap, index, pgoff + i);
6377 DRT_HASH_SET_COUNT(cmap, index, ecount);
6385 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 0, setcount, 0, 0);
6452 struct vfs_drt_clustermap *cmap;
6461 cmap = *cmapp;
6464 for (offset = 0, j = 0; j < cmap->scm_modulus; offset += (DRT_BITVECTOR_PAGES * PAGE_SIZE), j++) {
6465 index = DRT_HASH(cmap, offset);
6467 if (DRT_HASH_VACANT(cmap, index) || (DRT_HASH_GET_COUNT(cmap, index) == 0))
6474 if (DRT_HASH_TEST_BIT(cmap, index, i)) {
6484 if (!DRT_HASH_TEST_BIT(cmap, index, i))
6489 offset = DRT_HASH_GET_ADDRESS(cmap, index) + (PAGE_SIZE * fs);
6492 cmap->scm_lastclean = index;
6498 vfs_drt_trace(cmap, DRT_DEBUG_RETCLUSTER, (int)offset, (int)length, 0, 0);
6506 vfs_drt_trace(cmap, DRT_DEBUG_SCMDATA,
6507 cmap->scm_modulus,
6508 cmap->scm_buckets,
6509 cmap->scm_lastclean,
6510 cmap->scm_iskips);
6512 vfs_drt_free_map(cmap);
6522 struct vfs_drt_clustermap *cmap;
6527 cmap = *cmapp;
6532 vfs_drt_trace(cmap, DRT_DEBUG_SCMDATA,
6533 cmap->scm_modulus,
6534 cmap->scm_buckets,
6535 cmap->scm_lastclean,
6536 cmap->scm_iskips);
6538 vfs_drt_free_map(cmap);
6543 cmap->scm_lastclean = 0;
6557 vfs_drt_trace(__unused struct vfs_drt_clustermap *cmap, int code, int arg1, int arg2, int arg3, int arg4)
6563 vfs_drt_trace(__unused struct vfs_drt_clustermap *cmap, __unused int code,
6576 vfs_drt_sanity(struct vfs_drt_clustermap *cmap)
6581 for (index = 0; index < cmap->scm_modulus; index++) {
6582 if (DRT_HASH_VACANT(cmap, index))
6586 if (DRT_HASH_TEST_BIT(cmap, index, i))
6589 if (bits_on != DRT_HASH_GET_COUNT(cmap, index))