Lines Matching refs:rb
77 struct ocfs2_refcount_block *rb = in ocfs2_validate_refcount_block() local
89 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &rb->rf_check); in ocfs2_validate_refcount_block()
97 if (!OCFS2_IS_VALID_REFCOUNT_BLOCK(rb)) { in ocfs2_validate_refcount_block()
101 rb->rf_signature); in ocfs2_validate_refcount_block()
105 if (le64_to_cpu(rb->rf_blkno) != bh->b_blocknr) { in ocfs2_validate_refcount_block()
109 (unsigned long long)le64_to_cpu(rb->rf_blkno)); in ocfs2_validate_refcount_block()
113 if (le32_to_cpu(rb->rf_fs_generation) != OCFS2_SB(sb)->fs_generation) { in ocfs2_validate_refcount_block()
117 le32_to_cpu(rb->rf_fs_generation)); in ocfs2_validate_refcount_block()
451 struct ocfs2_refcount_block *rb; in ocfs2_lock_refcount_tree() local
477 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_lock_refcount_tree()
487 if (tree->rf_generation != le32_to_cpu(rb->rf_generation)) { in ocfs2_lock_refcount_tree()
559 struct ocfs2_refcount_block *rb; in ocfs2_create_refcount_tree() local
621 rb = (struct ocfs2_refcount_block *)new_bh->b_data; in ocfs2_create_refcount_tree()
622 memset(rb, 0, inode->i_sb->s_blocksize); in ocfs2_create_refcount_tree()
623 strcpy((void *)rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); in ocfs2_create_refcount_tree()
624 rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); in ocfs2_create_refcount_tree()
625 rb->rf_suballoc_loc = cpu_to_le64(suballoc_loc); in ocfs2_create_refcount_tree()
626 rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); in ocfs2_create_refcount_tree()
627 rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); in ocfs2_create_refcount_tree()
628 rb->rf_blkno = cpu_to_le64(first_blkno); in ocfs2_create_refcount_tree()
629 rb->rf_count = cpu_to_le32(1); in ocfs2_create_refcount_tree()
630 rb->rf_records.rl_count = in ocfs2_create_refcount_tree()
633 rb->rf_generation = osb->s_next_generation++; in ocfs2_create_refcount_tree()
652 new_tree->rf_generation = le32_to_cpu(rb->rf_generation); in ocfs2_create_refcount_tree()
700 struct ocfs2_refcount_block *rb; in ocfs2_set_refcount_tree() local
733 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_set_refcount_tree()
734 le32_add_cpu(&rb->rf_count, 1); in ocfs2_set_refcount_tree()
761 struct ocfs2_refcount_block *rb; in ocfs2_remove_refcount_tree() local
780 rb = (struct ocfs2_refcount_block *)blk_bh->b_data; in ocfs2_remove_refcount_tree()
786 if (le32_to_cpu(rb->rf_count) == 1) { in ocfs2_remove_refcount_tree()
787 blk = le64_to_cpu(rb->rf_blkno); in ocfs2_remove_refcount_tree()
788 bit = le16_to_cpu(rb->rf_suballoc_bit); in ocfs2_remove_refcount_tree()
789 if (rb->rf_suballoc_loc) in ocfs2_remove_refcount_tree()
790 bg_blkno = le64_to_cpu(rb->rf_suballoc_loc); in ocfs2_remove_refcount_tree()
796 le16_to_cpu(rb->rf_suballoc_slot)); in ocfs2_remove_refcount_tree()
841 le32_add_cpu(&rb->rf_count , -1); in ocfs2_remove_refcount_tree()
844 if (!rb->rf_count) { in ocfs2_remove_refcount_tree()
881 struct ocfs2_refcount_block *rb = in ocfs2_find_refcount_rec_in_rl() local
885 for (; i < le16_to_cpu(rb->rf_records.rl_used); i++) { in ocfs2_find_refcount_rec_in_rl()
886 rec = &rb->rf_records.rl_recs[i]; in ocfs2_find_refcount_rec_in_rl()
904 if (i < le16_to_cpu(rb->rf_records.rl_used) && in ocfs2_find_refcount_rec_in_rl()
1070 struct ocfs2_refcount_block *rb = in ocfs2_get_refcount_rec() local
1073 if (!(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL)) { in ocfs2_get_refcount_rec()
1081 el = &rb->rf_list; in ocfs2_get_refcount_rec()
1148 ocfs2_refcount_rec_adjacent(struct ocfs2_refcount_block *rb, in ocfs2_refcount_rec_adjacent() argument
1151 if ((rb->rf_records.rl_recs[index].r_refcount == in ocfs2_refcount_rec_adjacent()
1152 rb->rf_records.rl_recs[index + 1].r_refcount) && in ocfs2_refcount_rec_adjacent()
1153 (le64_to_cpu(rb->rf_records.rl_recs[index].r_cpos) + in ocfs2_refcount_rec_adjacent()
1154 le32_to_cpu(rb->rf_records.rl_recs[index].r_clusters) == in ocfs2_refcount_rec_adjacent()
1155 le64_to_cpu(rb->rf_records.rl_recs[index + 1].r_cpos))) in ocfs2_refcount_rec_adjacent()
1162 ocfs2_refcount_rec_contig(struct ocfs2_refcount_block *rb, in ocfs2_refcount_rec_contig() argument
1167 if (index < le16_to_cpu(rb->rf_records.rl_used) - 1) in ocfs2_refcount_rec_contig()
1168 ret = ocfs2_refcount_rec_adjacent(rb, index); in ocfs2_refcount_rec_contig()
1173 tmp = ocfs2_refcount_rec_adjacent(rb, index - 1); in ocfs2_refcount_rec_contig()
1186 static void ocfs2_rotate_refcount_rec_left(struct ocfs2_refcount_block *rb, in ocfs2_rotate_refcount_rec_left() argument
1189 BUG_ON(rb->rf_records.rl_recs[index].r_refcount != in ocfs2_rotate_refcount_rec_left()
1190 rb->rf_records.rl_recs[index+1].r_refcount); in ocfs2_rotate_refcount_rec_left()
1192 le32_add_cpu(&rb->rf_records.rl_recs[index].r_clusters, in ocfs2_rotate_refcount_rec_left()
1193 le32_to_cpu(rb->rf_records.rl_recs[index+1].r_clusters)); in ocfs2_rotate_refcount_rec_left()
1195 if (index < le16_to_cpu(rb->rf_records.rl_used) - 2) in ocfs2_rotate_refcount_rec_left()
1196 memmove(&rb->rf_records.rl_recs[index + 1], in ocfs2_rotate_refcount_rec_left()
1197 &rb->rf_records.rl_recs[index + 2], in ocfs2_rotate_refcount_rec_left()
1199 (le16_to_cpu(rb->rf_records.rl_used) - index - 2)); in ocfs2_rotate_refcount_rec_left()
1201 memset(&rb->rf_records.rl_recs[le16_to_cpu(rb->rf_records.rl_used) - 1], in ocfs2_rotate_refcount_rec_left()
1203 le16_add_cpu(&rb->rf_records.rl_used, -1); in ocfs2_rotate_refcount_rec_left()
1209 static void ocfs2_refcount_rec_merge(struct ocfs2_refcount_block *rb, in ocfs2_refcount_rec_merge() argument
1213 ocfs2_refcount_rec_contig(rb, index); in ocfs2_refcount_rec_merge()
1223 ocfs2_rotate_refcount_rec_left(rb, index); in ocfs2_refcount_rec_merge()
1226 ocfs2_rotate_refcount_rec_left(rb, index); in ocfs2_refcount_rec_merge()
1239 struct ocfs2_refcount_block *rb = in ocfs2_change_refcount_rec() local
1241 struct ocfs2_refcount_list *rl = &rb->rf_records; in ocfs2_change_refcount_rec()
1267 ocfs2_refcount_rec_merge(rb, index); in ocfs2_change_refcount_rec()
1452 struct ocfs2_refcount_block *rb = in ocfs2_divide_leaf_refcount_block() local
1454 struct ocfs2_refcount_list *rl = &rb->rf_records; in ocfs2_divide_leaf_refcount_block()
1660 struct ocfs2_refcount_block *rb = in ocfs2_adjust_refcount_rec() local
1664 if (!(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL)) in ocfs2_adjust_refcount_rec()
1667 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_adjust_refcount_rec()
1668 old_cpos = le32_to_cpu(rb->rf_cpos); in ocfs2_adjust_refcount_rec()
1724 rb->rf_cpos = cpu_to_le32(new_cpos); in ocfs2_adjust_refcount_rec()
1743 struct ocfs2_refcount_block *rb = in ocfs2_insert_refcount_rec() local
1745 struct ocfs2_refcount_list *rf_list = &rb->rf_records; in ocfs2_insert_refcount_rec()
1748 BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL); in ocfs2_insert_refcount_rec()
1770 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_insert_refcount_rec()
1771 rf_list = &rb->rf_records; in ocfs2_insert_refcount_rec()
1797 ocfs2_refcount_rec_merge(rb, index); in ocfs2_insert_refcount_rec()
1833 struct ocfs2_refcount_block *rb = in ocfs2_split_refcount_rec() local
1835 struct ocfs2_refcount_list *rf_list = &rb->rf_records; in ocfs2_split_refcount_rec()
1840 BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL); in ocfs2_split_refcount_rec()
1900 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_split_refcount_rec()
1901 rf_list = &rb->rf_records; in ocfs2_split_refcount_rec()
1968 ocfs2_refcount_rec_merge(rb, index); in ocfs2_split_refcount_rec()
2081 struct ocfs2_refcount_block *rb = in ocfs2_remove_refcount_extent() local
2085 BUG_ON(rb->rf_records.rl_used); in ocfs2_remove_refcount_extent()
2090 le32_to_cpu(rb->rf_cpos)); in ocfs2_remove_refcount_extent()
2093 ret = ocfs2_remove_extent(handle, &et, le32_to_cpu(rb->rf_cpos), in ocfs2_remove_refcount_extent()
2107 le16_to_cpu(rb->rf_suballoc_slot), in ocfs2_remove_refcount_extent()
2108 le64_to_cpu(rb->rf_suballoc_loc), in ocfs2_remove_refcount_extent()
2109 le64_to_cpu(rb->rf_blkno), in ocfs2_remove_refcount_extent()
2110 le16_to_cpu(rb->rf_suballoc_bit)); in ocfs2_remove_refcount_extent()
2123 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_remove_refcount_extent()
2125 le32_add_cpu(&rb->rf_clusters, -1); in ocfs2_remove_refcount_extent()
2131 if (!rb->rf_list.l_next_free_rec) { in ocfs2_remove_refcount_extent()
2132 BUG_ON(rb->rf_clusters); in ocfs2_remove_refcount_extent()
2137 rb->rf_flags = 0; in ocfs2_remove_refcount_extent()
2138 rb->rf_parent = 0; in ocfs2_remove_refcount_extent()
2139 rb->rf_cpos = 0; in ocfs2_remove_refcount_extent()
2140 memset(&rb->rf_records, 0, sb->s_blocksize - in ocfs2_remove_refcount_extent()
2142 rb->rf_records.rl_count = in ocfs2_remove_refcount_extent()
2173 struct ocfs2_refcount_block *rb = in ocfs2_decrease_refcount_rec() local
2175 struct ocfs2_refcount_rec *rec = &rb->rf_records.rl_recs[index]; in ocfs2_decrease_refcount_rec()
2208 if (!rb->rf_records.rl_used && ref_leaf_bh != ref_root_bh) { in ocfs2_decrease_refcount_rec()
2378 struct ocfs2_refcount_block *rb; in ocfs2_calc_refcount_meta_credits() local
2398 rb = (struct ocfs2_refcount_block *) in ocfs2_calc_refcount_meta_credits()
2401 if (le16_to_cpu(rb->rf_records.rl_used) + in ocfs2_calc_refcount_meta_credits()
2403 le16_to_cpu(rb->rf_records.rl_count)) in ocfs2_calc_refcount_meta_credits()
2462 rb = (struct ocfs2_refcount_block *)prev_bh->b_data; in ocfs2_calc_refcount_meta_credits()
2464 if (le16_to_cpu(rb->rf_records.rl_used) + recs_add > in ocfs2_calc_refcount_meta_credits()
2465 le16_to_cpu(rb->rf_records.rl_count)) in ocfs2_calc_refcount_meta_credits()
2484 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_calc_refcount_meta_credits()
2485 if (le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL) { in ocfs2_calc_refcount_meta_credits()
3544 struct ocfs2_refcount_block *rb; in ocfs2_refcounted_xattr_delete_need() local
3571 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_refcounted_xattr_delete_need()
3580 if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 > in ocfs2_refcounted_xattr_delete_need()
3581 le16_to_cpu(rb->rf_records.rl_count)) in ocfs2_refcounted_xattr_delete_need()
3600 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_refcounted_xattr_delete_need()
3601 if (le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL) in ocfs2_refcounted_xattr_delete_need()