Skip to content
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

Add support for FreeBSD #8987

Merged
merged 1 commit into from
Apr 14, 2020
Merged

Conversation

mattmacy
Copy link
Contributor

@mattmacy mattmacy commented Jul 3, 2019

Motivation and Context

This adds support for FreeBSD to ZoL. Adding FreeBSD support to ZoL will make it easier to move changes back and forth between FreeBSD and Linux.

Description

  • import FreeBSD's SPL
  • add ifdefs in common code where it made more sense to do so than duplicate the code in separate files

How Has This Been Tested?

Adapted ZTS and have all tests that pass on HEAD passing on ZoF. Allan Jude and some developers have been using it personally.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

@behlendorf behlendorf added the Status: Design Review Needed Architecture or design is under discussion label Jul 3, 2019
uint_t abd_nents;
struct scatterlist *abd_sgl;
#endif
} abd_scatter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do wonder if #if linux around the scatterlist wouldn't be easier, or it'll be
#if ( defined(__FreeBSD__) || defined(__APPLE__) || defined(_WIN32)) && defined(_KERNEL)
But don't change anything, just curious what people think, is reducing #ifdefs even on the agenda just yet? I'm probably here waaay too early

Copy link
Contributor

@behlendorf behlendorf Jul 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lundman your timing is perfect! Reducing the #ifdefs is definitely on the agenda as is any additional refactoring we should be considering to make things easier when adding additional platforms.

@ahrens ahrens changed the title Projects/pr rebase Add support for FreeBSD Jul 3, 2019
@mattmacy mattmacy force-pushed the projects/pr-rebase branch 6 times, most recently from 9e6ea37 to 4df3869 Compare July 6, 2019 19:15
kmoore134 added a commit to truenas/ports that referenced this pull request Jul 8, 2019
uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Jul 8, 2019
This brings us up to date with the code currently in review in:

openzfs/zfs#8987


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@506233 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Jul 8, 2019
This brings us up to date with the code currently in review in:

openzfs/zfs#8987
Jehops pushed a commit to Jehops/freebsd-ports-legacy that referenced this pull request Jul 8, 2019
This brings us up to date with the code currently in review in:

openzfs/zfs#8987


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@506233 35697150-7ecd-e111-bb59-0022644237b5
@mattmacy mattmacy force-pushed the projects/pr-rebase branch 3 times, most recently from e6ea76b to 137b90d Compare July 10, 2019 18:22
@richardelling
Copy link
Contributor

richardelling commented Jul 10, 2019

NB, when building packages, such as rpm, the build system looks for shebang in files to generate the package dependencies. Thus you will need to ensure the dependency on python3 in packages remains.

Makefile.am Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
cmd/arc_summary/arc_summary2 Outdated Show resolved Hide resolved
cmd/arc_summary/arc_summary2 Outdated Show resolved Hide resolved
config/always-sed.m4 Outdated Show resolved Hide resolved
copy-builtin Outdated Show resolved Hide resolved
@mattmacy mattmacy force-pushed the projects/pr-rebase branch 8 times, most recently from 9b19313 to 4e4e10c Compare July 21, 2019 22:58
@ghost ghost force-pushed the projects/pr-rebase branch 6 times, most recently from a274154 to 178bcd7 Compare April 1, 2020 17:36
@ghost ghost force-pushed the projects/pr-rebase branch from 178bcd7 to 8bbe4fa Compare April 8, 2020 16:12
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Apr 8, 2020
@ghost ghost force-pushed the projects/pr-rebase branch 2 times, most recently from 6e0563f to 85d3c6f Compare April 8, 2020 19:17
@codecov-io
Copy link

codecov-io commented Apr 9, 2020

Codecov Report

Merging #8987 into master will decrease coverage by 0.18%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8987      +/-   ##
==========================================
- Coverage   79.48%   79.30%   -0.19%     
==========================================
  Files         387      388       +1     
  Lines      123388   123386       -2     
==========================================
- Hits        98079    97855     -224     
- Misses      25309    25531     +222     
Flag Coverage Δ
#kernel 79.86% <ø> (-0.10%) ⬇️
#user 65.70% <100.00%> (-0.41%) ⬇️
Impacted Files Coverage Δ
cmd/zpool/zpool_vdev.c 90.63% <ø> (ø)
include/os/freebsd/linux/compiler.h 100.00% <ø> (ø)
include/os/linux/kernel/linux/blkdev_compat.h 73.21% <ø> (-2.20%) ⬇️
module/os/linux/zfs/zvol_os.c 87.00% <ø> (ø)
lib/libzfs/libzfs_util.c 74.49% <100.00%> (ø)
module/os/linux/spl/spl-zlib.c 55.35% <0.00%> (-28.58%) ⬇️
module/zfs/vdev_indirect.c 74.16% <0.00%> (-9.84%) ⬇️
module/os/linux/spl/spl-kmem-cache.c 75.58% <0.00%> (-9.23%) ⬇️
module/zfs/space_map.c 93.81% <0.00%> (-4.46%) ⬇️
module/zfs/spa_checkpoint.c 93.78% <0.00%> (-4.35%) ⬇️
... and 55 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20f2878...69c630f. Read the comment docs.

