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>
This commit is contained in:
David Sterba 2014-02-25 19:32:59 +01:00 коммит произвёл Josef Bacik
Родитель 176840b3aa
Коммит 1b2782c8ed
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -346,6 +346,9 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
if (p->buf_len >= len) if (p->buf_len >= len)
return 0; return 0;
path_len = p->end - p->start;
old_buf_len = p->buf_len;
/* /*
* First time the inline_buf does not suffice * First time the inline_buf does not suffice
*/ */
@ -368,9 +371,6 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)
p->buf_len = ksize(p->buf); p->buf_len = ksize(p->buf);
} }
path_len = p->end - p->start;
old_buf_len = p->buf_len;
if (p->reversed) { if (p->reversed) {
tmp_buf = p->buf + old_buf_len - path_len - 1; tmp_buf = p->buf + old_buf_len - path_len - 1;
p->end = p->buf + p->buf_len - 1; p->end = p->buf + p->buf_len - 1;