]> git.proxmox.com Git - mirror_zfs.git/commit
Add more constraints for block cloning.
authorAlexander Motin <mav@FreeBSD.org>
Sat, 9 Sep 2023 17:22:36 +0000 (13:22 -0400)
committerGitHub <noreply@github.com>
Sat, 9 Sep 2023 17:22:36 +0000 (10:22 -0700)
commit5cc1876f14f90430b24f1ad2f231de936691940f
tree141475f87e44913caf3c2ec76764d21f8107c01a
parent12ce45f2606c429ee39325a0cb9b8daa5a2f3382
Add more constraints for block cloning.

- We cannot clone into files with smaller block size if there is
more than one block, since we can not grow the block size.
 - Block size must be power-of-2 if destination offset != 0, since
there can be no multiple blocks of non-power-of-2 size.

The first should handle the case when destination file has several
blocks but still is not bigger than one block of the source file.
The second fixes panic in dmu_buf_hold_array_by_dnode() on attempt
to concatenate files with equal but non-power-of-2 block sizes.

While there, assert that error is reported if we made no progress.

Reviewed-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rob Norris <rob.norris@klarasystems.com>
Reviewed-by: Kay Pedersen <mail@mkwg.de>
Reviewed-by: Umer Saleem <usaleem@ixsystems.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15251
module/zfs/zfs_vnops.c