vdev_file: unify FreeBSD and Linux implementations #17046
+31
−377
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[Sponsors: Klara, Inc., Wasabi Technology, Inc.]
Motivation and Context
The platform-specifics for
vdev_file
are almost entirely hidden away inzfs_file_os.c
. There's basically no reason for separatevdev_file.c
to exist, so lets merge them.Description
The process here was to load both files side-by-side in
vimdiff
, then move things around until there was no diff left. Where there were differences, I've taken the "best" version, though this is almost entirely in comments and asserts.There are very minor changes to make it fit together sensibly:
Both:
zio_interrupt()
instead of executed directly (slightly nicer behaviour, and allows reuse of thevdev_file_io_fsync()
in the inline case.FreeBSD:
zfs_nocacheflush
for FLUSH ZIOs. This matches Linux, userspace, disk drivers for both platforms, and the documentation.Linux+userspace:
z_vdev_file
is created usingmax_ncpus
rather thanboot_ncpus
. I don't think there will be any practical difference.The one wart is the Linux-specific thing to put flushes on the taskq if called within an filesystem transaction. For now I've gated that behind
#ifdef __linux__
. I wouldn't normally leave it there, but the reason I did this change at all is because I've got a change coming that always puts flushes on the taskq, so the wart will be removed with that.I've put the respective diffs for each platform in their own commit, so the changes can be more easily seen. If this is approved, I will squash the commits before merge.
How Has This Been Tested?
Compiled on FreeBSD 14.2, Linux 6.1 and Linux 4.19. On all, ran
zpool_add
andreplacement
test tags, which aren't special but use file-backed pools, and also changevdev_file
tuneables. All passed.Types of changes
Checklist:
Signed-off-by
.