|
@@ -1432,12 +1432,15 @@ static int ext4_flex_group_add(struct super_block *sb,
|
|
goto exit;
|
|
goto exit;
|
|
/*
|
|
/*
|
|
* We will always be modifying at least the superblock and GDT
|
|
* We will always be modifying at least the superblock and GDT
|
|
- * block. If we are adding a group past the last current GDT block,
|
|
|
|
|
|
+ * blocks. If we are adding a group past the last current GDT block,
|
|
* we will also modify the inode and the dindirect block. If we
|
|
* we will also modify the inode and the dindirect block. If we
|
|
* are adding a group with superblock/GDT backups we will also
|
|
* are adding a group with superblock/GDT backups we will also
|
|
* modify each of the reserved GDT dindirect blocks.
|
|
* modify each of the reserved GDT dindirect blocks.
|
|
*/
|
|
*/
|
|
- credit = flex_gd->count * 4 + reserved_gdb;
|
|
|
|
|
|
+ credit = 3; /* sb, resize inode, resize inode dindirect */
|
|
|
|
+ /* GDT blocks */
|
|
|
|
+ credit += 1 + DIV_ROUND_UP(flex_gd->count, EXT4_DESC_PER_BLOCK(sb));
|
|
|
|
+ credit += reserved_gdb; /* Reserved GDT dindirect blocks */
|
|
handle = ext4_journal_start_sb(sb, EXT4_HT_RESIZE, credit);
|
|
handle = ext4_journal_start_sb(sb, EXT4_HT_RESIZE, credit);
|
|
if (IS_ERR(handle)) {
|
|
if (IS_ERR(handle)) {
|
|
err = PTR_ERR(handle);
|
|
err = PTR_ERR(handle);
|