Lines Matching refs:rb
84 struct ocfs2_refcount_block *rb = in ocfs2_validate_refcount_block() local
96 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &rb->rf_check); in ocfs2_validate_refcount_block()
104 if (!OCFS2_IS_VALID_REFCOUNT_BLOCK(rb)) { in ocfs2_validate_refcount_block()
108 rb->rf_signature); in ocfs2_validate_refcount_block()
112 if (le64_to_cpu(rb->rf_blkno) != bh->b_blocknr) { in ocfs2_validate_refcount_block()
116 (unsigned long long)le64_to_cpu(rb->rf_blkno)); in ocfs2_validate_refcount_block()
120 if (le32_to_cpu(rb->rf_fs_generation) != OCFS2_SB(sb)->fs_generation) { in ocfs2_validate_refcount_block()
124 le32_to_cpu(rb->rf_fs_generation)); in ocfs2_validate_refcount_block()
458 struct ocfs2_refcount_block *rb; in ocfs2_lock_refcount_tree() local
485 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_lock_refcount_tree()
495 if (tree->rf_generation != le32_to_cpu(rb->rf_generation)) { in ocfs2_lock_refcount_tree()
567 struct ocfs2_refcount_block *rb; in ocfs2_create_refcount_tree() local
629 rb = (struct ocfs2_refcount_block *)new_bh->b_data; in ocfs2_create_refcount_tree()
630 memset(rb, 0, inode->i_sb->s_blocksize); in ocfs2_create_refcount_tree()
631 strcpy((void *)rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); in ocfs2_create_refcount_tree()
632 rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); in ocfs2_create_refcount_tree()
633 rb->rf_suballoc_loc = cpu_to_le64(suballoc_loc); in ocfs2_create_refcount_tree()
634 rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); in ocfs2_create_refcount_tree()
635 rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); in ocfs2_create_refcount_tree()
636 rb->rf_blkno = cpu_to_le64(first_blkno); in ocfs2_create_refcount_tree()
637 rb->rf_count = cpu_to_le32(1); in ocfs2_create_refcount_tree()
638 rb->rf_records.rl_count = in ocfs2_create_refcount_tree()
641 rb->rf_generation = osb->s_next_generation++; in ocfs2_create_refcount_tree()
660 new_tree->rf_generation = le32_to_cpu(rb->rf_generation); in ocfs2_create_refcount_tree()
708 struct ocfs2_refcount_block *rb; in ocfs2_set_refcount_tree() local
741 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_set_refcount_tree()
742 le32_add_cpu(&rb->rf_count, 1); in ocfs2_set_refcount_tree()
769 struct ocfs2_refcount_block *rb; in ocfs2_remove_refcount_tree() local
788 rb = (struct ocfs2_refcount_block *)blk_bh->b_data; in ocfs2_remove_refcount_tree()
794 if (le32_to_cpu(rb->rf_count) == 1) { in ocfs2_remove_refcount_tree()
795 blk = le64_to_cpu(rb->rf_blkno); in ocfs2_remove_refcount_tree()
796 bit = le16_to_cpu(rb->rf_suballoc_bit); in ocfs2_remove_refcount_tree()
797 if (rb->rf_suballoc_loc) in ocfs2_remove_refcount_tree()
798 bg_blkno = le64_to_cpu(rb->rf_suballoc_loc); in ocfs2_remove_refcount_tree()
804 le16_to_cpu(rb->rf_suballoc_slot)); in ocfs2_remove_refcount_tree()
849 le32_add_cpu(&rb->rf_count , -1); in ocfs2_remove_refcount_tree()
852 if (!rb->rf_count) { in ocfs2_remove_refcount_tree()
889 struct ocfs2_refcount_block *rb = in ocfs2_find_refcount_rec_in_rl() local
893 for (; i < le16_to_cpu(rb->rf_records.rl_used); i++) { in ocfs2_find_refcount_rec_in_rl()
894 rec = &rb->rf_records.rl_recs[i]; in ocfs2_find_refcount_rec_in_rl()
912 if (i < le16_to_cpu(rb->rf_records.rl_used) && in ocfs2_find_refcount_rec_in_rl()
1078 struct ocfs2_refcount_block *rb = in ocfs2_get_refcount_rec() local
1081 if (!(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL)) { in ocfs2_get_refcount_rec()
1089 el = &rb->rf_list; in ocfs2_get_refcount_rec()
1156 ocfs2_refcount_rec_adjacent(struct ocfs2_refcount_block *rb, in ocfs2_refcount_rec_adjacent() argument
1159 if ((rb->rf_records.rl_recs[index].r_refcount == in ocfs2_refcount_rec_adjacent()
1160 rb->rf_records.rl_recs[index + 1].r_refcount) && in ocfs2_refcount_rec_adjacent()
1161 (le64_to_cpu(rb->rf_records.rl_recs[index].r_cpos) + in ocfs2_refcount_rec_adjacent()
1162 le32_to_cpu(rb->rf_records.rl_recs[index].r_clusters) == in ocfs2_refcount_rec_adjacent()
1163 le64_to_cpu(rb->rf_records.rl_recs[index + 1].r_cpos))) in ocfs2_refcount_rec_adjacent()
1170 ocfs2_refcount_rec_contig(struct ocfs2_refcount_block *rb, in ocfs2_refcount_rec_contig() argument
1175 if (index < le16_to_cpu(rb->rf_records.rl_used) - 1) in ocfs2_refcount_rec_contig()
1176 ret = ocfs2_refcount_rec_adjacent(rb, index); in ocfs2_refcount_rec_contig()
1181 tmp = ocfs2_refcount_rec_adjacent(rb, index - 1); in ocfs2_refcount_rec_contig()
1194 static void ocfs2_rotate_refcount_rec_left(struct ocfs2_refcount_block *rb, in ocfs2_rotate_refcount_rec_left() argument
1197 BUG_ON(rb->rf_records.rl_recs[index].r_refcount != in ocfs2_rotate_refcount_rec_left()
1198 rb->rf_records.rl_recs[index+1].r_refcount); in ocfs2_rotate_refcount_rec_left()
1200 le32_add_cpu(&rb->rf_records.rl_recs[index].r_clusters, in ocfs2_rotate_refcount_rec_left()
1201 le32_to_cpu(rb->rf_records.rl_recs[index+1].r_clusters)); in ocfs2_rotate_refcount_rec_left()
1203 if (index < le16_to_cpu(rb->rf_records.rl_used) - 2) in ocfs2_rotate_refcount_rec_left()
1204 memmove(&rb->rf_records.rl_recs[index + 1], in ocfs2_rotate_refcount_rec_left()
1205 &rb->rf_records.rl_recs[index + 2], in ocfs2_rotate_refcount_rec_left()
1207 (le16_to_cpu(rb->rf_records.rl_used) - index - 2)); in ocfs2_rotate_refcount_rec_left()
1209 memset(&rb->rf_records.rl_recs[le16_to_cpu(rb->rf_records.rl_used) - 1], in ocfs2_rotate_refcount_rec_left()
1211 le16_add_cpu(&rb->rf_records.rl_used, -1); in ocfs2_rotate_refcount_rec_left()
1217 static void ocfs2_refcount_rec_merge(struct ocfs2_refcount_block *rb, in ocfs2_refcount_rec_merge() argument
1221 ocfs2_refcount_rec_contig(rb, index); in ocfs2_refcount_rec_merge()
1231 ocfs2_rotate_refcount_rec_left(rb, index); in ocfs2_refcount_rec_merge()
1234 ocfs2_rotate_refcount_rec_left(rb, index); in ocfs2_refcount_rec_merge()
1247 struct ocfs2_refcount_block *rb = in ocfs2_change_refcount_rec() local
1249 struct ocfs2_refcount_list *rl = &rb->rf_records; in ocfs2_change_refcount_rec()
1275 ocfs2_refcount_rec_merge(rb, index); in ocfs2_change_refcount_rec()
1460 struct ocfs2_refcount_block *rb = in ocfs2_divide_leaf_refcount_block() local
1462 struct ocfs2_refcount_list *rl = &rb->rf_records; in ocfs2_divide_leaf_refcount_block()
1668 struct ocfs2_refcount_block *rb = in ocfs2_adjust_refcount_rec() local
1672 if (!(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL)) in ocfs2_adjust_refcount_rec()
1675 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_adjust_refcount_rec()
1676 old_cpos = le32_to_cpu(rb->rf_cpos); in ocfs2_adjust_refcount_rec()
1732 rb->rf_cpos = cpu_to_le32(new_cpos); in ocfs2_adjust_refcount_rec()
1751 struct ocfs2_refcount_block *rb = in ocfs2_insert_refcount_rec() local
1753 struct ocfs2_refcount_list *rf_list = &rb->rf_records; in ocfs2_insert_refcount_rec()
1756 BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL); in ocfs2_insert_refcount_rec()
1778 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_insert_refcount_rec()
1779 rf_list = &rb->rf_records; in ocfs2_insert_refcount_rec()
1805 ocfs2_refcount_rec_merge(rb, index); in ocfs2_insert_refcount_rec()
1841 struct ocfs2_refcount_block *rb = in ocfs2_split_refcount_rec() local
1843 struct ocfs2_refcount_list *rf_list = &rb->rf_records; in ocfs2_split_refcount_rec()
1848 BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL); in ocfs2_split_refcount_rec()
1908 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_split_refcount_rec()
1909 rf_list = &rb->rf_records; in ocfs2_split_refcount_rec()
1976 ocfs2_refcount_rec_merge(rb, index); in ocfs2_split_refcount_rec()
2089 struct ocfs2_refcount_block *rb = in ocfs2_remove_refcount_extent() local
2093 BUG_ON(rb->rf_records.rl_used); in ocfs2_remove_refcount_extent()
2098 le32_to_cpu(rb->rf_cpos)); in ocfs2_remove_refcount_extent()
2101 ret = ocfs2_remove_extent(handle, &et, le32_to_cpu(rb->rf_cpos), in ocfs2_remove_refcount_extent()
2115 le16_to_cpu(rb->rf_suballoc_slot), in ocfs2_remove_refcount_extent()
2116 le64_to_cpu(rb->rf_suballoc_loc), in ocfs2_remove_refcount_extent()
2117 le64_to_cpu(rb->rf_blkno), in ocfs2_remove_refcount_extent()
2118 le16_to_cpu(rb->rf_suballoc_bit)); in ocfs2_remove_refcount_extent()
2131 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_remove_refcount_extent()
2133 le32_add_cpu(&rb->rf_clusters, -1); in ocfs2_remove_refcount_extent()
2139 if (!rb->rf_list.l_next_free_rec) { in ocfs2_remove_refcount_extent()
2140 BUG_ON(rb->rf_clusters); in ocfs2_remove_refcount_extent()
2145 rb->rf_flags = 0; in ocfs2_remove_refcount_extent()
2146 rb->rf_parent = 0; in ocfs2_remove_refcount_extent()
2147 rb->rf_cpos = 0; in ocfs2_remove_refcount_extent()
2148 memset(&rb->rf_records, 0, sb->s_blocksize - in ocfs2_remove_refcount_extent()
2150 rb->rf_records.rl_count = in ocfs2_remove_refcount_extent()
2181 struct ocfs2_refcount_block *rb = in ocfs2_decrease_refcount_rec() local
2183 struct ocfs2_refcount_rec *rec = &rb->rf_records.rl_recs[index]; in ocfs2_decrease_refcount_rec()
2216 if (!rb->rf_records.rl_used && ref_leaf_bh != ref_root_bh) { in ocfs2_decrease_refcount_rec()
2387 struct ocfs2_refcount_block *rb; in ocfs2_calc_refcount_meta_credits() local
2407 rb = (struct ocfs2_refcount_block *) in ocfs2_calc_refcount_meta_credits()
2410 if (le16_to_cpu(rb->rf_records.rl_used) + in ocfs2_calc_refcount_meta_credits()
2412 le16_to_cpu(rb->rf_records.rl_count)) in ocfs2_calc_refcount_meta_credits()
2471 rb = (struct ocfs2_refcount_block *)prev_bh->b_data; in ocfs2_calc_refcount_meta_credits()
2473 if (le16_to_cpu(rb->rf_records.rl_used) + recs_add > in ocfs2_calc_refcount_meta_credits()
2474 le16_to_cpu(rb->rf_records.rl_count)) in ocfs2_calc_refcount_meta_credits()
2493 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_calc_refcount_meta_credits()
2494 if (le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL) { in ocfs2_calc_refcount_meta_credits()
3547 struct ocfs2_refcount_block *rb; in ocfs2_refcounted_xattr_delete_need() local
3574 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_refcounted_xattr_delete_need()
3583 if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 > in ocfs2_refcounted_xattr_delete_need()
3584 le16_to_cpu(rb->rf_records.rl_count)) in ocfs2_refcounted_xattr_delete_need()
3603 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_refcounted_xattr_delete_need()
3604 if (le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL) in ocfs2_refcounted_xattr_delete_need()
4124 struct ocfs2_refcount_block *rb; in ocfs2_create_reflink_node() local
4151 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_create_reflink_node()