Skip to content

Add support for FreeBSD - #8987

Merged
behlendorf merged 1 commit into
openzfs:masterfrom
zfsonfreebsd:projects/pr-rebase
Apr 14, 2020
Merged

behlendorf merged 1 commit into
openzfs:masterfrom
zfsonfreebsd:projects/pr-rebase

Conversation

@mattmacy

@mattmacy mattmacy commented Jul 3, 2019 •

Copy link
Copy Markdown
Contributor

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
@mattmacy
mattmacy force-pushed the projects/pr-rebase branch from 673caef to d51c99b Compare July 3, 2019 00:20
Comment thread include/sys/abd.h
uint_t abd_nents;
struct scatterlist *abd_sgl;
#endif
} abd_scatter;

Copy link
Copy Markdown
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

@behlendorf behlendorf Jul 3, 2019 •

Copy link
Copy Markdown
Contributor

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.

@mattmacy
mattmacy force-pushed the projects/pr-rebase branch from d51c99b to e0f971d Compare July 3, 2019 00:32
@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
@mattmacy
mattmacy force-pushed the projects/pr-rebase branch from d63de7c to ff98df6 Compare July 8, 2019 21:53
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

richardelling commented Jul 10, 2019 •

Copy link
Copy Markdown
Contributor

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.

@mattmacy
mattmacy force-pushed the projects/pr-rebase branch from 7db8ab1 to 774a635 Compare July 11, 2019 01:05
Comment thread Makefile.am Outdated
Comment thread README.md Outdated
Comment thread cmd/arc_summary/arc_summary2
Comment thread cmd/arc_summary/arc_summary2 Outdated
Comment thread config/always-sed.m4
Comment thread copy-builtin
@mattmacy
mattmacy force-pushed the projects/pr-rebase branch 8 times, most recently from 9b19313 to 4e4e10c Compare July 21, 2019 22:58
@mattmacy
mattmacy force-pushed the projects/pr-rebase branch 5 times, most recently from 914cfb4 to 0b4ee27 Compare October 26, 2019 00:03
@mattmacy
mattmacy force-pushed the projects/pr-rebase branch 9 times, most recently from 1e0a9ce to 04be8b3 Compare November 1, 2019 19:19
@mattmacy
mattmacy force-pushed the projects/pr-rebase branch 4 times, most recently from 323f22a to 30e03ce Compare November 28, 2019 01:05
@mattmacy
mattmacy force-pushed the projects/pr-rebase branch 2 times, most recently from 3a00066 to 2d0ea9b Compare December 3, 2019 21:42
@lundman

lundman commented Dec 4, 2019

Copy link
Copy Markdown
Contributor

I think maybe ./include/sys/avl.h and ./include/os/freebsd/spl/sys/avl.h are nearly identical and the former could be made to work for both. But if it is intentionally meant to replace, then ignore me :)

@kithrup kithrup left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This mostly looks good to me. (Only "mostly" because it's so large that I can't say I didn't miss some. Mostly I looked at the changes, and I'd already been looking at the new files over time.)

@rlaager

rlaager commented Dec 14, 2019

Copy link
Copy Markdown
Member

We can probably close #898 once this is merged.

@mattmacy

Copy link
Copy Markdown
Contributor Author

We can probably close #898 once this is merged.

Ask @lundman as he has targets that deviate the most from Linux. Certainly adding OS #3 will be vastly less time consuming than OS #2 was.

Comment thread _config.yml Outdated
Comment thread Makefile.am Outdated
Comment thread .gitignore Outdated
Comment thread .gitignore Outdated
Comment thread cmd/zpool/Makefile.am Outdated
Comment thread config/kernel.m4
Comment thread configure.ac Outdated
Comment thread contrib/Makefile.am
Comment thread include/os/Makefile.am
Comment thread scripts/zfs-tests.sh
Comment thread module/os/freebsd/spl/spl_taskq.c Outdated
@codecov-io

codecov-io commented Apr 9, 2020 •

Copy link
Copy Markdown

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.

- 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
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