Lines Matching refs:cmap
5403 static kern_return_t vfs_drt_free_map(struct vfs_drt_clustermap *cmap);
5404 static kern_return_t vfs_drt_search_index(struct vfs_drt_clustermap *cmap,
5417 struct vfs_drt_clustermap *cmap,
5436 struct vfs_drt_clustermap *cmap, *ocmap;
5488 kret = kmem_alloc(kernel_map, (vm_offset_t *)&cmap,
5492 cmap->scm_magic = DRT_SCM_MAGIC;
5493 cmap->scm_modulus = nsize;
5494 cmap->scm_buckets = 0;
5495 cmap->scm_lastclean = 0;
5496 cmap->scm_iskips = 0;
5497 for (i = 0; i < cmap->scm_modulus; i++) {
5498 DRT_HASH_CLEAR(cmap, i);
5499 DRT_HASH_VACATE(cmap, i);
5500 DRT_BITVECTOR_CLEAR(cmap, i);
5515 kret = vfs_drt_get_index(&cmap, offset, &index, 1);
5522 DRT_HASH_COPY(ocmap, i, cmap, index);
5528 vfs_drt_trace(cmap, DRT_DEBUG_ALLOC, copycount, 0, 0, 0);
5535 *cmapp = cmap;
5554 vfs_drt_free_map(struct vfs_drt_clustermap *cmap)
5556 kmem_free(kernel_map, (vm_offset_t)cmap,
5557 (cmap->scm_modulus == DRT_HASH_SMALL_MODULUS) ? DRT_SMALL_ALLOCATION : DRT_LARGE_ALLOCATION);
5566 vfs_drt_search_index(struct vfs_drt_clustermap *cmap, u_int64_t offset, int *indexp)
5572 index = DRT_HASH(cmap, offset);
5575 for (i = 0; i < cmap->scm_modulus; i++) {
5580 if (DRT_HASH_VACANT(cmap, index))
5586 if (DRT_HASH_GET_ADDRESS(cmap, index) == offset) {
5594 index = DRT_HASH_NEXT(cmap, index);
5611 struct vfs_drt_clustermap *cmap;
5616 cmap = *cmapp;
5619 kret = vfs_drt_search_index(cmap, offset, indexp);
5625 index = DRT_HASH(cmap, offset);
5628 for (i = 0; i < cmap->scm_modulus; i++) {
5630 if (DRT_HASH_VACANT(cmap, index) || DRT_HASH_GET_COUNT(cmap,index) == 0) {
5631 cmap->scm_buckets++;
5632 if (index < cmap->scm_lastclean)
5633 cmap->scm_lastclean = index;
5634 DRT_HASH_SET_ADDRESS(cmap, index, offset);
5635 DRT_HASH_SET_COUNT(cmap, index, 0);
5636 DRT_BITVECTOR_CLEAR(cmap, index);
5638 vfs_drt_trace(cmap, DRT_DEBUG_INSERT, (int)offset, i, 0, 0);
5641 cmap->scm_iskips += i;
5642 index = DRT_HASH_NEXT(cmap, index);
5672 struct vfs_drt_clustermap *cmap, **cmapp;
5677 cmap = *cmapp;
5679 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_START, (int)offset, (int)length, dirty, 0);
5685 if (cmap == NULL) {
5688 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 1, 0, 0, 0);
5693 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 2, 0, 0, 0);
5710 cmap = *cmapp; /* may have changed! */
5715 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 3, (int)length, 0, 0);
5730 ecount = DRT_HASH_GET_COUNT(cmap, index);
5733 if (!DRT_HASH_TEST_BIT(cmap, index, pgoff + i)) {
5734 DRT_HASH_SET_BIT(cmap, index, pgoff + i);
5739 if (DRT_HASH_TEST_BIT(cmap, index, pgoff + i)) {
5740 DRT_HASH_CLEAR_BIT(cmap, index, pgoff + i);
5746 DRT_HASH_SET_COUNT(cmap, index, ecount);
5754 vfs_drt_trace(cmap, DRT_DEBUG_MARK | DBG_FUNC_END, 0, setcount, 0, 0);
5821 struct vfs_drt_clustermap *cmap;
5830 cmap = *cmapp;
5833 for (offset = 0, j = 0; j < cmap->scm_modulus; offset += (DRT_BITVECTOR_PAGES * PAGE_SIZE), j++) {
5834 index = DRT_HASH(cmap, offset);
5836 if (DRT_HASH_VACANT(cmap, index) || (DRT_HASH_GET_COUNT(cmap, index) == 0))
5843 if (DRT_HASH_TEST_BIT(cmap, index, i)) {
5853 if (!DRT_HASH_TEST_BIT(cmap, index, i))
5858 offset = DRT_HASH_GET_ADDRESS(cmap, index) + (PAGE_SIZE * fs);
5861 cmap->scm_lastclean = index;
5867 vfs_drt_trace(cmap, DRT_DEBUG_RETCLUSTER, (int)offset, (int)length, 0, 0);
5875 vfs_drt_trace(cmap, DRT_DEBUG_SCMDATA,
5876 cmap->scm_modulus,
5877 cmap->scm_buckets,
5878 cmap->scm_lastclean,
5879 cmap->scm_iskips);
5881 vfs_drt_free_map(cmap);
5891 struct vfs_drt_clustermap *cmap;
5896 cmap = *cmapp;
5901 vfs_drt_trace(cmap, DRT_DEBUG_SCMDATA,
5902 cmap->scm_modulus,
5903 cmap->scm_buckets,
5904 cmap->scm_lastclean,
5905 cmap->scm_iskips);
5907 vfs_drt_free_map(cmap);
5912 cmap->scm_lastclean = 0;
5926 vfs_drt_trace(__unused struct vfs_drt_clustermap *cmap, int code, int arg1, int arg2, int arg3, int arg4)
5932 vfs_drt_trace(__unused struct vfs_drt_clustermap *cmap, __unused int code,
5945 vfs_drt_sanity(struct vfs_drt_clustermap *cmap)
5950 for (index = 0; index < cmap->scm_modulus; index++) {
5951 if (DRT_HASH_VACANT(cmap, index))
5955 if (DRT_HASH_TEST_BIT(cmap, index, i))
5958 if (bits_on != DRT_HASH_GET_COUNT(cmap, index))