Lines Matching refs:e4b

415 		struct ext4_buddy *e4b, ext4_grpblk_t start,
515 static void *mb_find_buddy(struct ext4_buddy *e4b, int order, int *max) in mb_find_buddy() argument
519 BUG_ON(e4b->bd_bitmap == e4b->bd_buddy); in mb_find_buddy()
522 if (order > e4b->bd_blkbits + 1) { in mb_find_buddy()
529 *max = 1 << (e4b->bd_blkbits + 3); in mb_find_buddy()
530 return e4b->bd_bitmap; in mb_find_buddy()
533 bb = e4b->bd_buddy + EXT4_SB(e4b->bd_sb)->s_mb_offsets[order]; in mb_find_buddy()
534 *max = EXT4_SB(e4b->bd_sb)->s_mb_maxs[order]; in mb_find_buddy()
540 static void mb_free_blocks_double(struct inode *inode, struct ext4_buddy *e4b, in mb_free_blocks_double() argument
544 struct super_block *sb = e4b->bd_sb; in mb_free_blocks_double()
546 if (unlikely(e4b->bd_info->bb_bitmap == NULL)) in mb_free_blocks_double()
548 assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group)); in mb_free_blocks_double()
550 if (!mb_test_bit(first + i, e4b->bd_info->bb_bitmap)) { in mb_free_blocks_double()
553 blocknr = ext4_group_first_block_no(sb, e4b->bd_group); in mb_free_blocks_double()
555 ext4_grp_locked_error(sb, e4b->bd_group, in mb_free_blocks_double()
561 ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group, in mb_free_blocks_double()
564 mb_clear_bit(first + i, e4b->bd_info->bb_bitmap); in mb_free_blocks_double()
568 static void mb_mark_used_double(struct ext4_buddy *e4b, int first, int count) in mb_mark_used_double() argument
572 if (unlikely(e4b->bd_info->bb_bitmap == NULL)) in mb_mark_used_double()
574 assert_spin_locked(ext4_group_lock_ptr(e4b->bd_sb, e4b->bd_group)); in mb_mark_used_double()
576 BUG_ON(mb_test_bit(first + i, e4b->bd_info->bb_bitmap)); in mb_mark_used_double()
577 mb_set_bit(first + i, e4b->bd_info->bb_bitmap); in mb_mark_used_double()
581 static void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap) in mb_cmp_bitmaps() argument
583 if (unlikely(e4b->bd_info->bb_bitmap == NULL)) in mb_cmp_bitmaps()
585 if (memcmp(e4b->bd_info->bb_bitmap, bitmap, e4b->bd_sb->s_blocksize)) { in mb_cmp_bitmaps()
588 b1 = (unsigned char *) e4b->bd_info->bb_bitmap; in mb_cmp_bitmaps()
590 for (i = 0; i < e4b->bd_sb->s_blocksize; i++) { in mb_cmp_bitmaps()
592 ext4_msg(e4b->bd_sb, KERN_ERR, in mb_cmp_bitmaps()
596 e4b->bd_group, i, i * 8, b1[i], b2[i]); in mb_cmp_bitmaps()
630 struct ext4_buddy *e4b, int first, int count) in mb_free_blocks_double() argument
634 static inline void mb_mark_used_double(struct ext4_buddy *e4b, in mb_mark_used_double() argument
639 static inline void mb_cmp_bitmaps(struct ext4_buddy *e4b, void *bitmap) in mb_cmp_bitmaps() argument
668 static int __mb_check_buddy(struct ext4_buddy *e4b, char *file, in __mb_check_buddy() argument
671 struct super_block *sb = e4b->bd_sb; in __mb_check_buddy()
672 int order = e4b->bd_blkbits + 1; in __mb_check_buddy()
686 if (e4b->bd_info->bb_check_counter++ % 10) in __mb_check_buddy()
690 buddy = mb_find_buddy(e4b, order, &max); in __mb_check_buddy()
692 buddy2 = mb_find_buddy(e4b, order - 1, &max2); in __mb_check_buddy()
716 !mb_test_bit(k, e4b->bd_bitmap)); in __mb_check_buddy()
720 MB_CHECK_ASSERT(e4b->bd_info->bb_counters[order] == count); in __mb_check_buddy()
725 buddy = mb_find_buddy(e4b, 0, &max); in __mb_check_buddy()
728 MB_CHECK_ASSERT(i >= e4b->bd_info->bb_first_free); in __mb_check_buddy()
737 for (j = 0; j < e4b->bd_blkbits + 1; j++) { in __mb_check_buddy()
738 buddy2 = mb_find_buddy(e4b, j, &max2); in __mb_check_buddy()
744 MB_CHECK_ASSERT(!EXT4_MB_GRP_NEED_INIT(e4b->bd_info)); in __mb_check_buddy()
745 MB_CHECK_ASSERT(e4b->bd_info->bb_fragments == fragments); in __mb_check_buddy()
747 grp = ext4_get_group_info(sb, e4b->bd_group); in __mb_check_buddy()
753 MB_CHECK_ASSERT(groupnr == e4b->bd_group); in __mb_check_buddy()
760 #define mb_check_buddy(e4b) __mb_check_buddy(e4b, \ argument
763 #define mb_check_buddy(e4b) argument
1305 ext4_group_t group, struct ext4_buddy *e4b, gfp_t gfp) in ext4_mb_get_buddy_page_lock() argument
1312 e4b->bd_buddy_page = NULL; in ext4_mb_get_buddy_page_lock()
1313 e4b->bd_bitmap_page = NULL; in ext4_mb_get_buddy_page_lock()
1328 e4b->bd_bitmap_page = page; in ext4_mb_get_buddy_page_lock()
1329 e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize); in ext4_mb_get_buddy_page_lock()
1342 e4b->bd_buddy_page = page; in ext4_mb_get_buddy_page_lock()
1346 static void ext4_mb_put_buddy_page_lock(struct ext4_buddy *e4b) in ext4_mb_put_buddy_page_lock() argument
1348 if (e4b->bd_bitmap_page) { in ext4_mb_put_buddy_page_lock()
1349 unlock_page(e4b->bd_bitmap_page); in ext4_mb_put_buddy_page_lock()
1350 put_page(e4b->bd_bitmap_page); in ext4_mb_put_buddy_page_lock()
1352 if (e4b->bd_buddy_page) { in ext4_mb_put_buddy_page_lock()
1353 unlock_page(e4b->bd_buddy_page); in ext4_mb_put_buddy_page_lock()
1354 put_page(e4b->bd_buddy_page); in ext4_mb_put_buddy_page_lock()
1368 struct ext4_buddy e4b; in ext4_mb_init_group() local
1384 ret = ext4_mb_get_buddy_page_lock(sb, group, &e4b, gfp); in ext4_mb_init_group()
1393 page = e4b.bd_bitmap_page; in ext4_mb_init_group()
1402 if (e4b.bd_buddy_page == NULL) { in ext4_mb_init_group()
1412 page = e4b.bd_buddy_page; in ext4_mb_init_group()
1413 ret = ext4_mb_init_cache(page, e4b.bd_bitmap, gfp); in ext4_mb_init_group()
1421 ext4_mb_put_buddy_page_lock(&e4b); in ext4_mb_init_group()
1432 struct ext4_buddy *e4b, gfp_t gfp) in ext4_mb_load_buddy_gfp() argument
1450 e4b->bd_blkbits = sb->s_blocksize_bits; in ext4_mb_load_buddy_gfp()
1451 e4b->bd_info = grp; in ext4_mb_load_buddy_gfp()
1452 e4b->bd_sb = sb; in ext4_mb_load_buddy_gfp()
1453 e4b->bd_group = group; in ext4_mb_load_buddy_gfp()
1454 e4b->bd_buddy_page = NULL; in ext4_mb_load_buddy_gfp()
1455 e4b->bd_bitmap_page = NULL; in ext4_mb_load_buddy_gfp()
1499 mb_cmp_bitmaps(e4b, page_address(page) + in ext4_mb_load_buddy_gfp()
1515 e4b->bd_bitmap_page = page; in ext4_mb_load_buddy_gfp()
1516 e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize); in ext4_mb_load_buddy_gfp()
1530 ret = ext4_mb_init_cache(page, e4b->bd_bitmap, in ext4_mb_load_buddy_gfp()
1550 e4b->bd_buddy_page = page; in ext4_mb_load_buddy_gfp()
1551 e4b->bd_buddy = page_address(page) + (poff * sb->s_blocksize); in ext4_mb_load_buddy_gfp()
1558 if (e4b->bd_bitmap_page) in ext4_mb_load_buddy_gfp()
1559 put_page(e4b->bd_bitmap_page); in ext4_mb_load_buddy_gfp()
1560 if (e4b->bd_buddy_page) in ext4_mb_load_buddy_gfp()
1561 put_page(e4b->bd_buddy_page); in ext4_mb_load_buddy_gfp()
1562 e4b->bd_buddy = NULL; in ext4_mb_load_buddy_gfp()
1563 e4b->bd_bitmap = NULL; in ext4_mb_load_buddy_gfp()
1568 struct ext4_buddy *e4b) in ext4_mb_load_buddy() argument
1570 return ext4_mb_load_buddy_gfp(sb, group, e4b, GFP_NOFS); in ext4_mb_load_buddy()
1573 static void ext4_mb_unload_buddy(struct ext4_buddy *e4b) in ext4_mb_unload_buddy() argument
1575 if (e4b->bd_bitmap_page) in ext4_mb_unload_buddy()
1576 put_page(e4b->bd_bitmap_page); in ext4_mb_unload_buddy()
1577 if (e4b->bd_buddy_page) in ext4_mb_unload_buddy()
1578 put_page(e4b->bd_buddy_page); in ext4_mb_unload_buddy()
1582 static int mb_find_order_for_block(struct ext4_buddy *e4b, int block) in mb_find_order_for_block() argument
1587 BUG_ON(e4b->bd_bitmap == e4b->bd_buddy); in mb_find_order_for_block()
1588 BUG_ON(block >= (1 << (e4b->bd_blkbits + 3))); in mb_find_order_for_block()
1590 while (order <= e4b->bd_blkbits + 1) { in mb_find_order_for_block()
1591 bb = mb_find_buddy(e4b, order, &max); in mb_find_order_for_block()
1678 static void mb_buddy_mark_free(struct ext4_buddy *e4b, int first, int last) in mb_buddy_mark_free() argument
1682 void *buddy = mb_find_buddy(e4b, order, &max); in mb_buddy_mark_free()
1717 e4b->bd_info->bb_counters[order] += mb_buddy_adjust_border(&first, buddy, -1); in mb_buddy_mark_free()
1719 e4b->bd_info->bb_counters[order] += mb_buddy_adjust_border(&last, buddy, 1); in mb_buddy_mark_free()
1724 if (first == last || !(buddy2 = mb_find_buddy(e4b, order, &max))) { in mb_buddy_mark_free()
1726 e4b->bd_info->bb_counters[order - 1] += last - first + 1; in mb_buddy_mark_free()
1735 static void mb_free_blocks(struct inode *inode, struct ext4_buddy *e4b, in mb_free_blocks() argument
1742 struct super_block *sb = e4b->bd_sb; in mb_free_blocks()
1747 assert_spin_locked(ext4_group_lock_ptr(sb, e4b->bd_group)); in mb_free_blocks()
1749 if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) in mb_free_blocks()
1752 mb_check_buddy(e4b); in mb_free_blocks()
1753 mb_free_blocks_double(inode, e4b, first, count); in mb_free_blocks()
1756 e4b->bd_info->bb_free += count; in mb_free_blocks()
1757 if (first < e4b->bd_info->bb_first_free) in mb_free_blocks()
1758 e4b->bd_info->bb_first_free = first; in mb_free_blocks()
1764 left_is_free = !mb_test_bit(first - 1, e4b->bd_bitmap); in mb_free_blocks()
1765 block = mb_test_and_clear_bits(e4b->bd_bitmap, first, count); in mb_free_blocks()
1767 right_is_free = !mb_test_bit(last + 1, e4b->bd_bitmap); in mb_free_blocks()
1773 blocknr = ext4_group_first_block_no(sb, e4b->bd_group); in mb_free_blocks()
1776 ext4_grp_locked_error(sb, e4b->bd_group, in mb_free_blocks()
1782 sb, e4b->bd_group, in mb_free_blocks()
1790 e4b->bd_info->bb_fragments--; in mb_free_blocks()
1792 e4b->bd_info->bb_fragments++; in mb_free_blocks()
1802 e4b->bd_info->bb_counters[0] += left_is_free ? -1 : 1; in mb_free_blocks()
1806 e4b->bd_info->bb_counters[0] += right_is_free ? -1 : 1; in mb_free_blocks()
1810 mb_buddy_mark_free(e4b, first >> 1, last >> 1); in mb_free_blocks()
1813 mb_set_largest_free_order(sb, e4b->bd_info); in mb_free_blocks()
1814 mb_update_avg_fragment_size(sb, e4b->bd_info); in mb_free_blocks()
1815 mb_check_buddy(e4b); in mb_free_blocks()
1818 static int mb_find_extent(struct ext4_buddy *e4b, int block, in mb_find_extent() argument
1825 assert_spin_locked(ext4_group_lock_ptr(e4b->bd_sb, e4b->bd_group)); in mb_find_extent()
1828 buddy = mb_find_buddy(e4b, 0, &max); in mb_find_extent()
1839 order = mb_find_order_for_block(e4b, block); in mb_find_extent()
1844 ex->fe_group = e4b->bd_group; in mb_find_extent()
1852 mb_find_buddy(e4b, order, &max)) { in mb_find_extent()
1858 if (mb_test_bit(next, e4b->bd_bitmap)) in mb_find_extent()
1861 order = mb_find_order_for_block(e4b, next); in mb_find_extent()
1867 if (ex->fe_start + ex->fe_len > EXT4_CLUSTERS_PER_GROUP(e4b->bd_sb)) { in mb_find_extent()
1870 ext4_grp_locked_error(e4b->bd_sb, e4b->bd_group, 0, 0, in mb_find_extent()
1882 static int mb_mark_used(struct ext4_buddy *e4b, struct ext4_free_extent *ex) in mb_mark_used() argument
1895 BUG_ON(start + len > (e4b->bd_sb->s_blocksize << 3)); in mb_mark_used()
1896 BUG_ON(e4b->bd_group != ex->fe_group); in mb_mark_used()
1897 assert_spin_locked(ext4_group_lock_ptr(e4b->bd_sb, e4b->bd_group)); in mb_mark_used()
1898 mb_check_buddy(e4b); in mb_mark_used()
1899 mb_mark_used_double(e4b, start, len); in mb_mark_used()
1902 e4b->bd_info->bb_free -= len; in mb_mark_used()
1903 if (e4b->bd_info->bb_first_free == start) in mb_mark_used()
1904 e4b->bd_info->bb_first_free += len; in mb_mark_used()
1908 mlen = !mb_test_bit(start - 1, e4b->bd_bitmap); in mb_mark_used()
1909 if (start + len < EXT4_SB(e4b->bd_sb)->s_mb_maxs[0]) in mb_mark_used()
1910 max = !mb_test_bit(start + len, e4b->bd_bitmap); in mb_mark_used()
1912 e4b->bd_info->bb_fragments++; in mb_mark_used()
1914 e4b->bd_info->bb_fragments--; in mb_mark_used()
1919 ord = mb_find_order_for_block(e4b, start); in mb_mark_used()
1925 buddy = mb_find_buddy(e4b, ord, &max); in mb_mark_used()
1930 e4b->bd_info->bb_counters[ord]--; in mb_mark_used()
1943 buddy = mb_find_buddy(e4b, ord, &max); in mb_mark_used()
1945 e4b->bd_info->bb_counters[ord]--; in mb_mark_used()
1949 buddy = mb_find_buddy(e4b, ord, &max); in mb_mark_used()
1952 e4b->bd_info->bb_counters[ord]++; in mb_mark_used()
1953 e4b->bd_info->bb_counters[ord]++; in mb_mark_used()
1956 mb_set_largest_free_order(e4b->bd_sb, e4b->bd_info); in mb_mark_used()
1958 mb_update_avg_fragment_size(e4b->bd_sb, e4b->bd_info); in mb_mark_used()
1959 mb_set_bits(e4b->bd_bitmap, ex->fe_start, len0); in mb_mark_used()
1960 mb_check_buddy(e4b); in mb_mark_used()
1969 struct ext4_buddy *e4b) in ext4_mb_use_best_found() argument
1974 BUG_ON(ac->ac_b_ex.fe_group != e4b->bd_group); in ext4_mb_use_best_found()
1979 ret = mb_mark_used(e4b, &ac->ac_b_ex); in ext4_mb_use_best_found()
1996 ac->ac_bitmap_page = e4b->bd_bitmap_page; in ext4_mb_use_best_found()
1998 ac->ac_buddy_page = e4b->bd_buddy_page; in ext4_mb_use_best_found()
2018 struct ext4_buddy *e4b, in ext4_mb_check_limits() argument
2045 && bex->fe_group == e4b->bd_group) { in ext4_mb_check_limits()
2049 max = mb_find_extent(e4b, bex->fe_start, gex->fe_len, &ex); in ext4_mb_check_limits()
2051 ext4_mb_use_best_found(ac, e4b); in ext4_mb_check_limits()
2069 struct ext4_buddy *e4b) in ext4_mb_measure_extent() argument
2086 ext4_mb_use_best_found(ac, e4b); in ext4_mb_measure_extent()
2095 ext4_mb_use_best_found(ac, e4b); in ext4_mb_measure_extent()
2123 ext4_mb_check_limits(ac, e4b, 0); in ext4_mb_measure_extent()
2128 struct ext4_buddy *e4b) in ext4_mb_try_best_found() argument
2136 err = ext4_mb_load_buddy(ac->ac_sb, group, e4b); in ext4_mb_try_best_found()
2141 max = mb_find_extent(e4b, ex.fe_start, ex.fe_len, &ex); in ext4_mb_try_best_found()
2145 ext4_mb_use_best_found(ac, e4b); in ext4_mb_try_best_found()
2149 ext4_mb_unload_buddy(e4b); in ext4_mb_try_best_found()
2156 struct ext4_buddy *e4b) in ext4_mb_find_by_goal() argument
2170 err = ext4_mb_load_buddy(ac->ac_sb, group, e4b); in ext4_mb_find_by_goal()
2174 if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) { in ext4_mb_find_by_goal()
2175 ext4_mb_unload_buddy(e4b); in ext4_mb_find_by_goal()
2180 max = mb_find_extent(e4b, ac->ac_g_ex.fe_start, in ext4_mb_find_by_goal()
2187 start = ext4_group_first_block_no(ac->ac_sb, e4b->bd_group) + in ext4_mb_find_by_goal()
2193 ext4_mb_use_best_found(ac, e4b); in ext4_mb_find_by_goal()
2201 ext4_mb_use_best_found(ac, e4b); in ext4_mb_find_by_goal()
2210 ext4_mb_use_best_found(ac, e4b); in ext4_mb_find_by_goal()
2213 ext4_mb_unload_buddy(e4b); in ext4_mb_find_by_goal()
2224 struct ext4_buddy *e4b) in ext4_mb_simple_scan_group() argument
2227 struct ext4_group_info *grp = e4b->bd_info; in ext4_mb_simple_scan_group()
2238 buddy = mb_find_buddy(e4b, i, &max); in ext4_mb_simple_scan_group()
2243 ext4_grp_locked_error(ac->ac_sb, e4b->bd_group, 0, 0, in ext4_mb_simple_scan_group()
2247 e4b->bd_group, in ext4_mb_simple_scan_group()
2255 ac->ac_b_ex.fe_group = e4b->bd_group; in ext4_mb_simple_scan_group()
2257 ext4_mb_use_best_found(ac, e4b); in ext4_mb_simple_scan_group()
2275 struct ext4_buddy *e4b) in ext4_mb_complex_scan_group() argument
2278 void *bitmap = e4b->bd_bitmap; in ext4_mb_complex_scan_group()
2283 free = e4b->bd_info->bb_free; in ext4_mb_complex_scan_group()
2287 i = e4b->bd_info->bb_first_free; in ext4_mb_complex_scan_group()
2298 ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, in ext4_mb_complex_scan_group()
2302 ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group, in ext4_mb_complex_scan_group()
2307 mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex); in ext4_mb_complex_scan_group()
2311 ext4_grp_locked_error(sb, e4b->bd_group, 0, 0, in ext4_mb_complex_scan_group()
2315 ext4_mark_group_bitmap_corrupted(sb, e4b->bd_group, in ext4_mb_complex_scan_group()
2325 ext4_mb_measure_extent(ac, &ex, e4b); in ext4_mb_complex_scan_group()
2331 ext4_mb_check_limits(ac, e4b, 1); in ext4_mb_complex_scan_group()
2340 struct ext4_buddy *e4b) in ext4_mb_scan_aligned() argument
2344 void *bitmap = e4b->bd_bitmap; in ext4_mb_scan_aligned()
2354 first_group_block = ext4_group_first_block_no(sb, e4b->bd_group); in ext4_mb_scan_aligned()
2362 max = mb_find_extent(e4b, i, sbi->s_stripe, &ex); in ext4_mb_scan_aligned()
2367 ext4_mb_use_best_found(ac, e4b); in ext4_mb_scan_aligned()
2601 struct ext4_buddy e4b; in ext4_mb_regular_allocator() local
2614 err = ext4_mb_find_by_goal(ac, &e4b); in ext4_mb_regular_allocator()
2711 err = ext4_mb_load_buddy(sb, group, &e4b); in ext4_mb_regular_allocator()
2724 ext4_mb_unload_buddy(&e4b); in ext4_mb_regular_allocator()
2730 ext4_mb_simple_scan_group(ac, &e4b); in ext4_mb_regular_allocator()
2733 ext4_mb_scan_aligned(ac, &e4b); in ext4_mb_regular_allocator()
2735 ext4_mb_complex_scan_group(ac, &e4b); in ext4_mb_regular_allocator()
2738 ext4_mb_unload_buddy(&e4b); in ext4_mb_regular_allocator()
2754 ext4_mb_try_best_found(ac, &e4b); in ext4_mb_regular_allocator()
2821 struct ext4_buddy e4b; in ext4_mb_seq_groups_show() local
2843 err = ext4_mb_load_buddy(sb, group, &e4b); in ext4_mb_seq_groups_show()
2854 ext4_mb_unload_buddy(&e4b); in ext4_mb_seq_groups_show()
3284 struct ext4_buddy e4b; in ext4_discard_work() local
3305 ext4_mb_unload_buddy(&e4b); in ext4_discard_work()
3307 err = ext4_mb_load_buddy(sb, grp, &e4b); in ext4_discard_work()
3318 ext4_try_to_trim_range(sb, &e4b, fd->efd_start_cluster, in ext4_discard_work()
3326 ext4_mb_unload_buddy(&e4b); in ext4_discard_work()
3607 struct ext4_buddy e4b; in ext4_free_data_in_buddy() local
3614 err = ext4_mb_load_buddy(sb, entry->efd_group, &e4b); in ext4_free_data_in_buddy()
3622 db = e4b.bd_info; in ext4_free_data_in_buddy()
3629 mb_free_blocks(NULL, &e4b, entry->efd_start_cluster, entry->efd_count); in ext4_free_data_in_buddy()
3644 put_page(e4b.bd_buddy_page); in ext4_free_data_in_buddy()
3645 put_page(e4b.bd_bitmap_page); in ext4_free_data_in_buddy()
3648 ext4_mb_unload_buddy(&e4b); in ext4_free_data_in_buddy()
4243 struct ext4_buddy e4b; in ext4_discard_allocated_blocks() local
4249 err = ext4_mb_load_buddy(ac->ac_sb, ac->ac_f_ex.fe_group, &e4b); in ext4_discard_allocated_blocks()
4260 mb_free_blocks(ac->ac_inode, &e4b, ac->ac_f_ex.fe_start, in ext4_discard_allocated_blocks()
4263 ext4_mb_unload_buddy(&e4b); in ext4_discard_allocated_blocks()
4759 ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh, in ext4_mb_release_inode_pa() argument
4762 struct super_block *sb = e4b->bd_sb; in ext4_mb_release_inode_pa()
4774 BUG_ON(group != e4b->bd_group && pa->pa_len != 0); in ext4_mb_release_inode_pa()
4791 mb_free_blocks(pa->pa_inode, e4b, bit, next - bit); in ext4_mb_release_inode_pa()
4795 ext4_msg(e4b->bd_sb, KERN_CRIT, in ext4_mb_release_inode_pa()
4813 ext4_mb_release_group_pa(struct ext4_buddy *e4b, in ext4_mb_release_group_pa() argument
4816 struct super_block *sb = e4b->bd_sb; in ext4_mb_release_group_pa()
4823 BUG_ON(group != e4b->bd_group && pa->pa_len != 0); in ext4_mb_release_group_pa()
4824 mb_free_blocks(pa->pa_inode, e4b, bit, pa->pa_len); in ext4_mb_release_group_pa()
4848 struct ext4_buddy e4b; in ext4_mb_discard_group_preallocations() local
4865 err = ext4_mb_load_buddy(sb, group, &e4b); in ext4_mb_discard_group_preallocations()
4912 ext4_mb_release_group_pa(&e4b, pa); in ext4_mb_discard_group_preallocations()
4914 ext4_mb_release_inode_pa(&e4b, bitmap_bh, pa); in ext4_mb_discard_group_preallocations()
4921 ext4_mb_unload_buddy(&e4b); in ext4_mb_discard_group_preallocations()
4946 struct ext4_buddy e4b; in ext4_discard_preallocations() local
5021 err = ext4_mb_load_buddy_gfp(sb, group, &e4b, in ext4_discard_preallocations()
5034 ext4_mb_unload_buddy(&e4b); in ext4_discard_preallocations()
5040 ext4_mb_release_inode_pa(&e4b, bitmap_bh, pa); in ext4_discard_preallocations()
5043 ext4_mb_unload_buddy(&e4b); in ext4_discard_preallocations()
5266 struct ext4_buddy e4b; in ext4_mb_discard_lg_preallocations() local
5319 err = ext4_mb_load_buddy_gfp(sb, group, &e4b, in ext4_mb_discard_lg_preallocations()
5328 ext4_mb_release_group_pa(&e4b, pa); in ext4_mb_discard_lg_preallocations()
5331 ext4_mb_unload_buddy(&e4b); in ext4_mb_discard_lg_preallocations()
5703 ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b, in ext4_mb_free_metadata() argument
5706 ext4_group_t group = e4b->bd_group; in ext4_mb_free_metadata()
5710 struct ext4_group_info *db = e4b->bd_info; in ext4_mb_free_metadata()
5711 struct super_block *sb = e4b->bd_sb; in ext4_mb_free_metadata()
5717 BUG_ON(e4b->bd_bitmap_page == NULL); in ext4_mb_free_metadata()
5718 BUG_ON(e4b->bd_buddy_page == NULL); in ext4_mb_free_metadata()
5729 get_page(e4b->bd_buddy_page); in ext4_mb_free_metadata()
5730 get_page(e4b->bd_bitmap_page); in ext4_mb_free_metadata()
5899 struct ext4_buddy e4b; in ext4_mb_clear_bb() local
5980 err = ext4_mb_load_buddy_gfp(sb, block_group, &e4b, in ext4_mb_clear_bb()
6008 ext4_mb_free_metadata(handle, &e4b, new_entry); in ext4_mb_clear_bb()
6023 EXT4_MB_GRP_CLEAR_TRIMMED(e4b.bd_info); in ext4_mb_clear_bb()
6027 mb_free_blocks(inode, &e4b, bit, count_clusters); in ext4_mb_clear_bb()
6055 ext4_mb_unload_buddy(&e4b); in ext4_mb_clear_bb()
6202 struct ext4_buddy e4b; in ext4_group_add_blocks() local
6274 err = ext4_mb_load_buddy(sb, block_group, &e4b); in ext4_group_add_blocks()
6285 mb_free_blocks(NULL, &e4b, bit, cluster_count); in ext4_group_add_blocks()
6302 ext4_mb_unload_buddy(&e4b); in ext4_group_add_blocks()
6332 int start, int count, struct ext4_buddy *e4b) in ext4_trim_extent() argument
6337 ext4_group_t group = e4b->bd_group; in ext4_trim_extent()
6352 mb_mark_used(e4b, &ex); in ext4_trim_extent()
6356 mb_free_blocks(NULL, e4b, start, ex.fe_len); in ext4_trim_extent()
6361 struct ext4_buddy *e4b, ext4_grpblk_t start, in ext4_try_to_trim_range() argument
6363 __acquires(ext4_group_lock_ptr(sb, e4b->bd_group)) in ext4_try_to_trim_range()
6364 __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) in ext4_try_to_trim_range()
6369 bitmap = e4b->bd_bitmap; in ext4_try_to_trim_range()
6370 start = (e4b->bd_info->bb_first_free > start) ? in ext4_try_to_trim_range()
6371 e4b->bd_info->bb_first_free : start; in ext4_try_to_trim_range()
6382 int ret = ext4_trim_extent(sb, start, next - start, e4b); in ext4_try_to_trim_range()
6397 ext4_unlock_group(sb, e4b->bd_group); in ext4_try_to_trim_range()
6399 ext4_lock_group(sb, e4b->bd_group); in ext4_try_to_trim_range()
6402 if ((e4b->bd_info->bb_free - free_count) < minblocks) in ext4_try_to_trim_range()
6428 struct ext4_buddy e4b; in ext4_trim_all_free() local
6433 ret = ext4_mb_load_buddy(sb, group, &e4b); in ext4_trim_all_free()
6442 if (!EXT4_MB_GRP_WAS_TRIMMED(e4b.bd_info) || in ext4_trim_all_free()
6444 ret = ext4_try_to_trim_range(sb, &e4b, start, max, minblocks); in ext4_trim_all_free()
6446 EXT4_MB_GRP_SET_TRIMMED(e4b.bd_info); in ext4_trim_all_free()
6452 ext4_mb_unload_buddy(&e4b); in ext4_trim_all_free()
6576 struct ext4_buddy e4b; in ext4_mballoc_query_range() local
6579 error = ext4_mb_load_buddy(sb, group, &e4b); in ext4_mballoc_query_range()
6582 bitmap = e4b.bd_bitmap; in ext4_mballoc_query_range()
6586 start = (e4b.bd_info->bb_first_free > start) ? in ext4_mballoc_query_range()
6587 e4b.bd_info->bb_first_free : start; in ext4_mballoc_query_range()
6608 ext4_mb_unload_buddy(&e4b); in ext4_mballoc_query_range()