Index: usr.sbin/makefs/ffs.c =================================================================== --- usr.sbin/makefs/ffs.c +++ usr.sbin/makefs/ffs.c @@ -623,12 +623,19 @@ e, tmpdir.d_namlen, this, curdirsize); \ } while (0); - /* - * XXX this needs to take into account extra space consumed - * by indirect blocks, etc. - */ #define ADDSIZE(x) do { \ - fsopts->size += roundup((x), ffs_opts->fsize); \ + if ((x) < UFS_NDADDR * ffs_opts->bsize) { \ + fsopts->size += roundup((x), ffs_opts->fsize); \ + } else { \ + /* Count space consumed by indirecttion blocks. */ \ + fsopts->size += ffs_opts->bsize * \ + (howmany((x), UFS_NDADDR * ffs_opts->bsize) - 1); \ + /* \ + * If the file is big enough to use indirect blocks, \ + * we allocate bsize block for trailing data. \ + */ \ + fsopts->size += roundup((x), ffs_opts->bsize); \ + } \ } while (0); curdirsize = 0;