Lines Matching refs:bg

108 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg,
323 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_add_extent() argument
327 struct ocfs2_extent_list *el = &bg->bg_list; in ocfs2_bg_discontig_add_extent()
335 rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) / in ocfs2_bg_discontig_add_extent()
338 le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc)); in ocfs2_bg_discontig_add_extent()
339 le16_add_cpu(&bg->bg_free_bits_count, in ocfs2_bg_discontig_add_extent()
354 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_fill() local
374 memset(bg, 0, sb->s_blocksize); in ocfs2_block_group_fill()
375 strcpy(bg->bg_signature, OCFS2_GROUP_DESC_SIGNATURE); in ocfs2_block_group_fill()
376 bg->bg_generation = cpu_to_le32(osb->fs_generation); in ocfs2_block_group_fill()
377 bg->bg_size = cpu_to_le16(ocfs2_group_bitmap_size(sb, 1, in ocfs2_block_group_fill()
379 bg->bg_chain = cpu_to_le16(my_chain); in ocfs2_block_group_fill()
380 bg->bg_next_group = cl->cl_recs[my_chain].c_blkno; in ocfs2_block_group_fill()
381 bg->bg_parent_dinode = cpu_to_le64(OCFS2_I(alloc_inode)->ip_blkno); in ocfs2_block_group_fill()
382 bg->bg_blkno = cpu_to_le64(group_blkno); in ocfs2_block_group_fill()
384 bg->bg_bits = cpu_to_le16(ocfs2_bits_per_group(cl)); in ocfs2_block_group_fill()
386 ocfs2_bg_discontig_add_extent(osb, bg, cl, group_blkno, in ocfs2_block_group_fill()
390 ocfs2_set_bit(0, (unsigned long *)bg->bg_bitmap); in ocfs2_block_group_fill()
391 bg->bg_free_bits_count = cpu_to_le16(le16_to_cpu(bg->bg_bits) - 1); in ocfs2_block_group_fill()
494 struct ocfs2_group_desc *bg = in ocfs2_block_group_grow_discontig() local
497 le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc); in ocfs2_block_group_grow_discontig()
500 struct ocfs2_extent_list *el = &bg->bg_list; in ocfs2_block_group_grow_discontig()
524 ocfs2_bg_discontig_add_extent(osb, bg, cl, p_blkno, in ocfs2_block_group_grow_discontig()
529 le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc); in ocfs2_block_group_grow_discontig()
553 struct ocfs2_group_desc *bg; in ocfs2_bg_alloc_cleanup() local
560 bg = (struct ocfs2_group_desc *)bg_bh->b_data; in ocfs2_bg_alloc_cleanup()
561 el = &bg->bg_list; in ocfs2_bg_alloc_cleanup()
669 struct ocfs2_group_desc *bg; in ocfs2_block_group_alloc() local
714 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_alloc()
723 alloc_rec = le16_to_cpu(bg->bg_chain); in ocfs2_block_group_alloc()
725 le16_to_cpu(bg->bg_free_bits_count)); in ocfs2_block_group_alloc()
727 le16_to_cpu(bg->bg_bits)); in ocfs2_block_group_alloc()
728 cl->cl_recs[alloc_rec].c_blkno = bg->bg_blkno; in ocfs2_block_group_alloc()
732 le32_add_cpu(&fe->id1.bitmap1.i_used, le16_to_cpu(bg->bg_bits) - in ocfs2_block_group_alloc()
733 le16_to_cpu(bg->bg_free_bits_count)); in ocfs2_block_group_alloc()
734 le32_add_cpu(&fe->id1.bitmap1.i_total, le16_to_cpu(bg->bg_bits)); in ocfs2_block_group_alloc()
1258 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_test_bg_bit_allocatable() local
1262 if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap)) in ocfs2_test_bg_bit_allocatable()
1270 bg = (struct ocfs2_group_desc *) jh->b_committed_data; in ocfs2_test_bg_bit_allocatable()
1271 if (bg) in ocfs2_test_bg_bit_allocatable()
1272 ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); in ocfs2_test_bg_bit_allocatable()
1311 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_find_clear_bits() local
1315 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_find_clear_bits()
1318 bitmap = bg->bg_bitmap; in ocfs2_block_group_find_clear_bits()
1365 struct ocfs2_group_desc *bg, in ocfs2_block_group_set_bits() argument
1373 void *bitmap = bg->bg_bitmap; in ocfs2_block_group_set_bits()
1381 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_set_bits()
1382 BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); in ocfs2_block_group_set_bits()
1398 le16_add_cpu(&bg->bg_free_bits_count, -num_bits); in ocfs2_block_group_set_bits()
1399 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_set_bits()
1401 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_set_bits()
1402 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_set_bits()
1403 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_set_bits()
1414 bg->bg_contig_free_bits = cpu_to_le16(max_contig_bits); in ocfs2_block_group_set_bits()
1423 le16_to_cpu(bg->bg_bits), start); in ocfs2_block_group_set_bits()
1426 bg->bg_contig_free_bits = cpu_to_le16(max_contig_bits); in ocfs2_block_group_set_bits()
1429 bg->bg_contig_free_bits = 0; in ocfs2_block_group_set_bits()
1469 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_relink_block_group() local
1474 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_relink_block_group()
1479 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_relink_block_group()
1482 bg_ptr = le64_to_cpu(bg->bg_next_group); in ocfs2_relink_block_group()
1491 prev_bg->bg_next_group = bg->bg_next_group; in ocfs2_relink_block_group()
1499 bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno; in ocfs2_relink_block_group()
1507 fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno; in ocfs2_relink_block_group()
1516 bg->bg_next_group = cpu_to_le64(bg_ptr); in ocfs2_relink_block_group()
1522 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, in ocfs2_block_group_reasonably_empty() argument
1525 return le16_to_cpu(bg->bg_free_bits_count) > wanted; in ocfs2_block_group_reasonably_empty()
1607 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_block_group_search() local
1612 if (le16_to_cpu(bg->bg_free_bits_count) >= bits_wanted) { in ocfs2_block_group_search()
1615 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_search()
1618 blkoff = le64_to_cpu(bg->bg_blkno) + in ocfs2_block_group_search()
1693 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_fix_result() argument
1710 !bg->bg_list.l_next_free_rec) in ocfs2_bg_discontig_fix_result()
1713 for (i = 0; i < le16_to_cpu(bg->bg_list.l_next_free_rec); i++) { in ocfs2_bg_discontig_fix_result()
1714 rec = &bg->bg_list.l_recs[i]; in ocfs2_bg_discontig_fix_result()
1806 struct ocfs2_group_desc *bg; in ocfs2_search_chain() local
1820 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1827 contig_bits = le16_to_cpu(bg->bg_contig_free_bits); in ocfs2_search_chain()
1829 contig_bits = ocfs2_find_max_contig_free_bits(bg->bg_bitmap, in ocfs2_search_chain()
1830 le16_to_cpu(bg->bg_bits), 0); in ocfs2_search_chain()
1840 if (!bg->bg_next_group) in ocfs2_search_chain()
1846 next_group = le64_to_cpu(bg->bg_next_group); in ocfs2_search_chain()
1855 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1864 (unsigned long long)le64_to_cpu(bg->bg_blkno), res->sr_bits); in ocfs2_search_chain()
1866 res->sr_bg_blkno = le64_to_cpu(bg->bg_blkno); in ocfs2_search_chain()
1870 ocfs2_bg_discontig_fix_result(ac, bg, res); in ocfs2_search_chain()
1893 (ocfs2_block_group_reasonably_empty(bg, res->sr_bits))) { in ocfs2_search_chain()
1916 bg, in ocfs2_search_chain()
1934 *bits_left = le16_to_cpu(bg->bg_free_bits_count); in ocfs2_search_chain()
2212 struct ocfs2_group_desc *bg; in ocfs2_claim_new_inode_at_loc() local
2230 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_claim_new_inode_at_loc()
2231 chain = le16_to_cpu(bg->bg_chain); in ocfs2_claim_new_inode_at_loc()
2243 bg, in ocfs2_claim_new_inode_at_loc()
2464 struct ocfs2_group_desc *bg, in ocfs2_block_group_clear_bits() argument
2480 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_clear_bits()
2505 (unsigned long *) bg->bg_bitmap); in ocfs2_block_group_clear_bits()
2510 le16_add_cpu(&bg->bg_free_bits_count, num_bits); in ocfs2_block_group_clear_bits()
2511 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_clear_bits()
2515 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_clear_bits()
2516 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_clear_bits()
2517 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_clear_bits()
2526 contig_bits = ocfs2_find_max_contig_free_bits(bg->bg_bitmap, in ocfs2_block_group_clear_bits()
2527 le16_to_cpu(bg->bg_bits), 0); in ocfs2_block_group_clear_bits()
2530 bg->bg_contig_free_bits = cpu_to_le16(max_contig_bits); in ocfs2_block_group_clear_bits()
2532 bg->bg_contig_free_bits = 0; in ocfs2_block_group_clear_bits()