Page MenuHomeFreeBSD

makefs(8): Fix calculation of file sizes
ClosedPublic

Authored by kd on May 5 2022, 12:49 PM.
Tags
None
Referenced Files
F151203872: D35132.diff
Mon, Apr 6, 7:46 PM
Unknown Object (File)
Fri, Apr 3, 12:25 AM
Unknown Object (File)
Thu, Apr 2, 10:00 AM
Unknown Object (File)
Fri, Mar 27, 7:30 PM
Unknown Object (File)
Fri, Mar 27, 2:59 AM
Unknown Object (File)
Wed, Mar 25, 4:28 PM
Unknown Object (File)
Mon, Mar 16, 9:34 PM
Unknown Object (File)
Mon, Mar 16, 9:25 PM
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