With cat(1) utilizing copy_file_range() we can make use of ZFS block cloning with the cat utility the same way as we do with cp(1).
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Could you please regenerate the diff with more context? Either use the arcanist-php82 CLI, or generate the diff with diff -U 9999.
LGTM. I still don't know if it's a good idea to use ZFS block-cloning, but you could take advantage of this change with, say, the NFS client. BTW, have you considered adding copy_file_range support to install(1) ?
Well, with ZFS block cloning we still have a chicken-and-egg problem, we need broader testing. Btw. when someone else reviewed this too, we need an exp-run as this is an elementary tool.
Btw, zfs_freebsd_copy_file_range() needs to use
vn_rlimit_fsizex() and not vn_rlimit_fsize(),
so that it copies right up to the rlimit.
I recall spotting this, but it seems to have gotten
lost in the block cloning nightmare.
bin/cat/cat.c | ||
---|---|---|
283–291 | When fd == stdin, copy_file_range() will return However, I think it might be better to check for I'll leave it up to you. | |
296 | Is there a missing "}" here or am I missing something? |
bin/cat/cat.c | ||
---|---|---|
293 | I don't see a ENOSYS return code in man copy_file_range(2). |
Looks ok to me now. I agree that cp(1), cat(1) and any
other consumers of copy_file_range(2) in /usr/src should
follow the same convention w.r.t. falling back upon errors.
bin/cat/cat.c | ||
---|---|---|
293 | I don't think ENOSYS will ever be returned |
I think it's likely fine as is, but have a suggestion to make it even safer given cat's use in the build process.
bin/cat/cat.c | ||
---|---|---|
293 | So ENOSYS is possible, if the kernel is too old. tl;dr: toss #ifndev BOOTSTRAP_CAT around this :) |