On Thu, Nov 29, 2012 at 7:06 AM, Chen Yang <chenyang.f...@cn.fujitsu.com> wrote:
> From 4222aa3a32cf4db161fcbbb87ad29b714f1bfaf2 Mon Sep 17 00:00:00 2001
> From: Chen Yang <chenyang.f...@cn.fujitsu.com>
> Date: Thu, 29 Nov 2012 13:22:09 +0800
> Subject: [PATCH] Btrfs: send - pre-allocated file  support for btrfs-send
>  mechanism
>
> when send or receive a file which has pre-allocated part,
> the pre-allocated parts of the file will be sent as ZERO streams,
> and it's unnecessary.
>
> So we can improve this by skip these EMPTY parts.
>
> Signed-off-by: Cheng Yang <chenyang.f...@cn.fujitsu.com>
> ---
> this patch is based on
> "Btrfs: send - sparse file support for btrfs-send mechanism"
> ---
>  fs/btrfs/send.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
> index 1e1d59a..2d23184 100644
> --- a/fs/btrfs/send.c
> +++ b/fs/btrfs/send.c
> @@ -3732,13 +3732,18 @@ static int send_write_or_clone(struct send_ctx *sctx,
>                  * sure to send the whole thing
>                  */
>                 len = PAGE_CACHE_ALIGN(len);
> -       } else {
> +       } else if (type == BTRFS_FILE_EXTENT_REG) {
>                 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);
> +       } else if (type == BTRFS_FILE_EXTENT_PREALLOC) {
> +               ret = 0;
> +               goto out;
> +       } else {
> +               BUG();
>         }
>
>         if (offset + len > sctx->cur_inode_size)
> --
> 1.7.7.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

The same as in my previous mail applies here.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to