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()
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()
1287 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_find_clear_bits() local
1291 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_find_clear_bits()
1294 bitmap = bg->bg_bitmap; in ocfs2_block_group_find_clear_bits()
1340 struct ocfs2_group_desc *bg, in ocfs2_block_group_set_bits() argument
1346 void *bitmap = bg->bg_bitmap; in ocfs2_block_group_set_bits()
1351 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_set_bits()
1352 BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); in ocfs2_block_group_set_bits()
1368 le16_add_cpu(&bg->bg_free_bits_count, -num_bits); in ocfs2_block_group_set_bits()
1369 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_set_bits()
1371 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_set_bits()
1372 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_set_bits()
1373 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_set_bits()
1416 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_relink_block_group() local
1421 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_relink_block_group()
1426 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_relink_block_group()
1429 bg_ptr = le64_to_cpu(bg->bg_next_group); in ocfs2_relink_block_group()
1438 prev_bg->bg_next_group = bg->bg_next_group; in ocfs2_relink_block_group()
1446 bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno; in ocfs2_relink_block_group()
1454 fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno; in ocfs2_relink_block_group()
1463 bg->bg_next_group = cpu_to_le64(bg_ptr); in ocfs2_relink_block_group()
1469 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, in ocfs2_block_group_reasonably_empty() argument
1472 return le16_to_cpu(bg->bg_free_bits_count) > wanted; in ocfs2_block_group_reasonably_empty()
1556 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_block_group_search() local
1561 if (bg->bg_free_bits_count) { in ocfs2_block_group_search()
1564 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_search()
1567 blkoff = le64_to_cpu(bg->bg_blkno) + in ocfs2_block_group_search()
1642 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_fix_result() argument
1659 !bg->bg_list.l_next_free_rec) in ocfs2_bg_discontig_fix_result()
1662 for (i = 0; i < le16_to_cpu(bg->bg_list.l_next_free_rec); i++) { in ocfs2_bg_discontig_fix_result()
1663 rec = &bg->bg_list.l_recs[i]; in ocfs2_bg_discontig_fix_result()
1753 struct ocfs2_group_desc *bg; in ocfs2_search_chain() local
1767 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1776 if (!bg->bg_next_group) in ocfs2_search_chain()
1782 next_group = le64_to_cpu(bg->bg_next_group); in ocfs2_search_chain()
1791 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1800 (unsigned long long)le64_to_cpu(bg->bg_blkno), res->sr_bits); in ocfs2_search_chain()
1802 res->sr_bg_blkno = le64_to_cpu(bg->bg_blkno); in ocfs2_search_chain()
1806 ocfs2_bg_discontig_fix_result(ac, bg, res); in ocfs2_search_chain()
1829 (ocfs2_block_group_reasonably_empty(bg, res->sr_bits))) { in ocfs2_search_chain()
1852 bg, in ocfs2_search_chain()
1868 *bits_left = le16_to_cpu(bg->bg_free_bits_count); in ocfs2_search_chain()
2135 struct ocfs2_group_desc *bg; in ocfs2_claim_new_inode_at_loc() local
2153 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_claim_new_inode_at_loc()
2154 chain = le16_to_cpu(bg->bg_chain); in ocfs2_claim_new_inode_at_loc()
2166 bg, in ocfs2_claim_new_inode_at_loc()
2384 struct ocfs2_group_desc *bg, in ocfs2_block_group_clear_bits() argument
2398 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_clear_bits()
2423 (unsigned long *) bg->bg_bitmap); in ocfs2_block_group_clear_bits()
2428 le16_add_cpu(&bg->bg_free_bits_count, num_bits); in ocfs2_block_group_clear_bits()
2429 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_clear_bits()
2433 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_clear_bits()
2434 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_clear_bits()
2435 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_clear_bits()