[LTP] [PATCH] tst_fill_fs: enhance the filesystem filling routine

Jan Stancek jstancek@redhat.com
Tue Nov 19 12:07:27 CET 2019



----- Original Message -----
> -		while (len) {
> +		while (len >= fi.f_bsize) {

Let's say f_bsize is 512, and len is 1023. We hit ENOSPC for 1023,
len for next round is 511. Loop ends, but we never tried write with
f_bsize or smaller value.

I think we should try len < fi.f_bsize at least once.

>  			ret = write(fd, buf, MIN(len, sizeof(buf)));
>  
>  			if (ret < 0) {
> +				if (errno == ENOSPC) {
> +					len /= 2;
> +					continue;
> +				}

The return below (in original code) doesn't appear to be reachable now.



More information about the ltp mailing list