Skip to content

Commit

Permalink
btrfs: send: fix old buffer length in fs_path_ensure_buf
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David Sterba <[email protected]>
Reviewed-by: Filipe David Manana <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
  • Loading branch information
kdave authored and Josef Bacik committed Mar 10, 2014
1 parent 176840b commit 1b2782c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/btrfs/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
if (p->buf_len >= len)
return 0;

path_len = p->end - p->start;
old_buf_len = p->buf_len;

/*
* First time the inline_buf does not suffice
*/
Expand All @@ -368,9 +371,6 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
p->buf_len = ksize(p->buf);
}

path_len = p->end - p->start;
old_buf_len = p->buf_len;

if (p->reversed) {
tmp_buf = p->buf + old_buf_len - path_len - 1;
p->end = p->buf + p->buf_len - 1;
Expand Down

0 comments on commit 1b2782c

Please sign in to comment.