Page MenuHomeFreeBSD

kern: osd: abstract away the math for locating a slot method
AcceptedPublic

Authored by kevans on Dec 14 2024, 4:21 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 29, 10:07 AM
Unknown Object (File)
Sep 14 2025, 12:25 AM
Unknown Object (File)
Sep 12 2025, 10:27 AM
Unknown Object (File)
Sep 8 2025, 6:23 PM
Unknown Object (File)
Sep 6 2025, 4:52 PM
Unknown Object (File)
Sep 5 2025, 2:43 AM
Unknown Object (File)
Sep 4 2025, 3:33 PM
Unknown Object (File)
Aug 21 2025, 5:31 AM
Subscribers

Details

Reviewers
markj
jamie
pjd
imp
Summary

It's relatively simple, but we'll do it a couple of times; pull it
out into a macro.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 63602
Build 60486: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Dec 14 2024, 4:42 AM

I'd prefer it to take the slot number, and do the "slot - 1" translation in the macro. That came to mind looking at D48075 which passes in slot - 1.

That prompted a quick scan of kern_osd.c, which has a lot of "i" starting at zero, and "i + 1" to refer to the slot number. But then osd_exit has 1 one-based "i", with "i - 1" referring to the slot index. and osd_init has "i" being the type and hiding its zero-based-ness with OSD_FIRST. This all seems to be an off-by-one waiting to happen.

This revision now requires changes to proceed.Dec 14 2024, 4:47 AM

Update based on jamie's feedback, take a slot number instead of index

Future work will see if we can cleanup some other bits to mitigate some
potential fragility.

This revision is now accepted and ready to land.Apr 21 2025, 4:29 PM