HomeFreeBSD

makefs/zfs: Ensure that the last block of a file has the right size

Description

makefs/zfs: Ensure that the last block of a file has the right size

When copying a file's contents into the pool, a loop copies blocks of
the maximum size (128KB), allocating space from the vdev for each block.
The space allocator rounds up to the nearest block size, but for files
larger than the maximum size, this can result in the last block having a
smaller logical size than the rest of the blocks belonging to that
dnode. This violates some ZFS invariants when appending to that file.

Modify fs_populate_file() to use the same block size for the final
block.

Reported by: cperciva
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

Details

Provenance
markjAuthored on Sep 28 2023, 8:16 PM
Parents
rGd9d69a6f6fc1: split: Improve GNU compatibility.
Branches
Unknown
Tags
Unknown