Re: sema replacement
It looks like the code queues up a request and then uses sema_wait() to
sleep until the request either completes or fails. In both cases, the
code calls sema_post(). Maybe this is a better fit for messaging - i.e.
sema_wait would map to lwkt_waitport() and sema_post would map to
lwkt_sendmsg()?
Matthew Dillon wrote:
> :FreeBSD's new ATA code makes use of kernel counting semaphores (sema(9))
> :in the queuing code which don't seem to exist in DragonFly*. I think the
> :serializing tokens are the replacement and wanted to see if a) that was
> :the right approach and if so, b) do you use lockmgr or is it preferable
> :to use the tokens directly. TIA
> :
> :* though, there does seem to be a private implementation in ffs_softdep.c
> :
> :--
> :Chuck Tuffli
> :Agilent Technologies
>
> I would say we want to use tokens for now. The ATA driver core should
> be mostly non-blocking, at least presuming that sos hasn't added
> mallocs in the middle of the code (like existed in the original 4.x
> driver). This makes the token model a better fit.
>
> I won't even ask why they are using yet another (this is like the
> 8th or 9th now) locking API. Semaphores don't really fit the model for
> the type of locking they need.
>
> -Matt
> Matthew Dillon
> <dillon@backplane.com>
--
Chuck Tuffli
Agilent Technologies
討論串 (同標題文章)