[sheepdog] [PATCH 3/6] sheep, sockfd cache: cache more than one FD for each node
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Mon Jun 25 07:44:26 CEST 2012
At Sun, 24 Jun 2012 20:51:50 +0800,
Liu Yuan wrote:
> +
> +/*
> + * Grab a free slot of the node and inc the refcount of the slot
> + *
> + * If no free slot available, this typically means we should use short FD.
> + */
> +static struct sockfd_cache_entry *sockfd_cache_grab(struct node_id *nid,
> + char *name, int *ret_idx)
> {
> struct sockfd_cache_entry *entry;
>
> pthread_rwlock_rdlock(&sockfd_cache.lock);
> entry = sockfd_cache_search(nid);
> - pthread_rwlock_unlock(&sockfd_cache.lock);
> - assert(entry);
> - /* if refcount == 0, set it to 1, otherwise someone holds it */
> - if (uatomic_cmpxchg(&entry->refcount, 0, 1))
> - return NULL;
> + if (!entry){
Space required before '{'.
Thanks,
Kazutaka
More information about the sheepdog
mailing list