From: Josef Bacik <jbacik@fb.com>
To: Filipe David Borba Manana <fdmanana@gmail.com>,
<linux-btrfs@vger.kernel.org>
Subject: Re: [RFC PATCH] Btrfs: send, add calculate data size flag to allow for progress estimation
Date: Mon, 7 Apr 2014 11:25:54 -0400 [thread overview]
Message-ID: <5342C382.8000709@fb.com> (raw)
In-Reply-To: <1396624841-1363-1-git-send-email-fdmanana@gmail.com>
On 04/04/2014 11:20 AM, Filipe David Borba Manana wrote:
> This new send flag makes send calculate first the amount of new file data (in bytes)
> the send root has relatively to the parent root, or for the case of a non-incremental
> send, the total amount of file data we will send through the send stream. In other words,
> it computes the sum of the lengths of all write and clone operations that will be sent
> through the send stream.
>
> This data size value is sent in a new command, named BTRFS_SEND_C_TOTAL_DATA_SIZE, that
> immediately follows a BTRFS_SEND_C_SUBVOL or BTRFS_SEND_C_SNAPSHOT command, and precedes
> any command that changes a file or the filesystem hierarchy. Upon receiving a write or
> clone command, the receiving end can increment a counter by the data length of that
> command and therefore report progress by comparing the counter's value with the data size
> value received in the BTRFS_SEND_C_TOTAL_DATA_SIZE command.
>
> The approach is simple, before the normal operation of send, do a scan in the file system
> tree for new inodes and file extent items, just like in send's normal operation, and keep
> incrementing a counter with new inodes' size and the size of file extents that are going
> to be written or cloned. This is actually a simpler and more lightweight tree scan/processing
> than the one we do when sending the changes, as it doesn't process inode references nor does
> any lookups in the extent tree for example.
>
> After modifying btrfs-progs to understand this new command and report progress, here's an
> example (the -o flag tells btrfs send to pass the new flag to the kernel's send ioctl):
>
> $ btrfs send -o /mnt/sdd/base | btrfs receive /mnt/sdc
> At subvol /mnt/sdd/base
> At subvol base
> About to receive 9211507211 bytes
> Subvolume/snapshot /mnt/sdc//base, progress 24.73%, 2278015008 bytes received (9211507211 total bytes)
>
> $ btrfs send -o -p /mnt/sdd/base /mnt/sdd/incr | btrfs receive /mnt/sdc
> At subvol /mnt/sdd/incr
> At snapshot incr
> About to receive 9211747739 bytes
> Subvolume/snapshot /mnt/sdc//incr, progress 63.42%, 5843024211 bytes received (9211747739 total bytes)
>
So if we are going to add a new command we want to rev the
btrfs_stream_header->version so that the old receive command doesn't
blow up. Also if we're going to rev the version we want to go ahead and
add an FALLOCATE and PUNCH command as well so we can stop this silly
sending zero's stuff and just send down PREALLOC extents as fallocate
and new holes as a punch command. Then we only have to rev the version
once for a bunch of new commands. Thanks,
Josef
prev parent reply other threads:[~2014-04-07 15:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-04 15:20 [RFC PATCH] Btrfs: send, add calculate data size flag to allow for progress estimation Filipe David Borba Manana
2014-04-04 14:52 ` Konstantinos Skarlatos
2014-04-04 15:59 ` Filipe David Manana
2014-04-04 15:53 ` David Sterba
2014-04-04 16:01 ` Filipe David Manana
2014-04-04 16:32 ` David Sterba
2014-04-06 0:18 ` Marc MERLIN
2014-04-06 16:57 ` Filipe David Manana
2014-04-06 17:20 ` Marc MERLIN
2014-04-07 15:25 ` Josef Bacik [this message]
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=5342C382.8000709@fb.com \
--to=jbacik@fb.com \
--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).