From: Alexander Block <ablock84@gmail.com>
To: Chen Yang <chenyang.fnst@cn.fujitsu.com>
Cc: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] Btrfs: send - sparse file support for btrfs-send mechanism
Date: Thu, 29 Nov 2012 09:54:49 +0100 [thread overview]
Message-ID: <CAB9VWqASM9E4pwbJbgFC4ZQFSJxbpYMrV-Opn73CyuZk_FDXrg@mail.gmail.com> (raw)
In-Reply-To: <1354158719-15615-1-git-send-email-chenyang.fnst@cn.fujitsu.com>
On Thu, Nov 29, 2012 at 4:11 AM, Chen Yang <chenyang.fnst@cn.fujitsu.com> wrote:
> when send/receive a sparse file, the holes of the original file
> will be filled with zero. The holes will be sent as ZERO streams,
> and it's unnecessary.
>
> So, I improved this by skipping the hole of file while sending.
>
> Signed-off-by: Cheng Yang <chenyang.fnst@cn.fujitsu.com>
> ---
> fs/btrfs/send.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index e78b297..1e1d59a 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -3718,6 +3718,7 @@ static int send_write_or_clone(struct send_ctx *sctx,
> u64 pos = 0;
> u64 len;
> u32 l;
> + u64 bytenr;
> u8 type;
>
> ei = btrfs_item_ptr(path->nodes[0], path->slots[0],
> @@ -3732,6 +3733,11 @@ static int send_write_or_clone(struct send_ctx *sctx,
> */
> len = PAGE_CACHE_ALIGN(len);
> } else {
> + bytenr = btrfs_file_extent_disk_bytenr(path->nodes[0], ei);
> + if (bytenr == 0) {
> + ret = 0;
> + goto out;
> + }
> len = btrfs_file_extent_num_bytes(path->nodes[0], ei);
> }
>
> --
> 1.7.7.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
This won't work for incremental sends if I understand it correctly. If
the hole got punched into the file after the initial send, the data
will be unchanged on the receiving side when receiving incrementally.
next prev parent reply other threads:[~2012-11-29 8:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-29 3:11 [PATCH] Btrfs: send - sparse file support for btrfs-send mechanism Chen Yang
2012-11-29 6:06 ` [PATCH] Btrfs: send - pre-allocated " Chen Yang
2012-11-29 8:55 ` Alexander Block
2012-12-01 18:39 ` Alex Lyakas
2012-11-29 8:54 ` Alexander Block [this message]
2013-01-08 16:06 ` [PATCH] Btrfs: send - sparse " Alex Lyakas
2013-01-08 20:11 ` Alex Lyakas
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=CAB9VWqASM9E4pwbJbgFC4ZQFSJxbpYMrV-Opn73CyuZk_FDXrg@mail.gmail.com \
--to=ablock84@gmail.com \
--cc=chenyang.fnst@cn.fujitsu.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).