Lines Matching refs:bg
106 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg,
321 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_add_extent() argument
325 struct ocfs2_extent_list *el = &bg->bg_list; in ocfs2_bg_discontig_add_extent()
333 rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) / in ocfs2_bg_discontig_add_extent()
336 le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc)); in ocfs2_bg_discontig_add_extent()
337 le16_add_cpu(&bg->bg_free_bits_count, in ocfs2_bg_discontig_add_extent()
352 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_fill() local
372 memset(bg, 0, sb->s_blocksize); in ocfs2_block_group_fill()
373 strcpy(bg->bg_signature, OCFS2_GROUP_DESC_SIGNATURE); in ocfs2_block_group_fill()
374 bg->bg_generation = cpu_to_le32(osb->fs_generation); in ocfs2_block_group_fill()
375 bg->bg_size = cpu_to_le16(ocfs2_group_bitmap_size(sb, 1, in ocfs2_block_group_fill()
377 bg->bg_chain = cpu_to_le16(my_chain); in ocfs2_block_group_fill()
378 bg->bg_next_group = cl->cl_recs[my_chain].c_blkno; in ocfs2_block_group_fill()
379 bg->bg_parent_dinode = cpu_to_le64(OCFS2_I(alloc_inode)->ip_blkno); in ocfs2_block_group_fill()
380 bg->bg_blkno = cpu_to_le64(group_blkno); in ocfs2_block_group_fill()
382 bg->bg_bits = cpu_to_le16(ocfs2_bits_per_group(cl)); in ocfs2_block_group_fill()
384 ocfs2_bg_discontig_add_extent(osb, bg, cl, group_blkno, in ocfs2_block_group_fill()
388 ocfs2_set_bit(0, (unsigned long *)bg->bg_bitmap); in ocfs2_block_group_fill()
389 bg->bg_free_bits_count = cpu_to_le16(le16_to_cpu(bg->bg_bits) - 1); in ocfs2_block_group_fill()
492 struct ocfs2_group_desc *bg = in ocfs2_block_group_grow_discontig() local
495 le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc); in ocfs2_block_group_grow_discontig()
498 struct ocfs2_extent_list *el = &bg->bg_list; in ocfs2_block_group_grow_discontig()
522 ocfs2_bg_discontig_add_extent(osb, bg, cl, p_blkno, in ocfs2_block_group_grow_discontig()
527 le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc); in ocfs2_block_group_grow_discontig()
551 struct ocfs2_group_desc *bg; in ocfs2_bg_alloc_cleanup() local
558 bg = (struct ocfs2_group_desc *)bg_bh->b_data; in ocfs2_bg_alloc_cleanup()
559 el = &bg->bg_list; in ocfs2_bg_alloc_cleanup()
667 struct ocfs2_group_desc *bg; in ocfs2_block_group_alloc() local
710 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_alloc()
719 alloc_rec = le16_to_cpu(bg->bg_chain); in ocfs2_block_group_alloc()
721 le16_to_cpu(bg->bg_free_bits_count)); in ocfs2_block_group_alloc()
723 le16_to_cpu(bg->bg_bits)); in ocfs2_block_group_alloc()
724 cl->cl_recs[alloc_rec].c_blkno = bg->bg_blkno; in ocfs2_block_group_alloc()
728 le32_add_cpu(&fe->id1.bitmap1.i_used, le16_to_cpu(bg->bg_bits) - in ocfs2_block_group_alloc()
729 le16_to_cpu(bg->bg_free_bits_count)); in ocfs2_block_group_alloc()
730 le32_add_cpu(&fe->id1.bitmap1.i_total, le16_to_cpu(bg->bg_bits)); in ocfs2_block_group_alloc()
1254 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_test_bg_bit_allocatable() local
1258 if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap)) in ocfs2_test_bg_bit_allocatable()
1266 bg = (struct ocfs2_group_desc *) jh->b_committed_data; in ocfs2_test_bg_bit_allocatable()
1267 if (bg) in ocfs2_test_bg_bit_allocatable()
1268 ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); in ocfs2_test_bg_bit_allocatable()
1286 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_find_clear_bits() local
1290 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_find_clear_bits()
1293 bitmap = bg->bg_bitmap; in ocfs2_block_group_find_clear_bits()
1339 struct ocfs2_group_desc *bg, in ocfs2_block_group_set_bits() argument
1345 void *bitmap = bg->bg_bitmap; in ocfs2_block_group_set_bits()
1350 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_set_bits()
1351 BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); in ocfs2_block_group_set_bits()
1367 le16_add_cpu(&bg->bg_free_bits_count, -num_bits); in ocfs2_block_group_set_bits()
1368 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_set_bits()
1370 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_set_bits()
1371 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_set_bits()
1372 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_set_bits()
1415 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_relink_block_group() local
1420 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_relink_block_group()
1425 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_relink_block_group()
1428 bg_ptr = le64_to_cpu(bg->bg_next_group); in ocfs2_relink_block_group()
1437 prev_bg->bg_next_group = bg->bg_next_group; in ocfs2_relink_block_group()
1445 bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno; in ocfs2_relink_block_group()
1453 fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno; in ocfs2_relink_block_group()
1462 bg->bg_next_group = cpu_to_le64(bg_ptr); in ocfs2_relink_block_group()
1468 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, in ocfs2_block_group_reasonably_empty() argument
1471 return le16_to_cpu(bg->bg_free_bits_count) > wanted; in ocfs2_block_group_reasonably_empty()
1555 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_block_group_search() local
1560 if (bg->bg_free_bits_count) { in ocfs2_block_group_search()
1563 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_search()
1566 blkoff = le64_to_cpu(bg->bg_blkno) + in ocfs2_block_group_search()
1641 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_fix_result() argument
1658 !bg->bg_list.l_next_free_rec) in ocfs2_bg_discontig_fix_result()
1661 for (i = 0; i < le16_to_cpu(bg->bg_list.l_next_free_rec); i++) { in ocfs2_bg_discontig_fix_result()
1662 rec = &bg->bg_list.l_recs[i]; in ocfs2_bg_discontig_fix_result()
1752 struct ocfs2_group_desc *bg; in ocfs2_search_chain() local
1766 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1775 if (!bg->bg_next_group) in ocfs2_search_chain()
1781 next_group = le64_to_cpu(bg->bg_next_group); in ocfs2_search_chain()
1790 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1799 (unsigned long long)le64_to_cpu(bg->bg_blkno), res->sr_bits); in ocfs2_search_chain()
1801 res->sr_bg_blkno = le64_to_cpu(bg->bg_blkno); in ocfs2_search_chain()
1805 ocfs2_bg_discontig_fix_result(ac, bg, res); in ocfs2_search_chain()
1828 (ocfs2_block_group_reasonably_empty(bg, res->sr_bits))) { in ocfs2_search_chain()
1851 bg, in ocfs2_search_chain()
1867 *bits_left = le16_to_cpu(bg->bg_free_bits_count); in ocfs2_search_chain()
2134 struct ocfs2_group_desc *bg; in ocfs2_claim_new_inode_at_loc() local
2152 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_claim_new_inode_at_loc()
2153 chain = le16_to_cpu(bg->bg_chain); in ocfs2_claim_new_inode_at_loc()
2165 bg, in ocfs2_claim_new_inode_at_loc()
2383 struct ocfs2_group_desc *bg, in ocfs2_block_group_clear_bits() argument
2397 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_clear_bits()
2422 (unsigned long *) bg->bg_bitmap); in ocfs2_block_group_clear_bits()
2427 le16_add_cpu(&bg->bg_free_bits_count, num_bits); in ocfs2_block_group_clear_bits()
2428 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_clear_bits()
2432 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_clear_bits()
2433 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_clear_bits()
2434 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_clear_bits()