[sheepdog] [PATCH v2 08/11] sheep: introduce sparse objects

Kai Zhang kyle at zelin.io
Sun Jun 30 09:37:21 CEST 2013


On Jun 19, 2013, at 1:14 AM, MORITA Kazutaka <morita.kazutaka at gmail.com> wrote:

> -	if (iocb->offset != 0 || iocb->length != get_objsize(oid)) {
> -		ret = prealloc(fd, get_objsize(oid));
> +	trim_zero_blocks(iocb->buf, &offset, &len);
> +
> +	if (offset != 0 || len != get_objsize(oid)) {
> +		if (is_sparse_object(oid))
> +			ret = xftruncate(fd, get_objsize(oid));
> +		else
> +			ret = prealloc(fd, get_objsize(oid));
> +
> 		if (ret < 0) {
> 			ret = err_to_sderr(path, oid, errno);
> 			goto out;
> 		}
> 	}

Would you like to explain why we should use xftruncate if the object is sparse?
Based on my understanding, fd is pointed to a new file, there should be no 
difference between xfruncate and prealloc.

Thanks,
Kyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20130630/e550e5cb/attachment-0004.html>


More information about the sheepdog mailing list