[sheepdog] [PATCH v3 2/8] sheep: use new sockfd cache

Christoph Hellwig hch at infradead.org
Tue Jun 26 11:53:38 CEST 2012


I think this should be part of patch 1, it's not really useful as a
separate patch.

> +struct write_info {
> +	struct pollfd pfds[SD_MAX_REDUNDANCY];
> +	struct sd_vnode *vnodes[SD_MAX_REDUNDANCY];
> +};

I think this was mentioned in a previous review, but please make sure
to only have one array of a complex type here, especially with more
members getting added later, not only does this avoids multiple calls
to memmove, but it also generally makes things a lot more type safe
by being able to pass the sub-structe.

struct write_info {
	struct write_info_end {
		struct pollfd pfd;
		struct sd_vnode *vnode;
	} ent[3];
};

In the final version struct sd_vnode really should become a struct
node_id here, btw,

> +	memset(&wi, 0, sizeof(wi));
> +	for (i = 0; i < SD_MAX_REDUNDANCY; i++)
> +		wi.pfds[i].fd = -1;

This should be wrapped in a (probably inline) write_info_init() helper.




More information about the sheepdog mailing list