Page MenuHomeFreeBSD

geom: disk_alloc_nowait will allocate a disk structure w/o sleeping
AbandonedPublic

Authored by imp on Mar 9 2021, 8:29 PM.
Tags
None
Referenced Files
F157170862: D29162.diff
Tue, May 19, 12:27 AM
Unknown Object (File)
Tue, Apr 21, 2:02 PM
Unknown Object (File)
Apr 16 2026, 4:14 AM
Unknown Object (File)
Apr 12 2026, 2:38 AM
Unknown Object (File)
Apr 8 2026, 3:31 AM
Unknown Object (File)
Apr 6 2026, 7:08 AM
Unknown Object (File)
Apr 5 2026, 1:24 PM
Unknown Object (File)
Mar 21 2026, 3:10 AM
Subscribers
None

Details

Reviewers
kevans
glebius
ken
mav
scottl
phk
Group Reviewers
manpages
Summary

disk_alloc_nowait is just like disk_alloc, but won't wait for memory and may
return NULL. It's for drivers that need to create a disk from a non-sleepable
context.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 37707
Build 34596: arc lint + arc unit

Event Timeline

imp requested review of this revision.Mar 9 2021, 8:29 PM

I would probably just have added the flags argument to disk_alloc()...

Otherwise no comments.

In D29162#653000, @phk wrote:

I would probably just have added the flags argument to disk_alloc()...

I thought about that, but opted for this route because I didn't want to change a 2 dozen other places in the tree. And I kinda wanted to be able to MFC these changes too...

On second thought, I'm going to abandon this approach and schedule the cam register routine into a taskqueue so we can sleep. There's no good retry mechanism here, and adding one would make things more complicated. We can switch to waiting for memory to have a more robust system with simpler code. This also matches at least some of the feedback I've received privately (thanks Chuck). I'll post that review when I have it done.