When building an ffs image with large image in it, space requirements are calculated incorrectly yielding a bigger image than it could be.
The reason is that amount of indirect blocks estimation is done wrong:
- a single indirect block is treated as it can hold just 12 data blocks
- nested indirect blocks are not taken into account at all
Patch attached introduces support for indirect blocks and fixes another tiny bug with underestimated space requirement for files with size between (UFS_NDADDR-1)*blksz+fragsz ... (UFS_NDADDR)*blksz requesting a N>1 fragments instead of a whole block.