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

Kai Zhang kyle at zelin.io
Sun Jun 30 09:11:39 CEST 2013


On Jun 30, 2013, at 2:53 PM, Kai Zhang <kyle at zelin.io> wrote:

> 
> 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.
> 

On the second though, support of FALLOC_FL_PUNCH_HOLE is based on filesystem and
maybe not easy to be decided at compile time.
And the static variable "trim_is_supported" can avoid unnecessary checks.

However, if md is enabled, a single variable "trim_is_supported" is not powerful enough.
Seems no easy way to mark each disk if it can support FALLOC_FL_PUNCH_HOLE.

Thanks,
Kyle


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


More information about the sheepdog mailing list