Page MenuHomeFreeBSD

makefs(8): Fix calculation of file sizes
AcceptedPublic

Authored by mindal_semihalf.com on Thu, May 5, 12:49 PM.

Details

Summary

When a new FS image is created we need to calculate how much space each file is going to consume.
Fix two bugs in that logic:

  1. Count the space needed for indirection blocks for large files.
  2. Normally the trailing data of a file is written to a block of frag size, 4 kB by default.

However for files that use indirect blocks a full block is allocated, 32kB by default.
Take that into account.

PR: 229929

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

This is an accurate calculation the the extra needed space.

This revision is now accepted and ready to land.Sat, May 14, 7:03 PM
asomers requested changes to this revision.Sat, May 14, 7:33 PM
asomers added inline comments.
usr.sbin/makefs/ffs.c
627

One problem: the compiler complains about a signed/unsigned comparison in this line, as called from line 664. Could you please fix that?

This revision now requires changes to proceed.Sat, May 14, 7:33 PM

Cast both sides of comparison to size_t.

This revision is now accepted and ready to land.Mon, May 16, 10:29 PM