[sheepdog] [PATCH v2 4/7] md: add hot-plug and hot-unplug support

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Wed Apr 3 06:47:20 CEST 2013


At Fri, 29 Mar 2013 13:49:41 +0800,
Liu Yuan wrote:
> 
> +uint32_t md_get_info(struct sd_md_info *info)
> +{
> +	uint32_t ret = sizeof(*info);
> +	int i;
> +
> +	memset(info, 0, ret);
> +	pthread_rwlock_rdlock(&md_lock);
> +	for (i = 0; i < md_nr_disks; i++) {
> +		info->disk[i].idx = i;
> +		pstrcpy(info->disk[i].path, PATH_MAX, md_disks[i].path);
> +		info->disk[i].size = get_path_size(info->disk[i].path,
> +						   &info->disk[i].used);
> +		if (!info->disk[i].size) {
> +			ret = 0;
> +			break;

How about removing the broken disk here and continuing the loop?  I
looks much better than returning an error to the user.

Thanks,

Kazutaka



More information about the sheepdog mailing list