Page MenuHomeFreeBSD

makefs(8): Fix calculation of file sizes
ClosedPublic

Authored by kd on May 5 2022, 12:49 PM.
Tags
None
Referenced Files
F102596312: D35132.diff
Thu, Nov 14, 1:59 PM
Unknown Object (File)
Thu, Nov 7, 3:47 PM
Unknown Object (File)
Oct 3 2024, 7:48 PM
Unknown Object (File)
Oct 1 2024, 6:17 PM
Unknown Object (File)
Oct 1 2024, 4:09 PM
Unknown Object (File)
Sep 6 2024, 1:22 AM
Unknown Object (File)
Sep 4 2024, 7:03 AM
Unknown Object (File)
Sep 4 2024, 2:58 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