Allow block cloning to be interrupted by a signal.

Even though block cloning is much faster than regular copying,
it is not instantaneous - the file might be large and the recordsize
small. It would be nice to be able to interrupt it with a signal
(e.g., SIGINFO on FreeBSD to see the progress).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #16208
This commit is contained in:
Pawel Jakub Dawidek 2024-05-24 18:45:09 -07:00 committed by GitHub
parent efbef9e6cc
commit 08648cf0da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -1412,6 +1412,11 @@ zfs_clone_range(znode_t *inzp, uint64_t *inoffp, znode_t *outzp,
outoff += size; outoff += size;
len -= size; len -= size;
done += size; done += size;
if (issig(JUSTLOOKING) && issig(FORREAL)) {
error = SET_ERROR(EINTR);
break;
}
} }
vmem_free(bps, sizeof (bps[0]) * maxblocks); vmem_free(bps, sizeof (bps[0]) * maxblocks);