Lines Matching refs:bg
109 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg,
324 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_add_extent() argument
328 struct ocfs2_extent_list *el = &bg->bg_list; in ocfs2_bg_discontig_add_extent()
336 rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) / in ocfs2_bg_discontig_add_extent()
339 le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc)); in ocfs2_bg_discontig_add_extent()
340 le16_add_cpu(&bg->bg_free_bits_count, in ocfs2_bg_discontig_add_extent()
355 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_fill() local
375 memset(bg, 0, sb->s_blocksize); in ocfs2_block_group_fill()
376 strscpy(bg->bg_signature, OCFS2_GROUP_DESC_SIGNATURE); in ocfs2_block_group_fill()
377 bg->bg_generation = cpu_to_le32(osb->fs_generation); in ocfs2_block_group_fill()
378 bg->bg_size = cpu_to_le16(ocfs2_group_bitmap_size(sb, 1, in ocfs2_block_group_fill()
380 bg->bg_chain = cpu_to_le16(my_chain); in ocfs2_block_group_fill()
381 bg->bg_next_group = cl->cl_recs[my_chain].c_blkno; in ocfs2_block_group_fill()
382 bg->bg_parent_dinode = cpu_to_le64(OCFS2_I(alloc_inode)->ip_blkno); in ocfs2_block_group_fill()
383 bg->bg_blkno = cpu_to_le64(group_blkno); in ocfs2_block_group_fill()
385 bg->bg_bits = cpu_to_le16(ocfs2_bits_per_group(cl)); in ocfs2_block_group_fill()
387 ocfs2_bg_discontig_add_extent(osb, bg, cl, group_blkno, in ocfs2_block_group_fill()
391 ocfs2_set_bit(0, (unsigned long *)bg->bg_bitmap); in ocfs2_block_group_fill()
392 bg->bg_free_bits_count = cpu_to_le16(le16_to_cpu(bg->bg_bits) - 1); in ocfs2_block_group_fill()
495 struct ocfs2_group_desc *bg = in ocfs2_block_group_grow_discontig() local
498 le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc); in ocfs2_block_group_grow_discontig()
501 struct ocfs2_extent_list *el = &bg->bg_list; in ocfs2_block_group_grow_discontig()
525 ocfs2_bg_discontig_add_extent(osb, bg, cl, p_blkno, in ocfs2_block_group_grow_discontig()
530 le16_to_cpu(bg->bg_bits) / le16_to_cpu(cl->cl_bpc); in ocfs2_block_group_grow_discontig()
554 struct ocfs2_group_desc *bg; in ocfs2_bg_alloc_cleanup() local
561 bg = (struct ocfs2_group_desc *)bg_bh->b_data; in ocfs2_bg_alloc_cleanup()
562 el = &bg->bg_list; in ocfs2_bg_alloc_cleanup()
670 struct ocfs2_group_desc *bg; in ocfs2_block_group_alloc() local
715 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_alloc()
724 alloc_rec = le16_to_cpu(bg->bg_chain); in ocfs2_block_group_alloc()
726 le16_to_cpu(bg->bg_free_bits_count)); in ocfs2_block_group_alloc()
728 le16_to_cpu(bg->bg_bits)); in ocfs2_block_group_alloc()
729 cl->cl_recs[alloc_rec].c_blkno = bg->bg_blkno; in ocfs2_block_group_alloc()
733 le32_add_cpu(&fe->id1.bitmap1.i_used, le16_to_cpu(bg->bg_bits) - in ocfs2_block_group_alloc()
734 le16_to_cpu(bg->bg_free_bits_count)); in ocfs2_block_group_alloc()
735 le32_add_cpu(&fe->id1.bitmap1.i_total, le16_to_cpu(bg->bg_bits)); in ocfs2_block_group_alloc()
1259 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_test_bg_bit_allocatable() local
1263 if (ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap)) in ocfs2_test_bg_bit_allocatable()
1271 bg = (struct ocfs2_group_desc *) jh->b_committed_data; in ocfs2_test_bg_bit_allocatable()
1272 if (bg) in ocfs2_test_bg_bit_allocatable()
1273 ret = !ocfs2_test_bit(nr, (unsigned long *)bg->bg_bitmap); in ocfs2_test_bg_bit_allocatable()
1312 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_block_group_find_clear_bits() local
1316 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_find_clear_bits()
1319 bitmap = bg->bg_bitmap; in ocfs2_block_group_find_clear_bits()
1366 struct ocfs2_group_desc *bg, in ocfs2_block_group_set_bits() argument
1374 void *bitmap = bg->bg_bitmap; in ocfs2_block_group_set_bits()
1382 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_set_bits()
1383 BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); in ocfs2_block_group_set_bits()
1399 le16_add_cpu(&bg->bg_free_bits_count, -num_bits); in ocfs2_block_group_set_bits()
1400 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_set_bits()
1402 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_set_bits()
1403 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_set_bits()
1404 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_set_bits()
1415 bg->bg_contig_free_bits = cpu_to_le16(max_contig_bits); in ocfs2_block_group_set_bits()
1424 le16_to_cpu(bg->bg_bits), start); in ocfs2_block_group_set_bits()
1427 bg->bg_contig_free_bits = cpu_to_le16(max_contig_bits); in ocfs2_block_group_set_bits()
1430 bg->bg_contig_free_bits = 0; in ocfs2_block_group_set_bits()
1470 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_relink_block_group() local
1475 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_relink_block_group()
1480 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_relink_block_group()
1483 bg_ptr = le64_to_cpu(bg->bg_next_group); in ocfs2_relink_block_group()
1492 prev_bg->bg_next_group = bg->bg_next_group; in ocfs2_relink_block_group()
1500 bg->bg_next_group = fe->id2.i_chain.cl_recs[chain].c_blkno; in ocfs2_relink_block_group()
1508 fe->id2.i_chain.cl_recs[chain].c_blkno = bg->bg_blkno; in ocfs2_relink_block_group()
1517 bg->bg_next_group = cpu_to_le64(bg_ptr); in ocfs2_relink_block_group()
1523 static inline int ocfs2_block_group_reasonably_empty(struct ocfs2_group_desc *bg, in ocfs2_block_group_reasonably_empty() argument
1526 return le16_to_cpu(bg->bg_free_bits_count) > wanted; in ocfs2_block_group_reasonably_empty()
1608 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_block_group_search() local
1613 if (le16_to_cpu(bg->bg_free_bits_count) >= bits_wanted) { in ocfs2_block_group_search()
1616 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_search()
1619 blkoff = le64_to_cpu(bg->bg_blkno) + in ocfs2_block_group_search()
1694 struct ocfs2_group_desc *bg, in ocfs2_bg_discontig_fix_result() argument
1711 !bg->bg_list.l_next_free_rec) in ocfs2_bg_discontig_fix_result()
1714 for (i = 0; i < le16_to_cpu(bg->bg_list.l_next_free_rec); i++) { in ocfs2_bg_discontig_fix_result()
1715 rec = &bg->bg_list.l_recs[i]; in ocfs2_bg_discontig_fix_result()
1807 struct ocfs2_group_desc *bg; in ocfs2_search_chain() local
1821 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1828 contig_bits = le16_to_cpu(bg->bg_contig_free_bits); in ocfs2_search_chain()
1830 contig_bits = ocfs2_find_max_contig_free_bits(bg->bg_bitmap, in ocfs2_search_chain()
1831 le16_to_cpu(bg->bg_bits), 0); in ocfs2_search_chain()
1841 if (!bg->bg_next_group) in ocfs2_search_chain()
1847 next_group = le64_to_cpu(bg->bg_next_group); in ocfs2_search_chain()
1856 bg = (struct ocfs2_group_desc *) group_bh->b_data; in ocfs2_search_chain()
1865 (unsigned long long)le64_to_cpu(bg->bg_blkno), res->sr_bits); in ocfs2_search_chain()
1867 res->sr_bg_blkno = le64_to_cpu(bg->bg_blkno); in ocfs2_search_chain()
1871 ocfs2_bg_discontig_fix_result(ac, bg, res); in ocfs2_search_chain()
1894 (ocfs2_block_group_reasonably_empty(bg, res->sr_bits))) { in ocfs2_search_chain()
1917 bg, in ocfs2_search_chain()
1935 *bits_left = le16_to_cpu(bg->bg_free_bits_count); in ocfs2_search_chain()
2223 struct ocfs2_group_desc *bg; in ocfs2_claim_new_inode_at_loc() local
2241 bg = (struct ocfs2_group_desc *) bg_bh->b_data; in ocfs2_claim_new_inode_at_loc()
2242 chain = le16_to_cpu(bg->bg_chain); in ocfs2_claim_new_inode_at_loc()
2254 bg, in ocfs2_claim_new_inode_at_loc()
2475 struct ocfs2_group_desc *bg, in ocfs2_block_group_clear_bits() argument
2491 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); in ocfs2_block_group_clear_bits()
2516 (unsigned long *) bg->bg_bitmap); in ocfs2_block_group_clear_bits()
2521 le16_add_cpu(&bg->bg_free_bits_count, num_bits); in ocfs2_block_group_clear_bits()
2522 if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { in ocfs2_block_group_clear_bits()
2526 (unsigned long long)le64_to_cpu(bg->bg_blkno), in ocfs2_block_group_clear_bits()
2527 le16_to_cpu(bg->bg_bits), in ocfs2_block_group_clear_bits()
2528 le16_to_cpu(bg->bg_free_bits_count), in ocfs2_block_group_clear_bits()
2537 contig_bits = ocfs2_find_max_contig_free_bits(bg->bg_bitmap, in ocfs2_block_group_clear_bits()
2538 le16_to_cpu(bg->bg_bits), 0); in ocfs2_block_group_clear_bits()
2541 bg->bg_contig_free_bits = cpu_to_le16(max_contig_bits); in ocfs2_block_group_clear_bits()
2543 bg->bg_contig_free_bits = 0; in ocfs2_block_group_clear_bits()