Lines Matching refs:rb

76 	struct ocfs2_refcount_block *rb =  in ocfs2_validate_refcount_block()  local
88 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &rb->rf_check); in ocfs2_validate_refcount_block()
96 if (!OCFS2_IS_VALID_REFCOUNT_BLOCK(rb)) { in ocfs2_validate_refcount_block()
100 rb->rf_signature); in ocfs2_validate_refcount_block()
104 if (le64_to_cpu(rb->rf_blkno) != bh->b_blocknr) { in ocfs2_validate_refcount_block()
108 (unsigned long long)le64_to_cpu(rb->rf_blkno)); in ocfs2_validate_refcount_block()
112 if (le32_to_cpu(rb->rf_fs_generation) != OCFS2_SB(sb)->fs_generation) { in ocfs2_validate_refcount_block()
116 le32_to_cpu(rb->rf_fs_generation)); in ocfs2_validate_refcount_block()
452 struct ocfs2_refcount_block *rb; in ocfs2_lock_refcount_tree() local
478 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_lock_refcount_tree()
488 if (tree->rf_generation != le32_to_cpu(rb->rf_generation)) { in ocfs2_lock_refcount_tree()
560 struct ocfs2_refcount_block *rb; in ocfs2_create_refcount_tree() local
622 rb = (struct ocfs2_refcount_block *)new_bh->b_data; in ocfs2_create_refcount_tree()
623 memset(rb, 0, inode->i_sb->s_blocksize); in ocfs2_create_refcount_tree()
624 strcpy((void *)rb, OCFS2_REFCOUNT_BLOCK_SIGNATURE); in ocfs2_create_refcount_tree()
625 rb->rf_suballoc_slot = cpu_to_le16(meta_ac->ac_alloc_slot); in ocfs2_create_refcount_tree()
626 rb->rf_suballoc_loc = cpu_to_le64(suballoc_loc); in ocfs2_create_refcount_tree()
627 rb->rf_suballoc_bit = cpu_to_le16(suballoc_bit_start); in ocfs2_create_refcount_tree()
628 rb->rf_fs_generation = cpu_to_le32(osb->fs_generation); in ocfs2_create_refcount_tree()
629 rb->rf_blkno = cpu_to_le64(first_blkno); in ocfs2_create_refcount_tree()
630 rb->rf_count = cpu_to_le32(1); in ocfs2_create_refcount_tree()
631 rb->rf_records.rl_count = in ocfs2_create_refcount_tree()
634 rb->rf_generation = cpu_to_le32(osb->s_next_generation++); in ocfs2_create_refcount_tree()
653 new_tree->rf_generation = le32_to_cpu(rb->rf_generation); in ocfs2_create_refcount_tree()
701 struct ocfs2_refcount_block *rb; in ocfs2_set_refcount_tree() local
734 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_set_refcount_tree()
735 le32_add_cpu(&rb->rf_count, 1); in ocfs2_set_refcount_tree()
762 struct ocfs2_refcount_block *rb; in ocfs2_remove_refcount_tree() local
781 rb = (struct ocfs2_refcount_block *)blk_bh->b_data; in ocfs2_remove_refcount_tree()
787 if (le32_to_cpu(rb->rf_count) == 1) { in ocfs2_remove_refcount_tree()
788 blk = le64_to_cpu(rb->rf_blkno); in ocfs2_remove_refcount_tree()
789 bit = le16_to_cpu(rb->rf_suballoc_bit); in ocfs2_remove_refcount_tree()
790 if (rb->rf_suballoc_loc) in ocfs2_remove_refcount_tree()
791 bg_blkno = le64_to_cpu(rb->rf_suballoc_loc); in ocfs2_remove_refcount_tree()
797 le16_to_cpu(rb->rf_suballoc_slot)); in ocfs2_remove_refcount_tree()
842 le32_add_cpu(&rb->rf_count , -1); in ocfs2_remove_refcount_tree()
845 if (!rb->rf_count) { in ocfs2_remove_refcount_tree()
882 struct ocfs2_refcount_block *rb = in ocfs2_find_refcount_rec_in_rl() local
886 for (; i < le16_to_cpu(rb->rf_records.rl_used); i++) { in ocfs2_find_refcount_rec_in_rl()
887 rec = &rb->rf_records.rl_recs[i]; in ocfs2_find_refcount_rec_in_rl()
905 if (i < le16_to_cpu(rb->rf_records.rl_used) && in ocfs2_find_refcount_rec_in_rl()
1071 struct ocfs2_refcount_block *rb = in ocfs2_get_refcount_rec() local
1074 if (!(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL)) { in ocfs2_get_refcount_rec()
1082 el = &rb->rf_list; in ocfs2_get_refcount_rec()
1149 ocfs2_refcount_rec_adjacent(struct ocfs2_refcount_block *rb, in ocfs2_refcount_rec_adjacent() argument
1152 if ((rb->rf_records.rl_recs[index].r_refcount == in ocfs2_refcount_rec_adjacent()
1153 rb->rf_records.rl_recs[index + 1].r_refcount) && in ocfs2_refcount_rec_adjacent()
1154 (le64_to_cpu(rb->rf_records.rl_recs[index].r_cpos) + in ocfs2_refcount_rec_adjacent()
1155 le32_to_cpu(rb->rf_records.rl_recs[index].r_clusters) == in ocfs2_refcount_rec_adjacent()
1156 le64_to_cpu(rb->rf_records.rl_recs[index + 1].r_cpos))) in ocfs2_refcount_rec_adjacent()
1163 ocfs2_refcount_rec_contig(struct ocfs2_refcount_block *rb, in ocfs2_refcount_rec_contig() argument
1168 if (index < le16_to_cpu(rb->rf_records.rl_used) - 1) in ocfs2_refcount_rec_contig()
1169 ret = ocfs2_refcount_rec_adjacent(rb, index); in ocfs2_refcount_rec_contig()
1174 tmp = ocfs2_refcount_rec_adjacent(rb, index - 1); in ocfs2_refcount_rec_contig()
1187 static void ocfs2_rotate_refcount_rec_left(struct ocfs2_refcount_block *rb, in ocfs2_rotate_refcount_rec_left() argument
1190 BUG_ON(rb->rf_records.rl_recs[index].r_refcount != in ocfs2_rotate_refcount_rec_left()
1191 rb->rf_records.rl_recs[index+1].r_refcount); in ocfs2_rotate_refcount_rec_left()
1193 le32_add_cpu(&rb->rf_records.rl_recs[index].r_clusters, in ocfs2_rotate_refcount_rec_left()
1194 le32_to_cpu(rb->rf_records.rl_recs[index+1].r_clusters)); in ocfs2_rotate_refcount_rec_left()
1196 if (index < le16_to_cpu(rb->rf_records.rl_used) - 2) in ocfs2_rotate_refcount_rec_left()
1197 memmove(&rb->rf_records.rl_recs[index + 1], in ocfs2_rotate_refcount_rec_left()
1198 &rb->rf_records.rl_recs[index + 2], in ocfs2_rotate_refcount_rec_left()
1200 (le16_to_cpu(rb->rf_records.rl_used) - index - 2)); in ocfs2_rotate_refcount_rec_left()
1202 memset(&rb->rf_records.rl_recs[le16_to_cpu(rb->rf_records.rl_used) - 1], in ocfs2_rotate_refcount_rec_left()
1204 le16_add_cpu(&rb->rf_records.rl_used, -1); in ocfs2_rotate_refcount_rec_left()
1210 static void ocfs2_refcount_rec_merge(struct ocfs2_refcount_block *rb, in ocfs2_refcount_rec_merge() argument
1214 ocfs2_refcount_rec_contig(rb, index); in ocfs2_refcount_rec_merge()
1224 ocfs2_rotate_refcount_rec_left(rb, index); in ocfs2_refcount_rec_merge()
1227 ocfs2_rotate_refcount_rec_left(rb, index); in ocfs2_refcount_rec_merge()
1240 struct ocfs2_refcount_block *rb = in ocfs2_change_refcount_rec() local
1242 struct ocfs2_refcount_list *rl = &rb->rf_records; in ocfs2_change_refcount_rec()
1268 ocfs2_refcount_rec_merge(rb, index); in ocfs2_change_refcount_rec()
1446 struct ocfs2_refcount_block *rb = in ocfs2_divide_leaf_refcount_block() local
1448 struct ocfs2_refcount_list *rl = &rb->rf_records; in ocfs2_divide_leaf_refcount_block()
1654 struct ocfs2_refcount_block *rb = in ocfs2_adjust_refcount_rec() local
1658 if (!(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL)) in ocfs2_adjust_refcount_rec()
1661 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_adjust_refcount_rec()
1662 old_cpos = le32_to_cpu(rb->rf_cpos); in ocfs2_adjust_refcount_rec()
1718 rb->rf_cpos = cpu_to_le32(new_cpos); in ocfs2_adjust_refcount_rec()
1737 struct ocfs2_refcount_block *rb = in ocfs2_insert_refcount_rec() local
1739 struct ocfs2_refcount_list *rf_list = &rb->rf_records; in ocfs2_insert_refcount_rec()
1742 BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL); in ocfs2_insert_refcount_rec()
1764 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_insert_refcount_rec()
1765 rf_list = &rb->rf_records; in ocfs2_insert_refcount_rec()
1791 ocfs2_refcount_rec_merge(rb, index); in ocfs2_insert_refcount_rec()
1827 struct ocfs2_refcount_block *rb = in ocfs2_split_refcount_rec() local
1829 struct ocfs2_refcount_list *rf_list = &rb->rf_records; in ocfs2_split_refcount_rec()
1834 BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL); in ocfs2_split_refcount_rec()
1894 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_split_refcount_rec()
1895 rf_list = &rb->rf_records; in ocfs2_split_refcount_rec()
1962 ocfs2_refcount_rec_merge(rb, index); in ocfs2_split_refcount_rec()
2075 struct ocfs2_refcount_block *rb = in ocfs2_remove_refcount_extent() local
2079 BUG_ON(rb->rf_records.rl_used); in ocfs2_remove_refcount_extent()
2084 le32_to_cpu(rb->rf_cpos)); in ocfs2_remove_refcount_extent()
2087 ret = ocfs2_remove_extent(handle, &et, le32_to_cpu(rb->rf_cpos), in ocfs2_remove_refcount_extent()
2101 le16_to_cpu(rb->rf_suballoc_slot), in ocfs2_remove_refcount_extent()
2102 le64_to_cpu(rb->rf_suballoc_loc), in ocfs2_remove_refcount_extent()
2103 le64_to_cpu(rb->rf_blkno), in ocfs2_remove_refcount_extent()
2104 le16_to_cpu(rb->rf_suballoc_bit)); in ocfs2_remove_refcount_extent()
2117 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_remove_refcount_extent()
2119 le32_add_cpu(&rb->rf_clusters, -1); in ocfs2_remove_refcount_extent()
2125 if (!rb->rf_list.l_next_free_rec) { in ocfs2_remove_refcount_extent()
2126 BUG_ON(rb->rf_clusters); in ocfs2_remove_refcount_extent()
2131 rb->rf_flags = 0; in ocfs2_remove_refcount_extent()
2132 rb->rf_parent = 0; in ocfs2_remove_refcount_extent()
2133 rb->rf_cpos = 0; in ocfs2_remove_refcount_extent()
2134 memset(&rb->rf_records, 0, sb->s_blocksize - in ocfs2_remove_refcount_extent()
2136 rb->rf_records.rl_count = in ocfs2_remove_refcount_extent()
2167 struct ocfs2_refcount_block *rb = in ocfs2_decrease_refcount_rec() local
2169 struct ocfs2_refcount_rec *rec = &rb->rf_records.rl_recs[index]; in ocfs2_decrease_refcount_rec()
2202 if (!rb->rf_records.rl_used && ref_leaf_bh != ref_root_bh) { in ocfs2_decrease_refcount_rec()
2372 struct ocfs2_refcount_block *rb; in ocfs2_calc_refcount_meta_credits() local
2392 rb = (struct ocfs2_refcount_block *) in ocfs2_calc_refcount_meta_credits()
2395 if (le16_to_cpu(rb->rf_records.rl_used) + in ocfs2_calc_refcount_meta_credits()
2397 le16_to_cpu(rb->rf_records.rl_count)) in ocfs2_calc_refcount_meta_credits()
2456 rb = (struct ocfs2_refcount_block *)prev_bh->b_data; in ocfs2_calc_refcount_meta_credits()
2458 if (le16_to_cpu(rb->rf_records.rl_used) + recs_add > in ocfs2_calc_refcount_meta_credits()
2459 le16_to_cpu(rb->rf_records.rl_count)) in ocfs2_calc_refcount_meta_credits()
2478 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_calc_refcount_meta_credits()
2479 if (le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL) { in ocfs2_calc_refcount_meta_credits()
3508 struct ocfs2_refcount_block *rb; in ocfs2_refcounted_xattr_delete_need() local
3535 rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; in ocfs2_refcounted_xattr_delete_need()
3544 if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 > in ocfs2_refcounted_xattr_delete_need()
3545 le16_to_cpu(rb->rf_records.rl_count)) in ocfs2_refcounted_xattr_delete_need()
3564 rb = (struct ocfs2_refcount_block *)ref_root_bh->b_data; in ocfs2_refcounted_xattr_delete_need()
3565 if (le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL) in ocfs2_refcounted_xattr_delete_need()