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

Kai Zhang kyle at zelin.io
Sun Jun 30 08:53:39 CEST 2013


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

> +static int discard(int fd, uint64_t start, uint32_t end)
> +{
> +	int ret = xfallocate(fd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE,
> +			     start, end - start);
> +	if (ret < 0) {
> +		if (errno == ENOSYS || errno == EOPNOTSUPP)
> +			sd_iprintf("FALLOC_FL_PUNCH_HOLE is not supported "
> +				   "on this filesystem");
> +		else
> +			sd_eprintf("failed to discard object, %m");
> +	}
> +
> +	return ret;
> +}

Is there a way to check the supports of FALLOC_FL_PUNCH_HOLE at compile time?
So that we can reduce some unnecessary operations.

However, if there is a way, we can implement it in a separate patch.

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


More information about the sheepdog mailing list