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()
1285 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_find_clear_bits() local
1289 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_find_clear_bits()
1292 bitmap = bg->bg_bitmap; in ocfs2_block_group_find_clear_bits()
1338 struct ocfs2_group_desc *bg, in ocfs2_block_group_set_bits() argument
1344 void *bitmap = bg->bg_bitmap; in ocfs2_block_group_set_bits()
1349 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_set_bits()
1350 BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); in ocfs2_block_group_set_bits()
1366 le16_add_cpu(&bg->bg_free_bits_count, -num_bits); in ocfs2_block_group_set_bits()
1367 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_set_bits()
1369 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_set_bits()
1370 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_set_bits()
1371 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_set_bits()
1414 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_relink_block_group() local
1419 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_relink_block_group()
1424 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_relink_block_group()
1427 bg_ptr = le64_to_cpu(bg->bg_next_group); in ocfs2_relink_block_group()
1436 prev_bg->bg_next_group = bg->bg_next_group; in ocfs2_relink_block_group()
1444 bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno; in ocfs2_relink_block_group()
1452 fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno; in ocfs2_relink_block_group()
1461 bg->bg_next_group = cpu_to_le64(bg_ptr); in ocfs2_relink_block_group()
1467 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, in ocfs2_block_group_reasonably_empty() argument
1470 return le16_to_cpu(bg->bg_free_bits_count) > wanted; in ocfs2_block_group_reasonably_empty()
1554 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_block_group_search() local
1559 if (bg->bg_free_bits_count) { in ocfs2_block_group_search()
1562 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_search()
1565 blkoff = le64_to_cpu(bg->bg_blkno) + in ocfs2_block_group_search()
1640 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_fix_result() argument
1657 !bg->bg_list.l_next_free_rec) in ocfs2_bg_discontig_fix_result()
1660 for (i = 0; i < le16_to_cpu(bg->bg_list.l_next_free_rec); i++) { in ocfs2_bg_discontig_fix_result()
1661 rec = &bg->bg_list.l_recs[i]; in ocfs2_bg_discontig_fix_result()
1751 struct ocfs2_group_desc *bg; in ocfs2_search_chain() local
1765 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1774 if (!bg->bg_next_group) in ocfs2_search_chain()
1780 next_group = le64_to_cpu(bg->bg_next_group); in ocfs2_search_chain()
1789 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1798 (unsigned long long)le64_to_cpu(bg->bg_blkno), res->sr_bits); in ocfs2_search_chain()
1800 res->sr_bg_blkno = le64_to_cpu(bg->bg_blkno); in ocfs2_search_chain()
1804 ocfs2_bg_discontig_fix_result(ac, bg, res); in ocfs2_search_chain()
1827 (ocfs2_block_group_reasonably_empty(bg, res->sr_bits))) { in ocfs2_search_chain()
1850 bg, in ocfs2_search_chain()
1866 *bits_left = le16_to_cpu(bg->bg_free_bits_count); in ocfs2_search_chain()
2133 struct ocfs2_group_desc *bg; in ocfs2_claim_new_inode_at_loc() local
2151 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_claim_new_inode_at_loc()
2152 chain = le16_to_cpu(bg->bg_chain); in ocfs2_claim_new_inode_at_loc()
2164 bg, in ocfs2_claim_new_inode_at_loc()
2382 struct ocfs2_group_desc *bg, in ocfs2_block_group_clear_bits() argument
2396 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_clear_bits()
2421 (unsigned long *) bg->bg_bitmap); in ocfs2_block_group_clear_bits()
2426 le16_add_cpu(&bg->bg_free_bits_count, num_bits); in ocfs2_block_group_clear_bits()
2427 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_clear_bits()
2431 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_clear_bits()
2432 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_clear_bits()
2433 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_clear_bits()