Lines Matching refs:flex_gd
195 struct ext4_new_flex_group_data *flex_gd; in alloc_flex_gd() local
197 flex_gd = kmalloc(sizeof(*flex_gd), GFP_NOFS); in alloc_flex_gd()
198 if (flex_gd == NULL) in alloc_flex_gd()
203 flex_gd->count = flexbg_size; in alloc_flex_gd()
205 flex_gd->groups = kmalloc(sizeof(struct ext4_new_group_data) * in alloc_flex_gd()
207 if (flex_gd->groups == NULL) in alloc_flex_gd()
210 flex_gd->bg_flags = kmalloc(flexbg_size * sizeof(__u16), GFP_NOFS); in alloc_flex_gd()
211 if (flex_gd->bg_flags == NULL) in alloc_flex_gd()
214 return flex_gd; in alloc_flex_gd()
217 kfree(flex_gd->groups); in alloc_flex_gd()
219 kfree(flex_gd); in alloc_flex_gd()
224 static void free_flex_gd(struct ext4_new_flex_group_data *flex_gd) in free_flex_gd() argument
226 kfree(flex_gd->bg_flags); in free_flex_gd()
227 kfree(flex_gd->groups); in free_flex_gd()
228 kfree(flex_gd); in free_flex_gd()
245 struct ext4_new_flex_group_data *flex_gd, in ext4_alloc_group_tables() argument
248 struct ext4_new_group_data *group_data = flex_gd->groups; in ext4_alloc_group_tables()
260 BUG_ON(flex_gd->count == 0 || group_data == NULL); in ext4_alloc_group_tables()
263 last_group = src_group + flex_gd->count - 1; in ext4_alloc_group_tables()
269 if (src_group >= group_data[0].group + flex_gd->count) in ext4_alloc_group_tables()
289 for (; bb_index < flex_gd->count; bb_index++) { in ext4_alloc_group_tables()
296 flex_gd->bg_flags[group] &= uninit_mask; in ext4_alloc_group_tables()
300 for (; ib_index < flex_gd->count; ib_index++) { in ext4_alloc_group_tables()
307 flex_gd->bg_flags[group] &= uninit_mask; in ext4_alloc_group_tables()
311 for (; it_index < flex_gd->count; it_index++) { in ext4_alloc_group_tables()
323 flex_gd->bg_flags[group + 1] &= uninit_mask; in ext4_alloc_group_tables()
330 flex_gd->bg_flags[group] &= uninit_mask; in ext4_alloc_group_tables()
339 "%d groups, flexbg size is %d:\n", flex_gd->count, in ext4_alloc_group_tables()
342 for (i = 0; i < flex_gd->count; i++) { in ext4_alloc_group_tables()
409 struct ext4_new_flex_group_data *flex_gd, in set_flexbg_block_bitmap() argument
423 group -= flex_gd->groups[0].group; in set_flexbg_block_bitmap()
429 if (flex_gd->bg_flags[group] & EXT4_BG_BLOCK_UNINIT) { in set_flexbg_block_bitmap()
430 BUG_ON(flex_gd->count > 1); in set_flexbg_block_bitmap()
438 bh = sb_getblk(sb, flex_gd->groups[group].block_bitmap); in set_flexbg_block_bitmap()
474 struct ext4_new_flex_group_data *flex_gd) in setup_new_flex_group_blocks() argument
481 struct ext4_new_group_data *group_data = flex_gd->groups; in setup_new_flex_group_blocks()
482 __u16 *bg_flags = flex_gd->bg_flags; in setup_new_flex_group_blocks()
489 BUG_ON(!flex_gd->count || !group_data || in setup_new_flex_group_blocks()
501 for (i = 0; i < flex_gd->count; i++, group++) { in setup_new_flex_group_blocks()
637 for (i = 1; i < flex_gd->count; i++) { in setup_new_flex_group_blocks()
644 flex_gd, start, count); in setup_new_flex_group_blocks()
654 flex_gd, start, count); in setup_new_flex_group_blocks()
1237 struct ext4_new_flex_group_data *flex_gd) in ext4_setup_new_descs() argument
1239 struct ext4_new_group_data *group_data = flex_gd->groups; in ext4_setup_new_descs()
1244 __u16 *bg_flags = flex_gd->bg_flags; in ext4_setup_new_descs()
1248 for (i = 0; i < flex_gd->count; i++, group_data++, bg_flags++) { in ext4_setup_new_descs()
1306 struct ext4_new_flex_group_data *flex_gd) in ext4_update_super() argument
1311 struct ext4_new_group_data *group_data = flex_gd->groups; in ext4_update_super()
1316 BUG_ON(flex_gd->count == 0 || group_data == NULL); in ext4_update_super()
1327 for (i = 0; i < flex_gd->count; i++) { in ext4_update_super()
1340 flex_gd->count); in ext4_update_super()
1342 flex_gd->count); in ext4_update_super()
1366 sbi->s_groups_count += flex_gd->count; in ext4_update_super()
1379 EXT4_INODES_PER_GROUP(sb) * flex_gd->count); in ext4_update_super()
1388 atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, in ext4_update_super()
1399 "%llu blocks(%llu free %llu reserved)\n", flex_gd->count, in ext4_update_super()
1409 struct ext4_new_flex_group_data *flex_gd) in ext4_flex_group_add() argument
1420 BUG_ON(!flex_gd->count || !flex_gd->groups || !flex_gd->bg_flags); in ext4_flex_group_add()
1427 err = setup_new_flex_group_blocks(sb, flex_gd); in ext4_flex_group_add()
1439 credit += 1 + DIV_ROUND_UP(flex_gd->count, EXT4_DESC_PER_BLOCK(sb)); in ext4_flex_group_add()
1452 group = flex_gd->groups[0].group; in ext4_flex_group_add()
1455 resize_inode, flex_gd->count); in ext4_flex_group_add()
1459 err = ext4_setup_new_descs(handle, sb, flex_gd); in ext4_flex_group_add()
1463 ext4_update_super(sb, flex_gd); in ext4_flex_group_add()
1474 int gdb_num_end = ((group + flex_gd->count - 1) / in ext4_flex_group_add()
1497 struct ext4_new_flex_group_data *flex_gd, in ext4_setup_next_flex_gd() argument
1502 struct ext4_new_group_data *group_data = flex_gd->groups; in ext4_setup_next_flex_gd()
1526 flex_gd->count = last_group - group + 1; in ext4_setup_next_flex_gd()
1528 for (i = 0; i < flex_gd->count; i++) { in ext4_setup_next_flex_gd()
1536 flex_gd->bg_flags[i] = EXT4_BG_BLOCK_UNINIT | in ext4_setup_next_flex_gd()
1539 flex_gd->bg_flags[i] |= EXT4_BG_INODE_ZEROED; in ext4_setup_next_flex_gd()
1541 flex_gd->bg_flags[i] = EXT4_BG_INODE_ZEROED; in ext4_setup_next_flex_gd()
1546 flex_gd->bg_flags[i - 1] &= ~EXT4_BG_BLOCK_UNINIT; in ext4_setup_next_flex_gd()
1572 struct ext4_new_flex_group_data flex_gd; in ext4_group_add() local
1628 flex_gd.count = 1; in ext4_group_add()
1629 flex_gd.groups = input; in ext4_group_add()
1630 flex_gd.bg_flags = &bg_flags; in ext4_group_add()
1631 err = ext4_flex_group_add(sb, inode, &flex_gd); in ext4_group_add()
1865 struct ext4_new_flex_group_data *flex_gd = NULL; in ext4_resize_fs() local
1978 flex_gd = alloc_flex_gd(flexbg_size); in ext4_resize_fs()
1979 if (flex_gd == NULL) { in ext4_resize_fs()
1987 while (ext4_setup_next_flex_gd(sb, flex_gd, n_blocks_count, in ext4_resize_fs()
1996 if (ext4_alloc_group_tables(sb, flex_gd, flexbg_size) != 0) in ext4_resize_fs()
1998 err = ext4_flex_group_add(sb, resize_inode, flex_gd); in ext4_resize_fs()
2006 free_flex_gd(flex_gd); in ext4_resize_fs()
2007 flex_gd = NULL; in ext4_resize_fs()
2012 if (flex_gd) in ext4_resize_fs()
2013 free_flex_gd(flex_gd); in ext4_resize_fs()