@ghost ghost force-pushed the projects/pr-rebase branch 7 times, most recently from 93b0a2f to d3718e3 Compare April 13, 2020 17:01
- Import FreeBSD specific parts

Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Co-authored-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>

Requires-builders: arch,style,coverage,amazon2,centos7,debian10,ubuntu16,ubuntu18,builtin,freebsd12,freebsd13
@ghost ghost force-pushed the projects/pr-rebase branch from d3718e3 to 69c630f Compare April 13, 2020 17:29
@behlendorf behlendorf merged commit 9f0a21e into openzfs:master Apr 14, 2020
@ghost ghost deleted the projects/pr-rebase branch April 14, 2020 19:12
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
Add the FreeBSD platform code to the OpenZFS repository.  As of this
commit the source can be compiled and tested on FreeBSD 11 and 12.
Subsequent commits are now required to compile on FreeBSD and Linux.
Additionally, they must pass the ZFS Test Suite on FreeBSD which is
being run by the CI.  As of this commit 1230 tests pass on FreeBSD
and there are no unexpected failures.

Reviewed-by: Sean Eric Fagan <sef@ixsystems.com>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Reviewed-by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes openzfs#898 
Closes openzfs#8987
asomers added a commit to asomers/zfs that referenced this pull request Jun 14, 2024
This applies the same change in openzfs#9115 to FreeBSD.  This was actually the
old behavior in FreeBSD 12; it only regressed when FreeBSD support was
added to OpenZFS.  As far as I can tell, the timeline went like this:

* Illumos's zfsvfs_teardown used an unconditional txg_wait_synced
* Illumos added the dirty data check [^4]
* FreeBSD merged in Illumos's conditional check [^3]
* OpenZFS forked from Illumos
* OpenZFS removed the dirty data check in openzfs#7795 [^5]
* @mattmacy forked the OpenZFS repo and began to add FreeBSD support
* OpenZFS PR openzfs#9115[^1] recreated the same dirty data check that Illumos
  used, in slightly different form.  At this point the OpenZFS repo did
  not yet have multi-OS support.
* Matt Macy merged in FreeBSD support in openzfs#8987[^2] , but it was based on
  slightly outdated OpenZFS code.

In my local testing, this vastly improves the reboot speed of a server
with a large pool that has 1000 datasets and is resilvering an HDD.

[^1]: openzfs#9115
[^2]: openzfs#8987
[^3]: freebsd/freebsd-src@10b9d77
[^4]: illumos/illumos-gate@5aaeed5
[^5]: openzfs#7795

Sponsored by:	Axcient
Signed-off-by:	Alan Somers <asomers@gmail.com>
behlendorf pushed a commit that referenced this pull request Aug 9, 2024
This applies the same change in #9115 to FreeBSD.  This was actually the
old behavior in FreeBSD 12; it only regressed when FreeBSD support was
added to OpenZFS.  As far as I can tell, the timeline went like this:

* Illumos's zfsvfs_teardown used an unconditional txg_wait_synced
* Illumos added the dirty data check [^4]
* FreeBSD merged in Illumos's conditional check [^3]
* OpenZFS forked from Illumos
* OpenZFS removed the dirty data check in #7795 [^5]
* @mattmacy forked the OpenZFS repo and began to add FreeBSD support
* OpenZFS PR #9115[^1] recreated the same dirty data check that Illumos
  used, in slightly different form.  At this point the OpenZFS repo did
  not yet have multi-OS support.
* Matt Macy merged in FreeBSD support in #8987[^2] , but it was based on
  slightly outdated OpenZFS code.

In my local testing, this vastly improves the reboot speed of a server
with a large pool that has 1000 datasets and is resilvering an HDD.

[^1]: #9115
[^2]: #8987
[^3]: freebsd/freebsd-src@10b9d77
[^4]: illumos/illumos-gate@5aaeed5
[^5]: #7795

Sponsored by: Axcient
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Alan Somers <asomers@gmail.com>
Closes #16268
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 4, 2024
This applies the same change in openzfs#9115 to FreeBSD.  This was actually the
old behavior in FreeBSD 12; it only regressed when FreeBSD support was
added to OpenZFS.  As far as I can tell, the timeline went like this:

* Illumos's zfsvfs_teardown used an unconditional txg_wait_synced
* Illumos added the dirty data check [^4]
* FreeBSD merged in Illumos's conditional check [^3]
* OpenZFS forked from Illumos
* OpenZFS removed the dirty data check in openzfs#7795 [^5]
* @mattmacy forked the OpenZFS repo and began to add FreeBSD support
* OpenZFS PR openzfs#9115[^1] recreated the same dirty data check that Illumos
  used, in slightly different form.  At this point the OpenZFS repo did
  not yet have multi-OS support.
* Matt Macy merged in FreeBSD support in openzfs#8987[^2] , but it was based on
  slightly outdated OpenZFS code.

In my local testing, this vastly improves the reboot speed of a server
with a large pool that has 1000 datasets and is resilvering an HDD.

[^1]: openzfs#9115
[^2]: openzfs#8987
[^3]: freebsd/freebsd-src@10b9d77
[^4]: illumos/illumos-gate@5aaeed5
[^5]: openzfs#7795

Sponsored by: Axcient
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Alan Somers <asomers@gmail.com>
Closes openzfs#16268
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants