Page MenuHomeFreeBSD

vfs: save on atomics on the root vnode for absolute lookups
ClosedPublic

Authored by mjg on Jan 30 2020, 10:35 AM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 23 2024, 8:34 AM
Unknown Object (File)
Dec 20 2023, 2:33 AM
Unknown Object (File)
Dec 17 2023, 12:06 PM
Unknown Object (File)
Dec 2 2023, 2:31 PM
Unknown Object (File)
May 14 2023, 6:47 PM
Unknown Object (File)
May 4 2023, 1:49 PM
Unknown Object (File)
Apr 25 2023, 7:07 PM
Unknown Object (File)
Apr 23 2023, 10:21 AM
Subscribers

Details

Summary

There are 2 back-to-back atomics on the vnode, but we can check upfront if one is sufficient. Similarly we can handle relative lookups where current working directory == root directory.

Note lookup would be best off never unrefing the root vnode, but that's for later.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/kern/vfs_lookup.c
422 ↗(On Diff #67502)

So why not do this part in namei_handle_root() ? Because other places do not need v_usecount += 2, only += 1 ? Perhaps add a flag to namei_handle_root() then to select a variant, or pass 'n' to it directly.

sys/kern/vfs_subr.c
3025 ↗(On Diff #67502)

You _must_ document all vref variants, even if only in the source code. VNASSERTs are not enough.

sys/kern/vfs_lookup.c
422 ↗(On Diff #67502)

Yes, the other caller only takes one ref.

How about renaming it to namei_get_root or similar instead?

sys/kern/vfs_subr.c
3025 ↗(On Diff #67502)

ok, i'll create a separate review for this

sys/kern/vfs_lookup.c
422 ↗(On Diff #67502)

Instead of adding the arg ? My point is that removing vrefact() from name_handle/get_root is unfortunate.

sys/kern/vfs_lookup.c
422 ↗(On Diff #67502)

well changing the name from 'handle' (which suggests everything is taken care of) to something which is more natural to only return the pointer was supposed to help here. if have other pending changes which imo will look better if refcount handling is moved away from that primitive, hence the patch in this form

  • comment on postponing refing
  • move vrefactn to namei_handle_root
This revision is now accepted and ready to land.Jan 31 2020, 11:31 AM
This revision was automatically updated to reflect the committed changes.