Page MenuHomeFreeBSD

fix kernel linking without FFS
ClosedPublic

Authored by glebius on Jun 15 2020, 6:05 PM.

Details

Summary

In r361491 regression was introduced: a kernel without optios FFS,
but with GEOM_LABEL would not link. The reason is that ffs_subr.c
might be used outside of FFS module.

This patch moves several functions from ffs_subr.c to ffs_vfsops.c.
There are no functional changes inside.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

chs added a reviewer: mckusick.

Gleb asked me to commit this so that git blame will still blame me. :-)
The diff looks fine to me, adding kirk as a reviewer also.

This revision is now accepted and ready to land.Jun 16 2020, 4:46 PM

Rather than moving all these functions from a file in which they logically belong to one in which they do not, how about we just put #ifdef FFS around the _KERNEL part. This produces minimal changes, leaves things where they logically belong, and reduces the size of the extra copy of ffs_subr.o.

Why do these functions logically belong to ffs_subr? The ffs_load_inode() definitely belongs to ffs_vfsops since it is used only there and with the change it becomes static. Other moved functions are associated with unmounting, which IMHO also belongs to vfsops rather than to subr. What else outside of real FFS code is going to use them? AFAIU, the code that is ffs_subr is something that is shared between real FFS, non-kernel code and GEOM_LABEL.

On further though, I agree with you that ffs_subr.c should only be shared functions.

My new proposal is to move all of the _KERNEL functions in ffs_subr.c to ffs_vfsops.c. My new rationale is that they are either used only in ffs_vfsops.c (ffs_blkatoff, ffs_load_inode, ffs_check_blkno) or they are the new functions that have to do with forcible unmounting which is in the purview of ffs_vfsops.c. It would let you declare ffs_blkatoff, ffs_load_inode, and ffs_check_blkno as static and drop them from ffs_extern.h.