diff options
author | David Sterba <dsterba@suse.cz> | 2014-02-25 13:32:59 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fb.com> | 2014-03-10 15:16:58 -0400 |
commit | 1b2782c8ed24db03ad49942fa37c9f196b7c4af3 (patch) | |
tree | d17bf2906f08350ecb62ec4fe9dce3b843d7609f | |
parent | 176840b3aa3cb795ddec4fc665ffbd707abff906 (diff) |
btrfs: send: fix old buffer length in fs_path_ensure_buf
In "btrfs: send: lower memory requirements in common case" the code to
save the old_buf_len was incorrectly moved to a wrong place and broke
the original logic.
Reported-by: Filipe David Manana <fdmanana@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Filipe David Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@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 298e25de13ab..246df8513c8a 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -346,6 +346,9 @@ static int fs_path_ensure_buf(struct fs_path *p, int len) | |||
346 | if (p->buf_len >= len) | 346 | if (p->buf_len >= len) |
347 | return 0; | 347 | return 0; |
348 | 348 | ||
349 | path_len = p->end - p->start; | ||
350 | old_buf_len = p->buf_len; | ||
351 | |||
349 | /* | 352 | /* |
350 | * First time the inline_buf does not suffice | 353 | * First time the inline_buf does not suffice |
351 | */ | 354 | */ |
@@ -368,9 +371,6 @@ static int fs_path_ensure_buf(struct fs_path *p, int len) | |||
368 | p->buf_len = ksize(p->buf); | 371 | p->buf_len = ksize(p->buf); |
369 | } | 372 | } |
370 | 373 | ||
371 | path_len = p->end - p->start; | ||
372 | old_buf_len = p->buf_len; | ||
373 | |||
374 | if (p->reversed) { | 374 | if (p->reversed) { |
375 | tmp_buf = p->buf + old_buf_len - path_len - 1; | 375 | tmp_buf = p->buf + old_buf_len - path_len - 1; |
376 | p->end = p->buf + p->buf_len - 1; | 376 | p->end = p->buf + p->buf_len - 1; |