Page MenuHomeFreeBSD

makefs(8): Fix calculation of file sizes
ClosedPublic

Authored by kd on May 5 2022, 12:49 PM.
Tags
None
Referenced Files
F147594960: D35132.id106033.diff
Thu, Mar 12, 5:09 AM
F147594533: D35132.id106033.diff
Thu, Mar 12, 5:04 AM
Unknown Object (File)
Mon, Mar 2, 12:11 AM
Unknown Object (File)
Sat, Feb 28, 10:42 AM
Unknown Object (File)
Feb 9 2026, 3:22 AM
Unknown Object (File)
Jan 25 2026, 1:44 PM
Unknown Object (File)
Jan 25 2026, 1:36 PM
Unknown Object (File)
Jan 21 2026, 3:08 AM
Subscribers
None

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
Tests Skipped

Event Timeline

kd requested review of this revision.May 5 2022, 12:49 PM
kd created this revision.

This is an accurate calculation the the extra needed space.

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

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.May 14 2022, 7:33 PM

Cast both sides of comparison to size_t.

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