opnsense-src/usr.sbin/makefs/zfs
Mark Johnston 5175923ef4 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

(cherry picked from commit ef20cd33d3287ebead0d30f2e177fc57a97dc2d5)
2023-10-04 09:42:37 -04:00
..
dsl.c makefs/zfs: Avoid generating a GUID of zero 2023-05-26 15:38:08 -04:00
fs.c makefs/zfs: Ensure that the last block of a file has the right size 2023-10-04 09:42:37 -04:00
Makefile.inc makefs: Ignore some sign comparison warnings from GCC. 2022-11-23 10:38:29 -08:00
objset.c makefs/zfs: Set the objset block pointer fill field correctly 2023-10-04 09:42:14 -04:00
vdev.c spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
zap.c spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
zfs.h makefs/zfs: Avoid generating a GUID of zero 2023-05-26 15:38:08 -04:00