[ofa-general] Re: [PATCH v2 2/4] rdma/cma: simplify locking neededfor serialization of callbacks

Sean Hefty sean.hefty at intel.com
Tue Jul 8 11:55:27 PDT 2008


>why don't you just do
>
>	if (cma_disable_callback(id_priv, CMA_ADDR_BOUND) &&
>	    cma_disable_callback(id_priv, CMA_ADDR_RESOLVED))
>
>instead of open-coding here?  (&& is specified to have short-circuit
>semantics, so if the first call takes the mutex, the second call won't
>be made)
>
>It seems your change is a subtle change in semantics and breaks the
>encapsulation of this callback disabling here.

Personally, I'm fine either way.  This method can acquire/release the mutex
twice, though that's not a big deal.  If we want better encapsulation, we could
also add a cma_enable_callback wrapper around the mutex_unlock.

- Sean




More information about the general mailing list