Skip to content

Commit

Permalink
Fix reserved block for automatic calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
mpolitzer committed Sep 27, 2023
1 parent 61272a3 commit ab85c03
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions xgenext2fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -3994,10 +3994,6 @@ main(int argc, char **argv)
else
{
int groups;
if(reserved_frac == -1)
nbresrvd = nbblocks * RESERVED_BLOCKS;
else
nbresrvd = nbblocks * reserved_frac;

stats.ninodes = EXT2_FIRST_INO - 1 + (nbresrvd ? 1 : 0);
stats.nblocks = 0;
Expand All @@ -4018,6 +4014,13 @@ main(int argc, char **argv)
+ itsz // inodes per group
) * groups;

// reserved blocks
if(reserved_frac == -1)
nbresrvd = stats.nblocks * RESERVED_BLOCKS;
else
nbresrvd = stats.nblocks * reserved_frac;
stats.nblocks += nbresrvd;

if(nbinodes == -1)
nbinodes = adjust(stats.ninodes, adjust_string);
else
Expand Down

0 comments on commit ab85c03

Please sign in to comment.