[Sheepdog] [PATCH 1/2] add oid_to_vnodes() and obj_to_sheeps() to avoid too much vnodes traverse

Christoph Hellwig hch at infradead.org
Tue May 15 09:09:09 CEST 2012


On Tue, May 15, 2012 at 11:18:13AM +0800, levin li wrote:
> I've noticed oid_to_vnode, I just keep it in case of future use,

Please don't.  Dead code bitrots, nevermind that people should use your
more optimal version for just about any use case.

> as for collie, I think I just ignored it, I'd like to replace it
> with obj_to_sheeps,
> but I don't think we should kill obj_to_sheep in recovery path, if we
> use obj_to_sheeps there, it means we need more calling to get_nth_node,
> I prefer to keep it.

obj_to_sheeps with nr_copies = 1 only calls get_nth_node once and also
is otherwise equivalent.  If you don't feel with adding nr_copies = 1
in recovery, maybe rewrite obj_to_sheep as:

static inline int obj_to_sheep(struct sd_vnode *entries, int nr_entries,
		uint64_t oid, int idx)
{
	int idx;

	obj_to_sheeps(entries, nr_entries, oid, 1, &idx);
	return idx;
}

to keep the implementation common.




More information about the sheepdog mailing list