-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split "shared" userspace & kernel code into separate files #16492
Conversation
57ab1f2
to
a24ea51
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine on a quick look. Just one minor thought:
lib/libzpool/vdev_label_os.c
Outdated
/* | ||
* Check if the reserved boot area is in-use. | ||
* | ||
* This function always returns 0, as there are no known external uses | ||
* of the reserved area on Linux. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FreeBSD might use reserved area for booting in case of MBR partitioning. If it is relevant here and now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just lifted the existing code. I don't know what happens on FreeBSD really. If you can give me a brief description I can put a TODO comment in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not something that is really happenING, more like happenED. Before GPT spread there was a weird way of booting from ZFS on MBR, which IIRC included storing some boot code in the reserved areas of ZFS, which is incompatible with RAIDZ expansion. I've never done ZFS on MBR myself, and these days I am not sure many people use MBR at all, so it may be a moot point. Also I am not sure whether this function is really useful for user-space code, so was merely bringing an attention to think of possible functionality loss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the comment. I think probably the kernel FreeBSD version could actually just be the generic version for all platforms, because I don't really see why an apparently-in-use reserved area should be ignored in Linux; what if its a dual-boot system or something? But I think that's for a future change.
a24ea51
to
4e2f8ba
Compare
So I understand, we will then have a separate |
There is a common The intent here is to not have to keep things in sync; before this PR, |
Nice, then I follow, carry on |
4e2f8ba
to
6dd440b
Compare
The Linux arc_os.c carries userspace and kernel code, with very little overlap between the two. This lifts the userspace parts out into a separate arc_os.c for libzpool and removes it from the Linux side. Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/
The no-op is fine for both. Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/
It does nothing in userspace anyway. Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/
The no-op is fine for both. Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/
For now, userspace has no znode implementation. Some of the property and path handling code is used there though and is the same on all platforms, so we only need a single copy of it. Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/
Just nice and simple, with room to grow. Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/
6dd440b
to
a15d19c
Compare
The no-op is fine for both. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes #16492
It does nothing in userspace anyway. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes #16492
The no-op is fine for both. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes #16492
For now, userspace has no znode implementation. Some of the property and path handling code is used there though and is the same on all platforms, so we only need a single copy of it. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes #16492
Just nice and simple, with room to grow. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes #16492
The Linux arc_os.c carries userspace and kernel code, with very little overlap between the two. This lifts the userspace parts out into a separate arc_os.c for libzpool and removes it from the Linux side. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes openzfs#16492
The no-op is fine for both. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes openzfs#16492
It does nothing in userspace anyway. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes openzfs#16492
The no-op is fine for both. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes openzfs#16492
For now, userspace has no znode implementation. Some of the property and path handling code is used there though and is the same on all platforms, so we only need a single copy of it. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes openzfs#16492
Just nice and simple, with room to grow. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Signed-off-by: Rob Norris <[email protected]> Sponsored-by: https://despairlabs.com/sponsor/ Closes openzfs#16492
For some reason it was dropped when split from kernel, that makes raidz_test to accumulate in RAM up to 100GB of logs we don't need. Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Fixes openzfs#16492 Fixes openzfs#16566
For some reason it was dropped when split from kernel, that makes raidz_test to accumulate in RAM up to 100GB of logs we don't need. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Rob Norris <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes #16492 Closes #16566 Closes #16664
For some reason it was dropped when split from kernel, that makes raidz_test to accumulate in RAM up to 100GB of logs we don't need. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Rob Norris <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes openzfs#16492 Closes openzfs#16566 Closes openzfs#16664
For some reason it was dropped when split from kernel, that makes raidz_test to accumulate in RAM up to 100GB of logs we don't need. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Reviewed-by: Rob Norris <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes openzfs#16492 Closes openzfs#16566 Closes openzfs#16664
Motivation and Context
My continuing mission to make libzpool into a first-class citizen.
Why I've chosen that as a mission is a whole separate thing, that I'm planning on a talk on. For now, at least, lets say similar reasons as #16253: I would like to experiment with different implementations for some of these things in both the kernel and in userspace, and them sharing code makes it tough to change one without worrying about breaking the other.
Description
lib/libzpool/Makefile.am
lists a few files that are shared between userspace and the Linux kernel. This commit gives userspace its own source for all but two of these:arc_os.c
: mostly no shared code, just lift the userspace code outtrace.c
: remove from userspace builds, its already an effective no-opvdev_label_os.c
: already a no-op for Linux, just copy itzfs_debug.c
: just a very straightforward list-based implementation for userspace, and the printing functions only exist therezfs_racct.c
: already a no-op for Linux, just copy itzfs_znode.c
: much of the Linux and FreeBSD code was identical, so lifted all that into a commonzfs_znode.c
. Userspace has no ZPL (yet), so no need for an implementation of this for it.The remaining files (
vdev_file.c
,zio_crypt.c
) require more work, so I'll get them in a future PR.How Has This Been Tested?
Build checked on Linux 6.1.99 and FreeBSD 14.1. ZTS run within error bars 💀
Types of changes
Checklist:
Signed-off-by
.