linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Filipe David Borba Manana <fdmanana@gmail.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/4 v2] Btrfs-progs: send, implement total data size callback and progress report
Date: Wed, 16 Apr 2014 19:43:16 +0200	[thread overview]
Message-ID: <20140416174316.GD29256@twin.jikos.cz> (raw)
In-Reply-To: <1397660175-8005-1-git-send-email-fdmanana@gmail.com>

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
>  };

  reply	other threads:[~2014-04-16 17:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15 16:40 [PATCH 1/4] Btrfs-progs: send, bump stream version Filipe David Borba Manana
2014-04-15 16:40 ` [PATCH 2/4] Btrfs-progs: send, implement total data size callback and progress report Filipe David Borba Manana
2014-04-16 14:56   ` [PATCH 2/4 v2] " Filipe David Borba Manana
2014-04-16 17:43     ` David Sterba [this message]
2014-04-16 18:07       ` Filipe David Manana
2014-04-16 19:57   ` [PATCH 2/4 v3] " Filipe David Borba Manana
2014-04-20 14:10   ` [PATCH 2/4 v4] " Filipe David Borba Manana
2014-04-15 16:40 ` [PATCH 3/4] Btrfs-progs: send, implement fallocate command callback Filipe David Borba Manana
2014-04-16 14:57   ` [PATCH 3/4 v2] " Filipe David Borba Manana
2014-04-16 19:58   ` [PATCH 3/4 v3] " Filipe David Borba Manana
2014-04-18 17:41     ` David Sterba
2014-04-18 20:02       ` Filipe David Manana
2014-04-20 14:12   ` [PATCH 3/4 v4] " Filipe David Borba Manana
2014-04-15 16:40 ` [PATCH 4/4] Btrfs-progs: add write and clone commands debug info to receive Filipe David Borba Manana
2014-04-16 14:58   ` [PATCH 4/4 v2] " Filipe David Borba Manana
2014-04-16 14:54 ` [PATCH 1/4 v2] Btrfs-progs: send, bump stream version Filipe David Borba Manana
2014-04-20 14:09 ` [PATCH 1/4 v3] " Filipe David Borba Manana
2014-05-02 15:22 ` [PATCH 1/4] " David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140416174316.GD29256@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=fdmanana@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).