Page MenuHomeFreeBSD

vfs: add MNT_VNODE_FOREACH_ACTIVE_FILTER
AbandonedPublic

Authored by mjg on Dec 5 2019, 2:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 13, 6:02 AM
Unknown Object (File)
Sun, Dec 8, 12:54 PM
Unknown Object (File)
Oct 23 2024, 2:53 PM
Unknown Object (File)
Oct 23 2024, 2:53 PM
Unknown Object (File)
Oct 23 2024, 2:35 PM
Unknown Object (File)
Oct 9 2024, 1:26 AM
Unknown Object (File)
Sep 28 2024, 4:31 PM
Unknown Object (File)
Sep 21 2024, 7:40 PM
Subscribers

Details

Reviewers
jeff
kib
Summary

The current iterator always ends up taking the interlock without letting the caller decide if it wants to do anything with the vnode upfront. In particular vfs_msync tends to not need to do anything.

This functionality is motivated by a different (to be proposed) patch which will end up adding vnodes to the active list.

The use in vfs_msync will be committed separately. Note the checks are now duplicated but will become useful with further patches and I don't think removing this right now adds much benefit.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 27980

Event Timeline

sys/kern/vfs_subr.c
4344

The racy unlocked check is fine since obj is type-stable.

The cases that I looked at could be solved by using vhold() instead of the interlock. In the case that you're already iterating over the active list, you know you don't have to activate the vnode. You should be able to return it with an atomic increment of the hold count and let the caller vdrop. For most callers this is sufficient. For UFS where it wants to dig around in the inode it may need to acquire the vnode interlock to prevent races with RECLAIM().

ufs_inode would actually make a good use case for uma_smr. It would eliminate some interlock activity.

sys/kern/vfs_subr.c
4344

Please add a comment documenting that you require the type stability of vm objects here. There has been discussion around resolving these cases.

Note the entire point of introduction of filtering is to use it later to sort out VI_DEFERRED vnodes in stable/12. Clearing the flag would require taking the interlock anyway. Moreover I don't expect this macro in this form to survive in the long term in head either. Thus I don't think proposed change is of use, at least not in the first cut in the tree.

sys/kern/vfs_subr.c
4344

ok