From 851f03a50a1adada3f32dde0a54ca67e46a21692 Mon Sep 17 00:00:00 2001 From: Warren Toomey Date: Wed, 23 Mar 2016 21:15:07 +1000 Subject: [PATCH] mkfs7: Fixed a bug in indirect blocks. --- tools/mkfs7 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/mkfs7 b/tools/mkfs7 index 8bd0776..f0f1782 100755 --- a/tools/mkfs7 +++ b/tools/mkfs7 @@ -158,14 +158,16 @@ sub build_indirect_blocks { # Divide the number of data blocks by WORDSPERBLK and round up, so # we know how many indirect blocks to allocate. my $indcount = int( ( $blkcount + WORDSPERBLK - 1 ) / WORDSPERBLK ); + dprint("Allocating $indcount indirect blks for $blkcount direct blks\n"); # Get enough indirect blocks - my @indlist = allocate_blocks($indcount); + my @indlist = allocate_blocks(WORDSPERBLK * $indcount); # Now fill in the pointers my $indblock = $indlist[0]; my $offset = 0; foreach my $datablock (@blklist) { + # dprint("$indblock $offset -> $datablock\n"); $Block[$indblock][ $offset++ ] = $datablock; if ( $offset == WORDSPERBLK ) { $offset = 0;