Re: [PATCH 2/9] btrfs-progs: no pending balance is not an error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 05, 2013 at 01:54:56PM +0800, Anand Jain wrote:
> --- a/cmds-balance.c
> +++ b/cmds-balance.c
> @@ -662,8 +662,12 @@ static int cmd_balance_status(int argc, char **argv)
>  	close(fd);
>  
>  	if (ret < 0) {
> +		if (e == ENOTCONN) {
> +			printf("No balance found on '%s'\n", path);
> +			return 0;
> +		}
>  		fprintf(stderr, "ERROR: balance status on '%s' failed - %s\n",
> -			path, (e == ENOTCONN) ? "Not in progress" : strerror(e));

I'm not sure if we want to change the error code if balance is not in
progress. That's the only way to find out if it is so.

Let's say that I have this shell code as a balance monitor and expect it
to finish when the balance finishes:

while btrfs fi balance status; do
	sleep 5;
done

not possible after your change. What we can do is to differentiate the
status by a different error code number, let's say 1 for an error and 2
for 'not in progress'.

> +			path, strerror(e));
>  		return 19;
>  	}
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux