diff options
author | Filipe Manana <fdmanana@gmail.com> | 2014-03-31 09:52:14 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-04-07 12:08:46 -0400 |
commit | c715e155c94ba0b3657820d676ec3c7213a5ce81 (patch) | |
tree | 2d90c2a1db76bbaeb6074e4ac9f9c2818fd5e136 | |
parent | 9a40f1222a372de77344d85d31f8fe0e1c0e60e7 (diff) |
Btrfs: send, build path string only once in send_hole
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>
-rw-r--r-- | fs/btrfs/send.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index e8e9f354f341..1ac3ca98c429 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -4436,6 +4436,9 @@ static int send_hole(struct send_ctx *sctx, u64 end) | |||
4436 | p = fs_path_alloc(); | 4436 | p = fs_path_alloc(); |
4437 | if (!p) | 4437 | if (!p) |
4438 | return -ENOMEM; | 4438 | return -ENOMEM; |
4439 | ret = get_cur_path(sctx, sctx->cur_ino, sctx->cur_inode_gen, p); | ||
4440 | if (ret < 0) | ||
4441 | goto tlv_put_failure; | ||
4439 | memset(sctx->read_buf, 0, BTRFS_SEND_READ_SIZE); | 4442 | memset(sctx->read_buf, 0, BTRFS_SEND_READ_SIZE); |
4440 | while (offset < end) { | 4443 | while (offset < end) { |
4441 | len = min_t(u64, end - offset, BTRFS_SEND_READ_SIZE); | 4444 | len = min_t(u64, end - offset, BTRFS_SEND_READ_SIZE); |
@@ -4443,9 +4446,6 @@ static int send_hole(struct send_ctx *sctx, u64 end) | |||
4443 | ret = begin_cmd(sctx, BTRFS_SEND_C_WRITE); | 4446 | ret = begin_cmd(sctx, BTRFS_SEND_C_WRITE); |
4444 | if (ret < 0) | 4447 | if (ret < 0) |
4445 | break; | 4448 | break; |
4446 | ret = get_cur_path(sctx, sctx->cur_ino, sctx->cur_inode_gen, p); | ||
4447 | if (ret < 0) | ||
4448 | break; | ||
4449 | TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, p); | 4449 | TLV_PUT_PATH(sctx, BTRFS_SEND_A_PATH, p); |
4450 | TLV_PUT_U64(sctx, BTRFS_SEND_A_FILE_OFFSET, offset); | 4450 | TLV_PUT_U64(sctx, BTRFS_SEND_A_FILE_OFFSET, offset); |
4451 | TLV_PUT(sctx, BTRFS_SEND_A_DATA, sctx->read_buf, len); | 4451 | TLV_PUT(sctx, BTRFS_SEND_A_DATA, sctx->read_buf, len); |