[Sheepdog] [PATCH 1/4] farm: avoid unnecessary IO operation when recovering

Liu Yuan namei.unix at gmail.com
Fri Mar 30 05:33:11 CEST 2012


On 03/30/2012 11:12 AM, Li Wenpeng wrote:

> +static void *read_working_object(uint64_t oid, int length)
> +{
> +	void *buf = NULL;
> +	char path[PATH_MAX];
> +	int fd, ret;
> +
> +	snprintf(path, sizeof(path), "%s%016" PRIx64, obj_path, oid);
> +
> +	fd = open(path, O_RDONLY, def_fmode);
> +	if (fd < 0) {
> +		eprintf("failed to open %s: %m\n", path);
> +		goto out;
> +	}
> +
> +	buf = malloc(length);


Use valloc because we are supposed support Direct IO operation.

Thanks,
Yuan



More information about the sheepdog mailing list