[sheepdog] [PATCH] sheep: add simple_store driver again

Liu Yuan namei.unix at gmail.com
Fri Aug 24 09:57:37 CEST 2012


On 08/23/2012 10:58 PM, MORITA Kazutaka wrote:
> +static int simple_store_read_from_path(uint64_t oid, char *path,
> +				       struct siocb *iocb)
> +{
> +	int flags = def_open_flags, fd, ret = SD_RES_SUCCESS;
> +	ssize_t size;
> +
> +	if (!is_data_obj(oid))
> +		flags &= ~O_DIRECT;
> +
> +	fd = open(path, flags);
> +
> +	if (fd < 0)
> +		return err_to_sderr(oid, errno);
> +
> +	size = xpread(fd, iocb->buf, iocb->length, iocb->offset);
> +	if (size != iocb->length) {
> +		ret = SD_RES_EIO;
> +		goto out;
> +	}
> +out:
> +	close(fd);
> +
> +	return ret;
> +}

Now store driver can get multiple requests to the same object, so we
need flock for read/write as farm does, no?

Thanks,
Yuan



More information about the sheepdog mailing list