Lines Matching refs:e4b
441 static void *mb_find_buddy(struct ext4_buddy *e4b, int order, int *max) in mb_find_buddy() argument
445 BUG_ON(e4b->bd_bitmap == e4b->bd_buddy); in mb_find_buddy()
448 if (order > e4b->bd_blkbits + 1) { in mb_find_buddy()
455 *max = 1 << (e4b->bd_blkbits + 3); in mb_find_buddy()
456 return e4b->bd_bitmap; in mb_find_buddy()
459 bb = e4b->bd_buddy + EXT4_SB(e4b->bd_sb)->s_mb_offsets[order]; in mb_find_buddy()
460 *max = EXT4_SB(e4b->bd_sb)->s_mb_maxs[order]; in mb_find_buddy()
466 static void mb_free_blocks_double(struct inode *inode, struct ext4_buddy *e4b, in mb_free_blocks_double() argument
470 struct super_block *sb = e4b->bd_sb; in mb_free_blocks_double()
472 if (unlikely(e4b->bd_info->bb_bitmap == NULL)) in mb_free_blocks_double()
474 assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group)); in mb_free_blocks_double()
476 if (!mb_test_bit(first + i, e4b->bd_info->bb_bitmap)) { in mb_free_blocks_double()
479 blocknr = ext4_group_first_block_no(sb, e4b->bd_group); in mb_free_blocks_double()
481 ext4_grp_locked_error(sb, e4b->bd_group, in mb_free_blocks_double()
488 mb_clear_bit(first + i, e4b->bd_info->bb_bitmap); in mb_free_blocks_double()
492 static void mb_mark_used_double(struct ext4_buddy *e4b, int first, int count) in mb_mark_used_double() argument
496 if (unlikely(e4b->bd_info->bb_bitmap == NULL)) in mb_mark_used_double()
498 assert_spin_locked(ext4_group_lock_ptr(e4b->bd_sb, e4b->bd_group)); in mb_mark_used_double()
500 BUG_ON(mb_test_bit(first + i, e4b->bd_info->bb_bitmap)); in mb_mark_used_double()
501 mb_set_bit(first + i, e4b->bd_info->bb_bitmap); in mb_mark_used_double()
505 static void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap) in mb_cmp_bitmaps() argument
507 if (memcmp(e4b->bd_info->bb_bitmap, bitmap, e4b->bd_sb->s_blocksize)) { in mb_cmp_bitmaps()
510 b1 = (unsigned char *) e4b->bd_info->bb_bitmap; in mb_cmp_bitmaps()
512 for (i = 0; i < e4b->bd_sb->s_blocksize; i++) { in mb_cmp_bitmaps()
514 ext4_msg(e4b->bd_sb, KERN_ERR, in mb_cmp_bitmaps()
518 e4b->bd_group, i, i * 8, b1[i], b2[i]); in mb_cmp_bitmaps()
527 struct ext4_buddy *e4b, int first, int count) in mb_free_blocks_double() argument
531 static inline void mb_mark_used_double(struct ext4_buddy *e4b, in mb_mark_used_double() argument
536 static inline void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap) in mb_cmp_bitmaps() argument
554 static int __mb_check_buddy(struct ext4_buddy *e4b, char *file, in __mb_check_buddy() argument
557 struct super_block *sb = e4b->bd_sb; in __mb_check_buddy()
558 int order = e4b->bd_blkbits + 1; in __mb_check_buddy()
579 buddy = mb_find_buddy(e4b, order, &max); in __mb_check_buddy()
581 buddy2 = mb_find_buddy(e4b, order - 1, &max2); in __mb_check_buddy()
608 !mb_test_bit(k, e4b->bd_bitmap)); in __mb_check_buddy()
612 MB_CHECK_ASSERT(e4b->bd_info->bb_counters[order] == count); in __mb_check_buddy()
617 buddy = mb_find_buddy(e4b, 0, &max); in __mb_check_buddy()
620 MB_CHECK_ASSERT(i >= e4b->bd_info->bb_first_free); in __mb_check_buddy()
629 for (j = 0; j < e4b->bd_blkbits + 1; j++) { in __mb_check_buddy()
630 buddy2 = mb_find_buddy(e4b, j, &max2); in __mb_check_buddy()
636 MB_CHECK_ASSERT(!EXT4_MB_GRP_NEED_INIT(e4b->bd_info)); in __mb_check_buddy()
637 MB_CHECK_ASSERT(e4b->bd_info->bb_fragments == fragments); in __mb_check_buddy()
639 grp = ext4_get_group_info(sb, e4b->bd_group); in __mb_check_buddy()
645 MB_CHECK_ASSERT(groupnr == e4b->bd_group); in __mb_check_buddy()
652 #define mb_check_buddy(e4b) __mb_check_buddy(e4b, \ argument
655 #define mb_check_buddy(e4b) argument
780 static void mb_regenerate_buddy(struct ext4_buddy *e4b) in mb_regenerate_buddy() argument
786 while ((buddy = mb_find_buddy(e4b, order++, &count))) { in mb_regenerate_buddy()
789 e4b->bd_info->bb_fragments = 0; in mb_regenerate_buddy()
790 memset(e4b->bd_info->bb_counters, 0, in mb_regenerate_buddy()
791 sizeof(*e4b->bd_info->bb_counters) * in mb_regenerate_buddy()
792 (e4b->bd_sb->s_blocksize_bits + 2)); in mb_regenerate_buddy()
794 ext4_mb_generate_buddy(e4b->bd_sb, e4b->bd_buddy, in mb_regenerate_buddy()
795 e4b->bd_bitmap, e4b->bd_group); in mb_regenerate_buddy()
986 ext4_group_t group, struct ext4_buddy *e4b, gfp_t gfp) in ext4_mb_get_buddy_page_lock() argument
993 e4b->bd_buddy_page = NULL; in ext4_mb_get_buddy_page_lock()
994 e4b->bd_bitmap_page = NULL; in ext4_mb_get_buddy_page_lock()
1009 e4b->bd_bitmap_page = page; in ext4_mb_get_buddy_page_lock()
1010 e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize); in ext4_mb_get_buddy_page_lock()
1023 e4b->bd_buddy_page = page; in ext4_mb_get_buddy_page_lock()
1027 static void ext4_mb_put_buddy_page_lock(struct ext4_buddy *e4b) in ext4_mb_put_buddy_page_lock() argument
1029 if (e4b->bd_bitmap_page) { in ext4_mb_put_buddy_page_lock()
1030 unlock_page(e4b->bd_bitmap_page); in ext4_mb_put_buddy_page_lock()
1031 put_page(e4b->bd_bitmap_page); in ext4_mb_put_buddy_page_lock()
1033 if (e4b->bd_buddy_page) { in ext4_mb_put_buddy_page_lock()
1034 unlock_page(e4b->bd_buddy_page); in ext4_mb_put_buddy_page_lock()
1035 put_page(e4b->bd_buddy_page); in ext4_mb_put_buddy_page_lock()
1049 struct ext4_buddy e4b; in ext4_mb_init_group() local
1065 ret = ext4_mb_get_buddy_page_lock(sb, group, &e4b, gfp); in ext4_mb_init_group()
1074 page = e4b.bd_bitmap_page; in ext4_mb_init_group()
1083 if (e4b.bd_buddy_page == NULL) { in ext4_mb_init_group()
1093 page = e4b.bd_buddy_page; in ext4_mb_init_group()
1094 ret = ext4_mb_init_cache(page, e4b.bd_bitmap, gfp); in ext4_mb_init_group()
1102 ext4_mb_put_buddy_page_lock(&e4b); in ext4_mb_init_group()
1113 struct ext4_buddy *e4b, gfp_t gfp) in ext4_mb_load_buddy_gfp() argument
1131 e4b->bd_blkbits = sb->s_blocksize_bits; in ext4_mb_load_buddy_gfp()
1132 e4b->bd_info = grp; in ext4_mb_load_buddy_gfp()
1133 e4b->bd_sb = sb; in ext4_mb_load_buddy_gfp()
1134 e4b->bd_group = group; in ext4_mb_load_buddy_gfp()
1135 e4b->bd_buddy_page = NULL; in ext4_mb_load_buddy_gfp()
1136 e4b->bd_bitmap_page = NULL; in ext4_mb_load_buddy_gfp()
1180 mb_cmp_bitmaps(e4b, page_address(page) + in ext4_mb_load_buddy_gfp()
1196 e4b->bd_bitmap_page = page; in ext4_mb_load_buddy_gfp()
1197 e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize); in ext4_mb_load_buddy_gfp()
1211 ret = ext4_mb_init_cache(page, e4b->bd_bitmap, in ext4_mb_load_buddy_gfp()
1231 e4b->bd_buddy_page = page; in ext4_mb_load_buddy_gfp()
1232 e4b->bd_buddy = page_address(page) + (poff * sb->s_blocksize); in ext4_mb_load_buddy_gfp()
1234 BUG_ON(e4b->bd_bitmap_page == NULL); in ext4_mb_load_buddy_gfp()
1235 BUG_ON(e4b->bd_buddy_page == NULL); in ext4_mb_load_buddy_gfp()
1242 if (e4b->bd_bitmap_page) in ext4_mb_load_buddy_gfp()
1243 put_page(e4b->bd_bitmap_page); in ext4_mb_load_buddy_gfp()
1244 if (e4b->bd_buddy_page) in ext4_mb_load_buddy_gfp()
1245 put_page(e4b->bd_buddy_page); in ext4_mb_load_buddy_gfp()
1246 e4b->bd_buddy = NULL; in ext4_mb_load_buddy_gfp()
1247 e4b->bd_bitmap = NULL; in ext4_mb_load_buddy_gfp()
1252 struct ext4_buddy *e4b) in ext4_mb_load_buddy() argument
1254 return ext4_mb_load_buddy_gfp(sb, group, e4b, GFP_NOFS); in ext4_mb_load_buddy()
1257 static void ext4_mb_unload_buddy(struct ext4_buddy *e4b) in ext4_mb_unload_buddy() argument
1259 if (e4b->bd_bitmap_page) in ext4_mb_unload_buddy()
1260 put_page(e4b->bd_bitmap_page); in ext4_mb_unload_buddy()
1261 if (e4b->bd_buddy_page) in ext4_mb_unload_buddy()
1262 put_page(e4b->bd_buddy_page); in ext4_mb_unload_buddy()
1266 static int mb_find_order_for_block(struct ext4_buddy *e4b, int block) in mb_find_order_for_block() argument
1269 int bb_incr = 1 << (e4b->bd_blkbits - 1); in mb_find_order_for_block()
1272 BUG_ON(e4b->bd_bitmap == e4b->bd_buddy); in mb_find_order_for_block()
1273 BUG_ON(block >= (1 << (e4b->bd_blkbits + 3))); in mb_find_order_for_block()
1275 bb = e4b->bd_buddy; in mb_find_order_for_block()
1276 while (order <= e4b->bd_blkbits + 1) { in mb_find_order_for_block()
1369 static void mb_buddy_mark_free(struct ext4_buddy *e4b, int first, int last) in mb_buddy_mark_free() argument
1373 void *buddy = mb_find_buddy(e4b, order, &max); in mb_buddy_mark_free()
1408 e4b->bd_info->bb_counters[order] += mb_buddy_adjust_border(&first, buddy, -1); in mb_buddy_mark_free()
1410 e4b->bd_info->bb_counters[order] += mb_buddy_adjust_border(&last, buddy, 1); in mb_buddy_mark_free()
1415 if (first == last || !(buddy2 = mb_find_buddy(e4b, order, &max))) { in mb_buddy_mark_free()
1417 e4b->bd_info->bb_counters[order - 1] += last - first + 1; in mb_buddy_mark_free()
1426 static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, in mb_free_blocks() argument
1433 struct super_block *sb = e4b->bd_sb; in mb_free_blocks()
1438 assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group)); in mb_free_blocks()
1440 if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) in mb_free_blocks()
1443 mb_check_buddy(e4b); in mb_free_blocks()
1444 mb_free_blocks_double(inode, e4b, first, count); in mb_free_blocks()
1446 e4b->bd_info->bb_free += count; in mb_free_blocks()
1447 if (first < e4b->bd_info->bb_first_free) in mb_free_blocks()
1448 e4b->bd_info->bb_first_free = first; in mb_free_blocks()
1454 left_is_free = !mb_test_bit(first - 1, e4b->bd_bitmap); in mb_free_blocks()
1455 block = mb_test_and_clear_bits(e4b->bd_bitmap, first, count); in mb_free_blocks()
1457 right_is_free = !mb_test_bit(last + 1, e4b->bd_bitmap); in mb_free_blocks()
1463 blocknr = ext4_group_first_block_no(sb, e4b->bd_group); in mb_free_blocks()
1465 ext4_grp_locked_error(sb, e4b->bd_group, in mb_free_blocks()
1471 if (!EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info)) in mb_free_blocks()
1473 e4b->bd_info->bb_free); in mb_free_blocks()
1476 &e4b->bd_info->bb_state); in mb_free_blocks()
1477 mb_regenerate_buddy(e4b); in mb_free_blocks()
1483 e4b->bd_info->bb_fragments--; in mb_free_blocks()
1485 e4b->bd_info->bb_fragments++; in mb_free_blocks()
1495 e4b->bd_info->bb_counters[0] += left_is_free ? -1 : 1; in mb_free_blocks()
1499 e4b->bd_info->bb_counters[0] += right_is_free ? -1 : 1; in mb_free_blocks()
1503 mb_buddy_mark_free(e4b, first >> 1, last >> 1); in mb_free_blocks()
1506 mb_set_largest_free_order(sb, e4b->bd_info); in mb_free_blocks()
1507 mb_check_buddy(e4b); in mb_free_blocks()
1510 static int mb_find_extent(struct ext4_buddy *e4b, int block, in mb_find_extent() argument
1517 assert_spin_locked(ext4_group_lock_ptr(e4b->bd_sb, e4b->bd_group)); in mb_find_extent()
1520 buddy = mb_find_buddy(e4b, 0, &max); in mb_find_extent()
1531 order = mb_find_order_for_block(e4b, block); in mb_find_extent()
1536 ex->fe_group = e4b->bd_group; in mb_find_extent()
1544 mb_find_buddy(e4b, order, &max)) { in mb_find_extent()
1550 if (mb_test_bit(next, e4b->bd_bitmap)) in mb_find_extent()
1553 order = mb_find_order_for_block(e4b, next); in mb_find_extent()
1559 BUG_ON(ex->fe_start + ex->fe_len > (1 << (e4b->bd_blkbits + 3))); in mb_find_extent()
1563 static int mb_mark_used(struct ext4_buddy *e4b, struct ext4_free_extent *ex) in mb_mark_used() argument
1575 BUG_ON(start + len > (e4b->bd_sb->s_blocksize << 3)); in mb_mark_used()
1576 BUG_ON(e4b->bd_group != ex->fe_group); in mb_mark_used()
1577 assert_spin_locked(ext4_group_lock_ptr(e4b->bd_sb, e4b->bd_group)); in mb_mark_used()
1578 mb_check_buddy(e4b); in mb_mark_used()
1579 mb_mark_used_double(e4b, start, len); in mb_mark_used()
1581 e4b->bd_info->bb_free -= len; in mb_mark_used()
1582 if (e4b->bd_info->bb_first_free == start) in mb_mark_used()
1583 e4b->bd_info->bb_first_free += len; in mb_mark_used()
1587 mlen = !mb_test_bit(start - 1, e4b->bd_bitmap); in mb_mark_used()
1588 if (start + len < EXT4_SB(e4b->bd_sb)->s_mb_maxs[0]) in mb_mark_used()
1589 max = !mb_test_bit(start + len, e4b->bd_bitmap); in mb_mark_used()
1591 e4b->bd_info->bb_fragments++; in mb_mark_used()
1593 e4b->bd_info->bb_fragments--; in mb_mark_used()
1597 ord = mb_find_order_for_block(e4b, start); in mb_mark_used()
1602 buddy = mb_find_buddy(e4b, ord, &max); in mb_mark_used()
1605 e4b->bd_info->bb_counters[ord]--; in mb_mark_used()
1618 buddy = mb_find_buddy(e4b, ord, &max); in mb_mark_used()
1620 e4b->bd_info->bb_counters[ord]--; in mb_mark_used()
1624 buddy = mb_find_buddy(e4b, ord, &max); in mb_mark_used()
1627 e4b->bd_info->bb_counters[ord]++; in mb_mark_used()
1628 e4b->bd_info->bb_counters[ord]++; in mb_mark_used()
1630 mb_set_largest_free_order(e4b->bd_sb, e4b->bd_info); in mb_mark_used()
1632 ext4_set_bits(e4b->bd_bitmap, ex->fe_start, len0); in mb_mark_used()
1633 mb_check_buddy(e4b); in mb_mark_used()
1642 struct ext4_buddy *e4b) in ext4_mb_use_best_found() argument
1647 BUG_ON(ac->ac_b_ex.fe_group != e4b->bd_group); in ext4_mb_use_best_found()
1652 ret = mb_mark_used(e4b, &ac->ac_b_ex); in ext4_mb_use_best_found()
1669 ac->ac_bitmap_page = e4b->bd_bitmap_page; in ext4_mb_use_best_found()
1671 ac->ac_buddy_page = e4b->bd_buddy_page; in ext4_mb_use_best_found()
1687 struct ext4_buddy *e4b, in ext4_mb_check_limits() argument
1714 && bex->fe_group == e4b->bd_group) { in ext4_mb_check_limits()
1718 max = mb_find_extent(e4b, bex->fe_start, gex->fe_len, &ex); in ext4_mb_check_limits()
1720 ext4_mb_use_best_found(ac, e4b); in ext4_mb_check_limits()
1738 struct ext4_buddy *e4b) in ext4_mb_measure_extent() argument
1755 ext4_mb_use_best_found(ac, e4b); in ext4_mb_measure_extent()
1764 ext4_mb_use_best_found(ac, e4b); in ext4_mb_measure_extent()
1792 ext4_mb_check_limits(ac, e4b, 0); in ext4_mb_measure_extent()
1797 struct ext4_buddy *e4b) in ext4_mb_try_best_found() argument
1805 err = ext4_mb_load_buddy(ac->ac_sb, group, e4b); in ext4_mb_try_best_found()
1810 max = mb_find_extent(e4b, ex.fe_start, ex.fe_len, &ex); in ext4_mb_try_best_found()
1814 ext4_mb_use_best_found(ac, e4b); in ext4_mb_try_best_found()
1818 ext4_mb_unload_buddy(e4b); in ext4_mb_try_best_found()
1825 struct ext4_buddy *e4b) in ext4_mb_find_by_goal() argument
1839 err = ext4_mb_load_buddy(ac->ac_sb, group, e4b); in ext4_mb_find_by_goal()
1843 if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) { in ext4_mb_find_by_goal()
1844 ext4_mb_unload_buddy(e4b); in ext4_mb_find_by_goal()
1849 max = mb_find_extent(e4b, ac->ac_g_ex.fe_start, in ext4_mb_find_by_goal()
1856 start = ext4_group_first_block_no(ac->ac_sb, e4b->bd_group) + in ext4_mb_find_by_goal()
1862 ext4_mb_use_best_found(ac, e4b); in ext4_mb_find_by_goal()
1870 ext4_mb_use_best_found(ac, e4b); in ext4_mb_find_by_goal()
1879 ext4_mb_use_best_found(ac, e4b); in ext4_mb_find_by_goal()
1882 ext4_mb_unload_buddy(e4b); in ext4_mb_find_by_goal()
1893 struct ext4_buddy *e4b) in ext4_mb_simple_scan_group() argument
1896 struct ext4_group_info *grp = e4b->bd_info; in ext4_mb_simple_scan_group()
1907 buddy = mb_find_buddy(e4b, i, &max); in ext4_mb_simple_scan_group()
1917 ac->ac_b_ex.fe_group = e4b->bd_group; in ext4_mb_simple_scan_group()
1919 ext4_mb_use_best_found(ac, e4b); in ext4_mb_simple_scan_group()
1937 struct ext4_buddy *e4b) in ext4_mb_complex_scan_group() argument
1940 void *bitmap = e4b->bd_bitmap; in ext4_mb_complex_scan_group()
1945 free = e4b->bd_info->bb_free; in ext4_mb_complex_scan_group()
1948 i = e4b->bd_info->bb_first_free; in ext4_mb_complex_scan_group()
1959 ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, in ext4_mb_complex_scan_group()
1966 mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); in ext4_mb_complex_scan_group()
1969 ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, in ext4_mb_complex_scan_group()
1981 ext4_mb_measure_extent(ac, &ex, e4b); in ext4_mb_complex_scan_group()
1987 ext4_mb_check_limits(ac, e4b, 1); in ext4_mb_complex_scan_group()
1996 struct ext4_buddy *e4b) in ext4_mb_scan_aligned() argument
2000 void *bitmap = e4b->bd_bitmap; in ext4_mb_scan_aligned()
2010 first_group_block = ext4_group_first_block_no(sb, e4b->bd_group); in ext4_mb_scan_aligned()
2018 max = mb_find_extent(e4b, i, sbi->s_stripe, &ex); in ext4_mb_scan_aligned()
2023 ext4_mb_use_best_found(ac, e4b); in ext4_mb_scan_aligned()
2109 struct ext4_buddy e4b; in ext4_mb_regular_allocator() local
2121 err = ext4_mb_find_by_goal(ac, &e4b); in ext4_mb_regular_allocator()
2192 err = ext4_mb_load_buddy(sb, group, &e4b); in ext4_mb_regular_allocator()
2205 ext4_mb_unload_buddy(&e4b); in ext4_mb_regular_allocator()
2213 ext4_mb_simple_scan_group(ac, &e4b); in ext4_mb_regular_allocator()
2216 ext4_mb_scan_aligned(ac, &e4b); in ext4_mb_regular_allocator()
2218 ext4_mb_complex_scan_group(ac, &e4b); in ext4_mb_regular_allocator()
2221 ext4_mb_unload_buddy(&e4b); in ext4_mb_regular_allocator()
2235 ext4_mb_try_best_found(ac, &e4b); in ext4_mb_regular_allocator()
2288 struct ext4_buddy e4b; in ext4_mb_seq_groups_show() local
2306 err = ext4_mb_load_buddy(sb, group, &e4b); in ext4_mb_seq_groups_show()
2317 ext4_mb_unload_buddy(&e4b); in ext4_mb_seq_groups_show()
2797 struct ext4_buddy e4b; in ext4_free_data_callback() local
2816 err = ext4_mb_load_buddy(sb, entry->efd_group, &e4b); in ext4_free_data_callback()
2824 db = e4b.bd_info; in ext4_free_data_callback()
2831 mb_free_blocks(NULL, &e4b, entry->efd_start_cluster, entry->efd_count); in ext4_free_data_callback()
2846 put_page(e4b.bd_buddy_page); in ext4_free_data_callback()
2847 put_page(e4b.bd_bitmap_page); in ext4_free_data_callback()
2851 ext4_mb_unload_buddy(&e4b); in ext4_free_data_callback()
3262 struct ext4_buddy e4b; in ext4_discard_allocated_blocks() local
3268 err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b); in ext4_discard_allocated_blocks()
3279 mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start, in ext4_discard_allocated_blocks()
3282 ext4_mb_unload_buddy(&e4b); in ext4_discard_allocated_blocks()
3771 ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh, in ext4_mb_release_inode_pa() argument
3774 struct super_block *sb = e4b->bd_sb; in ext4_mb_release_inode_pa()
3787 BUG_ON(group != e4b->bd_group && pa->pa_len != 0); in ext4_mb_release_inode_pa()
3804 mb_free_blocks(pa->pa_inode, e4b, bit, next - bit); in ext4_mb_release_inode_pa()
3808 ext4_msg(e4b->bd_sb, KERN_CRIT, in ext4_mb_release_inode_pa()
3826 ext4_mb_release_group_pa(struct ext4_buddy *e4b, in ext4_mb_release_group_pa() argument
3829 struct super_block *sb = e4b->bd_sb; in ext4_mb_release_group_pa()
3836 BUG_ON(group != e4b->bd_group && pa->pa_len != 0); in ext4_mb_release_group_pa()
3837 mb_free_blocks(pa->pa_inode, e4b, bit, pa->pa_len); in ext4_mb_release_group_pa()
3861 struct ext4_buddy e4b; in ext4_mb_discard_group_preallocations() local
3879 err = ext4_mb_load_buddy(sb, group, &e4b); in ext4_mb_discard_group_preallocations()
3941 ext4_mb_release_group_pa(&e4b, pa); in ext4_mb_discard_group_preallocations()
3943 ext4_mb_release_inode_pa(&e4b, bitmap_bh, pa); in ext4_mb_discard_group_preallocations()
3951 ext4_mb_unload_buddy(&e4b); in ext4_mb_discard_group_preallocations()
3973 struct ext4_buddy e4b; in ext4_discard_preallocations() local
4039 err = ext4_mb_load_buddy_gfp(sb, group, &e4b, in ext4_discard_preallocations()
4052 ext4_mb_unload_buddy(&e4b); in ext4_discard_preallocations()
4058 ext4_mb_release_inode_pa(&e4b, bitmap_bh, pa); in ext4_discard_preallocations()
4061 ext4_mb_unload_buddy(&e4b); in ext4_discard_preallocations()
4250 struct ext4_buddy e4b; in ext4_mb_discard_lg_preallocations() local
4302 err = ext4_mb_load_buddy_gfp(sb, group, &e4b, in ext4_mb_discard_lg_preallocations()
4311 ext4_mb_release_group_pa(&e4b, pa); in ext4_mb_discard_lg_preallocations()
4314 ext4_mb_unload_buddy(&e4b); in ext4_mb_discard_lg_preallocations()
4588 ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b, in ext4_mb_free_metadata() argument
4591 ext4_group_t group = e4b->bd_group; in ext4_mb_free_metadata()
4595 struct ext4_group_info *db = e4b->bd_info; in ext4_mb_free_metadata()
4596 struct super_block *sb = e4b->bd_sb; in ext4_mb_free_metadata()
4602 BUG_ON(e4b->bd_bitmap_page == NULL); in ext4_mb_free_metadata()
4603 BUG_ON(e4b->bd_buddy_page == NULL); in ext4_mb_free_metadata()
4614 get_page(e4b->bd_buddy_page); in ext4_mb_free_metadata()
4615 get_page(e4b->bd_bitmap_page); in ext4_mb_free_metadata()
4688 struct ext4_buddy e4b; in ext4_free_blocks() local
4830 err = ext4_mb_load_buddy_gfp(sb, block_group, &e4b, in ext4_free_blocks()
4858 ext4_mb_free_metadata(handle, &e4b, new_entry); in ext4_free_blocks()
4873 EXT4_MB_GRP_CLEAR_TRIMMED(e4b.bd_info); in ext4_free_blocks()
4877 mb_free_blocks(inode, &e4b, bit, count_clusters); in ext4_free_blocks()
4896 ext4_mb_unload_buddy(&e4b); in ext4_free_blocks()
4939 struct ext4_buddy e4b; in ext4_group_add_blocks() local
5011 err = ext4_mb_load_buddy(sb, block_group, &e4b); in ext4_group_add_blocks()
5022 mb_free_blocks(NULL, &e4b, bit, count); in ext4_group_add_blocks()
5037 ext4_mb_unload_buddy(&e4b); in ext4_group_add_blocks()
5069 ext4_group_t group, struct ext4_buddy *e4b, in ext4_trim_extent() argument
5089 mb_mark_used(e4b, &ex); in ext4_trim_extent()
5093 mb_free_blocks(NULL, e4b, start, ex.fe_len); in ext4_trim_extent()
5123 struct ext4_buddy e4b; in ext4_trim_all_free() local
5128 ret = ext4_mb_load_buddy(sb, group, &e4b); in ext4_trim_all_free()
5134 bitmap = e4b.bd_bitmap; in ext4_trim_all_free()
5137 if (EXT4_MB_GRP_WAS_TRIMMED(e4b.bd_info) && in ext4_trim_all_free()
5141 start = (e4b.bd_info->bb_first_free > start) ? in ext4_trim_all_free()
5142 e4b.bd_info->bb_first_free : start; in ext4_trim_all_free()
5152 next - start, group, &e4b, in ext4_trim_all_free()
5173 if ((e4b.bd_info->bb_free - free_count) < minblocks) in ext4_trim_all_free()
5179 EXT4_MB_GRP_SET_TRIMMED(e4b.bd_info); in ext4_trim_all_free()
5183 ext4_mb_unload_buddy(&e4b); in ext4_trim_all_free()