Page MenuHomeFreeBSD

makefs(8): Fix calculation of file sizes
ClosedPublic

Authored by kd on May 5 2022, 12:49 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 7, 3:26 PM
Unknown Object (File)
Wed, Feb 28, 11:24 AM
Unknown Object (File)
Feb 5 2024, 11:24 PM
Unknown Object (File)
Jan 30 2024, 9:53 AM
Unknown Object (File)
Jan 14 2024, 8:42 AM
Unknown Object (File)
Jan 2 2024, 5:44 PM
Unknown Object (File)
Dec 26 2023, 7:33 PM
Unknown Object (File)
Dec 23 2023, 2:06 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