Re: [PATCH 2/4 v2] Btrfs-progs: send, implement total data size callback and progress report

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

 



On Wed, Apr 16, 2014 at 03:56:15PM +0100, Filipe David Borba Manana wrote:
> V2: Added new send ioctl flag BTRFS_SEND_FLAG_SUPPORT_FALLOCATE. A version 2
>     stream is now only produced is the ioctl caller specifies at least one of
>     the new send flags (BTRFS_SEND_FLAG_SUPPORT_FALLOCATE or
>     BTRFS_SEND_FLAG_CALCULATE_DATA_SIZE).

Good.

> @@ -156,6 +165,12 @@ static int process_subvol(const char *path, const u8 *uuid, u64 ctransid,
>  		goto out;
>  
>  	r->cur_subvol = calloc(1, sizeof(*r->cur_subvol));
> +	r->total_data_size = 0;
> +	r->bytes_received = 0;
> +	r->progress = 0.0;
> +	r->last_progress_update = 0;
> +	r->bytes_received_last_update = 0;
> +	r->target = "Subvolume";
>  
>  	if (strlen(r->dest_dir_path) == 0)
>  		r->cur_subvol->path = strdup(path);
> @@ -205,6 +220,12 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid,
>  		goto out;
>  
>  	r->cur_subvol = calloc(1, sizeof(*r->cur_subvol));
> +	r->total_data_size = 0;
> +	r->bytes_received = 0;
> +	r->progress = 0.0;
> +	r->last_progress_update = 0;
> +	r->bytes_received_last_update = 0;
> +	r->target = "Snapshot";

Nontrivial amount of duplicate code, a helper would be better.

> @@ -673,7 +679,7 @@ out:
>  }
>  
>  const char * const cmd_send_usage[] = {
> -	"btrfs send [-ve] [-p <parent>] [-c <clone-src>] [-f <outfile>] <subvol> [<subvol>...]",
> +	"btrfs send [-veo] [-p <parent>] [-c <clone-src>] [-f <outfile>] <subvol> [<subvol>...]",
>  	"Send the subvolume(s) to stdout.",
>  	"Sends the subvolume(s) specified by <subvol> to stdout.",
>  	"By default, this will send the whole subvolume. To do an incremental",
> @@ -697,5 +703,9 @@ const char * const cmd_send_usage[] = {
>  	"-f <outfile>     Output is normally written to stdout. To write to",
>  	"                 a file, use this option. An alternative would be to",
>  	"                 use pipes.",
> +	"-o               Obtain the total data size for each subvolume or ",

UI:

-o is sometimes used as an option for 'output', which makes sense in
context of send, but is already done via -f. I'm not sure if it's a good
choice. 'p' is already occupied.

As an alternative: how about -s ? mnemonic for 'size'.

> +	"                 snapshot to send. This demands additional processing",
> +	"                 (mostly IO bound) but is useful for the receive ",
> +	"                 command to report progress.",
>  	NULL
>  };
--
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