From: David Sterba Date: Tue, 25 Feb 2014 18:32:59 +0000 (+0100) Subject: btrfs: send: fix old buffer length in fs_path_ensure_buf X-Git-Tag: v5.15~17887^2~87 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b2782c8ed24db03ad49942fa37c9f196b7c4af3;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: David Sterba Reviewed-by: Filipe David Manana Signed-off-by: Josef Bacik --- diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 298e25d..246df85 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) 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 */ @@ -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;