[sheepdog] [PATCH v4] cluster: change the interface of distributed lock

Liu Yuan namei.unix at gmail.com
Mon Dec 9 10:35:37 CET 2013


On Mon, Dec 09, 2013 at 05:18:30PM +0800, Robin Dong wrote:
> From: Robin Dong <sanbai at taobao.com>
> 
> Using only lock_id as parameter of lock interface and reduce function to only
> two:
> 
> 	lock(uint64_t lock_id)
> 	unlock(uint64_t lock_id)
> 
> The ->lock will create and acquire the distributed lock and ->unlock will
> release it which is more convient for end user.
> We use existed hash table to store the "<lock_id, cluster_lock*>" and release
> all the resources of a distributed lock after all threads call "->unlock".
> 
> v3 --> v4:
> 	1. move new function after zk_helpers.
> 	2. if znode is not exists, the zk_unlock will success.

Applied after removing unnecessary forward declaration. Thanks

Yuan



More information about the sheepdog mailing list