Lines Matching refs:flex_gd
242 struct ext4_new_flex_group_data *flex_gd; in alloc_flex_gd() local
244 flex_gd = kmalloc(sizeof(*flex_gd), GFP_NOFS); in alloc_flex_gd()
245 if (flex_gd == NULL) in alloc_flex_gd()
250 flex_gd->count = flexbg_size; in alloc_flex_gd()
252 flex_gd->groups = kmalloc_array(flexbg_size, in alloc_flex_gd()
255 if (flex_gd->groups == NULL) in alloc_flex_gd()
258 flex_gd->bg_flags = kmalloc_array(flexbg_size, sizeof(__u16), in alloc_flex_gd()
260 if (flex_gd->bg_flags == NULL) in alloc_flex_gd()
263 return flex_gd; in alloc_flex_gd()
266 kfree(flex_gd->groups); in alloc_flex_gd()
268 kfree(flex_gd); in alloc_flex_gd()
273 static void free_flex_gd(struct ext4_new_flex_group_data *flex_gd) in free_flex_gd() argument
275 kfree(flex_gd->bg_flags); in free_flex_gd()
276 kfree(flex_gd->groups); in free_flex_gd()
277 kfree(flex_gd); in free_flex_gd()
294 struct ext4_new_flex_group_data *flex_gd, in ext4_alloc_group_tables() argument
297 struct ext4_new_group_data *group_data = flex_gd->groups; in ext4_alloc_group_tables()
310 BUG_ON(flex_gd->count == 0 || group_data == NULL); in ext4_alloc_group_tables()
313 last_group = src_group + flex_gd->count - 1; in ext4_alloc_group_tables()
319 if (src_group >= group_data[0].group + flex_gd->count) in ext4_alloc_group_tables()
339 for (; bb_index < flex_gd->count; bb_index++) { in ext4_alloc_group_tables()
346 flex_gd->bg_flags[group] &= uninit_mask; in ext4_alloc_group_tables()
350 for (; ib_index < flex_gd->count; ib_index++) { in ext4_alloc_group_tables()
357 flex_gd->bg_flags[group] &= uninit_mask; in ext4_alloc_group_tables()
361 for (; it_index < flex_gd->count; it_index++) { in ext4_alloc_group_tables()
373 flex_gd->bg_flags[group + 1] &= uninit_mask; in ext4_alloc_group_tables()
380 flex_gd->bg_flags[group] &= uninit_mask; in ext4_alloc_group_tables()
385 for (i = 0; i < flex_gd->count; i++) { in ext4_alloc_group_tables()
396 "%d groups, flexbg size is %d:\n", flex_gd->count, in ext4_alloc_group_tables()
399 for (i = 0; i < flex_gd->count; i++) { in ext4_alloc_group_tables()
467 struct ext4_new_flex_group_data *flex_gd, in set_flexbg_block_bitmap() argument
485 group -= flex_gd->groups[0].group; in set_flexbg_block_bitmap()
491 if (flex_gd->bg_flags[group] & EXT4_BG_BLOCK_UNINIT) { in set_flexbg_block_bitmap()
492 BUG_ON(flex_gd->count > 1); in set_flexbg_block_bitmap()
500 bh = sb_getblk(sb, flex_gd->groups[group].block_bitmap); in set_flexbg_block_bitmap()
538 struct ext4_new_flex_group_data *flex_gd) in setup_new_flex_group_blocks() argument
545 struct ext4_new_group_data *group_data = flex_gd->groups; in setup_new_flex_group_blocks()
546 __u16 *bg_flags = flex_gd->bg_flags; in setup_new_flex_group_blocks()
553 BUG_ON(!flex_gd->count || !group_data || in setup_new_flex_group_blocks()
565 for (i = 0; i < flex_gd->count; i++, group++) { in setup_new_flex_group_blocks()
699 for (i = 1; i < flex_gd->count; i++) { in setup_new_flex_group_blocks()
706 flex_gd, in setup_new_flex_group_blocks()
720 flex_gd, in setup_new_flex_group_blocks()
1324 struct ext4_new_flex_group_data *flex_gd) in ext4_setup_new_descs() argument
1326 struct ext4_new_group_data *group_data = flex_gd->groups; in ext4_setup_new_descs()
1331 __u16 *bg_flags = flex_gd->bg_flags; in ext4_setup_new_descs()
1335 for (i = 0; i < flex_gd->count; i++, group_data++, bg_flags++) { in ext4_setup_new_descs()
1393 struct ext4_new_flex_group_data *flex_gd) in ext4_update_super() argument
1398 struct ext4_new_group_data *group_data = flex_gd->groups; in ext4_update_super()
1403 BUG_ON(flex_gd->count == 0 || group_data == NULL); in ext4_update_super()
1414 for (i = 0; i < flex_gd->count; i++) { in ext4_update_super()
1427 flex_gd->count); in ext4_update_super()
1429 flex_gd->count); in ext4_update_super()
1453 sbi->s_groups_count += flex_gd->count; in ext4_update_super()
1466 EXT4_INODES_PER_GROUP(sb) * flex_gd->count); in ext4_update_super()
1478 atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, in ext4_update_super()
1490 "%llu blocks(%llu free %llu reserved)\n", flex_gd->count, in ext4_update_super()
1500 struct ext4_new_flex_group_data *flex_gd) in ext4_flex_group_add() argument
1511 BUG_ON(!flex_gd->count || !flex_gd->groups || !flex_gd->bg_flags); in ext4_flex_group_add()
1518 err = setup_new_flex_group_blocks(sb, flex_gd); in ext4_flex_group_add()
1530 credit += 1 + DIV_ROUND_UP(flex_gd->count, EXT4_DESC_PER_BLOCK(sb)); in ext4_flex_group_add()
1543 group = flex_gd->groups[0].group; in ext4_flex_group_add()
1546 resize_inode, flex_gd->count); in ext4_flex_group_add()
1550 err = ext4_setup_new_descs(handle, sb, flex_gd); in ext4_flex_group_add()
1554 ext4_update_super(sb, flex_gd); in ext4_flex_group_add()
1565 int gdb_num_end = ((group + flex_gd->count - 1) / in ext4_flex_group_add()
1589 struct ext4_new_flex_group_data *flex_gd, in ext4_setup_next_flex_gd() argument
1595 struct ext4_new_group_data *group_data = flex_gd->groups; in ext4_setup_next_flex_gd()
1619 flex_gd->count = last_group - group + 1; in ext4_setup_next_flex_gd()
1621 for (i = 0; i < flex_gd->count; i++) { in ext4_setup_next_flex_gd()
1630 flex_gd->bg_flags[i] = EXT4_BG_BLOCK_UNINIT | in ext4_setup_next_flex_gd()
1633 flex_gd->bg_flags[i] |= EXT4_BG_INODE_ZEROED; in ext4_setup_next_flex_gd()
1635 flex_gd->bg_flags[i] = EXT4_BG_INODE_ZEROED; in ext4_setup_next_flex_gd()
1640 flex_gd->bg_flags[i - 1] &= ~EXT4_BG_BLOCK_UNINIT; in ext4_setup_next_flex_gd()
1666 struct ext4_new_flex_group_data flex_gd; in ext4_group_add() local
1722 flex_gd.count = 1; in ext4_group_add()
1723 flex_gd.groups = input; in ext4_group_add()
1724 flex_gd.bg_flags = &bg_flags; in ext4_group_add()
1725 err = ext4_flex_group_add(sb, inode, &flex_gd); in ext4_group_add()
1960 struct ext4_new_flex_group_data *flex_gd = NULL; in ext4_resize_fs() local
2106 flex_gd = alloc_flex_gd(flexbg_size); in ext4_resize_fs()
2107 if (flex_gd == NULL) { in ext4_resize_fs()
2115 while (ext4_setup_next_flex_gd(sb, flex_gd, n_blocks_count, in ext4_resize_fs()
2124 if (ext4_alloc_group_tables(sb, flex_gd, flexbg_size) != 0) in ext4_resize_fs()
2126 err = ext4_flex_group_add(sb, resize_inode, flex_gd); in ext4_resize_fs()
2134 free_flex_gd(flex_gd); in ext4_resize_fs()
2135 flex_gd = NULL; in ext4_resize_fs()
2144 if (flex_gd) in ext4_resize_fs()
2145 free_flex_gd(flex_gd); in ext4_resize_fs()