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)
Oct 18 2024, 11:36 AM
Unknown Object (File)
Oct 12 2024, 9:14 AM
Unknown Object (File)
Sep 30 2024, 9:17 PM
Unknown Object (File)
Sep 20 2024, 1:52 AM
Unknown Object (File)
Sep 19 2024, 2:38 AM
Unknown Object (File)
Sep 18 2024, 7:06 PM
Unknown Object (File)
Sep 10 2024, 7:05 PM
Unknown Object (File)
Sep 8 2024, 7:02 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

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/kern/vfs_lookup.c
427

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
3024

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

sys/kern/vfs_lookup.c
427

Yes, the other caller only takes one ref.

How about renaming it to namei_get_root or similar instead?

sys/kern/vfs_subr.c
3024

ok, i'll create a separate review for this

sys/kern/vfs_lookup.c
427

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

sys/kern/vfs_lookup.c
427

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.