]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Btrfs: send, build path string only once in send_hole
authorFilipe Manana <fdmanana@gmail.com>
Mon, 31 Mar 2014 13:52:14 +0000 (14:52 +0100)
committerChris Mason <clm@fb.com>
Mon, 7 Apr 2014 16:08:46 +0000 (09:08 -0700)
There's no point building the path string in each iteration of the
send_hole loop, as it produces always the same string.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/send.c

index e8e9f354f341c61cf82fe55727a4f821f1094ba5..1ac3ca98c4294ae54781f97931278386e8bb4bcc 100644 (file)
@@ -4436,14 +4436,14 @@ static int send_hole(struct send_ctx *sctx, u64 end)
        p = fs_path_alloc();
        if (!p)
                return -ENOMEM;
+       ret = get_cur_path(sctx, sctx->cur_ino, sctx->cur_inode_gen, p);
+       if (ret < 0)
+               goto tlv_put_failure;
        memset(sctx->read_buf, 0, BTRFS_SEND_READ_SIZE);
        while (offset < end) {
                len = min_t(u64, end - offset, BTRFS_SEND_READ_SIZE);
 
                ret = begin_cmd(sctx, BTRFS_SEND_C_WRITE);
-               if (ret < 0)
-                       break;
-               ret = get_cur_path(sctx, sctx->cur_ino, sctx->cur_inode_gen, p);
                if (ret < 0)
                        break;
                TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, p);