Lines Matching refs:bg

104 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg,
319 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_add_extent() argument
323 struct ocfs2_extent_list *el = &bg->bg_list; in ocfs2_bg_discontig_add_extent()
331 rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) / in ocfs2_bg_discontig_add_extent()
334 le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc)); in ocfs2_bg_discontig_add_extent()
335 le16_add_cpu(&bg->bg_free_bits_count, in ocfs2_bg_discontig_add_extent()
350 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_fill() local
370 memset(bg, 0, sb->s_blocksize); in ocfs2_block_group_fill()
371 strcpy(bg->bg_signature, OCFS2_GROUP_DESC_SIGNATURE); in ocfs2_block_group_fill()
372 bg->bg_generation = cpu_to_le32(osb->fs_generation); in ocfs2_block_group_fill()
373 bg->bg_size = cpu_to_le16(ocfs2_group_bitmap_size(sb, 1, in ocfs2_block_group_fill()
375 bg->bg_chain = cpu_to_le16(my_chain); in ocfs2_block_group_fill()
376 bg->bg_next_group = cl->cl_recs[my_chain].c_blkno; in ocfs2_block_group_fill()
377 bg->bg_parent_dinode = cpu_to_le64(OCFS2_I(alloc_inode)->ip_blkno); in ocfs2_block_group_fill()
378 bg->bg_blkno = cpu_to_le64(group_blkno); in ocfs2_block_group_fill()
380 bg->bg_bits = cpu_to_le16(ocfs2_bits_per_group(cl)); in ocfs2_block_group_fill()
382 ocfs2_bg_discontig_add_extent(osb, bg, cl, group_blkno, in ocfs2_block_group_fill()
386 ocfs2_set_bit(0, (unsigned long *)bg->bg_bitmap); in ocfs2_block_group_fill()
387 bg->bg_free_bits_count = cpu_to_le16(le16_to_cpu(bg->bg_bits) - 1); in ocfs2_block_group_fill()
490 struct ocfs2_group_desc *bg = in ocfs2_block_group_grow_discontig() local
493 le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc); in ocfs2_block_group_grow_discontig()
496 struct ocfs2_extent_list *el = &bg->bg_list; in ocfs2_block_group_grow_discontig()
520 ocfs2_bg_discontig_add_extent(osb, bg, cl, p_blkno, in ocfs2_block_group_grow_discontig()
525 le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc); in ocfs2_block_group_grow_discontig()
549 struct ocfs2_group_desc *bg; in ocfs2_bg_alloc_cleanup() local
556 bg = (struct ocfs2_group_desc *)bg_bh->b_data; in ocfs2_bg_alloc_cleanup()
557 el = &bg->bg_list; in ocfs2_bg_alloc_cleanup()
665 struct ocfs2_group_desc *bg; in ocfs2_block_group_alloc() local
708 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_alloc()
717 alloc_rec = le16_to_cpu(bg->bg_chain); in ocfs2_block_group_alloc()
719 le16_to_cpu(bg->bg_free_bits_count)); in ocfs2_block_group_alloc()
721 le16_to_cpu(bg->bg_bits)); in ocfs2_block_group_alloc()
722 cl->cl_recs[alloc_rec].c_blkno = bg->bg_blkno; in ocfs2_block_group_alloc()
726 le32_add_cpu(&fe->id1.bitmap1.i_used, le16_to_cpu(bg->bg_bits) - in ocfs2_block_group_alloc()
727 le16_to_cpu(bg->bg_free_bits_count)); in ocfs2_block_group_alloc()
728 le32_add_cpu(&fe->id1.bitmap1.i_total, le16_to_cpu(bg->bg_bits)); in ocfs2_block_group_alloc()
1252 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_test_bg_bit_allocatable() local
1256 if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap)) in ocfs2_test_bg_bit_allocatable()
1264 bg = (struct ocfs2_group_desc *) jh->b_committed_data; in ocfs2_test_bg_bit_allocatable()
1265 if (bg) in ocfs2_test_bg_bit_allocatable()
1266 ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); in ocfs2_test_bg_bit_allocatable()
1284 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_find_clear_bits() local
1288 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_find_clear_bits()
1291 bitmap = bg->bg_bitmap; in ocfs2_block_group_find_clear_bits()
1337 struct ocfs2_group_desc *bg, in ocfs2_block_group_set_bits() argument
1343 void *bitmap = bg->bg_bitmap; in ocfs2_block_group_set_bits()
1348 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_set_bits()
1349 BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); in ocfs2_block_group_set_bits()
1365 le16_add_cpu(&bg->bg_free_bits_count, -num_bits); in ocfs2_block_group_set_bits()
1366 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_set_bits()
1368 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_set_bits()
1369 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_set_bits()
1370 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_set_bits()
1413 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_relink_block_group() local
1418 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_relink_block_group()
1423 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_relink_block_group()
1426 bg_ptr = le64_to_cpu(bg->bg_next_group); in ocfs2_relink_block_group()
1435 prev_bg->bg_next_group = bg->bg_next_group; in ocfs2_relink_block_group()
1443 bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno; in ocfs2_relink_block_group()
1451 fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno; in ocfs2_relink_block_group()
1460 bg->bg_next_group = cpu_to_le64(bg_ptr); in ocfs2_relink_block_group()
1466 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, in ocfs2_block_group_reasonably_empty() argument
1469 return le16_to_cpu(bg->bg_free_bits_count) > wanted; in ocfs2_block_group_reasonably_empty()
1553 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_block_group_search() local
1558 if (bg->bg_free_bits_count) { in ocfs2_block_group_search()
1561 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_search()
1564 blkoff = le64_to_cpu(bg->bg_blkno) + in ocfs2_block_group_search()
1639 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_fix_result() argument
1656 !bg->bg_list.l_next_free_rec) in ocfs2_bg_discontig_fix_result()
1659 for (i = 0; i < le16_to_cpu(bg->bg_list.l_next_free_rec); i++) { in ocfs2_bg_discontig_fix_result()
1660 rec = &bg->bg_list.l_recs[i]; in ocfs2_bg_discontig_fix_result()
1750 struct ocfs2_group_desc *bg; in ocfs2_search_chain() local
1764 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1773 if (!bg->bg_next_group) in ocfs2_search_chain()
1779 next_group = le64_to_cpu(bg->bg_next_group); in ocfs2_search_chain()
1788 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1797 (unsigned long long)le64_to_cpu(bg->bg_blkno), res->sr_bits); in ocfs2_search_chain()
1799 res->sr_bg_blkno = le64_to_cpu(bg->bg_blkno); in ocfs2_search_chain()
1803 ocfs2_bg_discontig_fix_result(ac, bg, res); in ocfs2_search_chain()
1826 (ocfs2_block_group_reasonably_empty(bg, res->sr_bits))) { in ocfs2_search_chain()
1849 bg, in ocfs2_search_chain()
1865 *bits_left = le16_to_cpu(bg->bg_free_bits_count); in ocfs2_search_chain()
2132 struct ocfs2_group_desc *bg; in ocfs2_claim_new_inode_at_loc() local
2150 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_claim_new_inode_at_loc()
2151 chain = le16_to_cpu(bg->bg_chain); in ocfs2_claim_new_inode_at_loc()
2163 bg, in ocfs2_claim_new_inode_at_loc()
2381 struct ocfs2_group_desc *bg, in ocfs2_block_group_clear_bits() argument
2395 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_clear_bits()
2420 (unsigned long *) bg->bg_bitmap); in ocfs2_block_group_clear_bits()
2425 le16_add_cpu(&bg->bg_free_bits_count, num_bits); in ocfs2_block_group_clear_bits()
2426 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_clear_bits()
2430 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_clear_bits()
2431 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_clear_bits()
2432 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_clear_bits()