Commit 8d62fdeb authored by David Wilder's avatar David Wilder Committed by Linus Torvalds

relay file read: start-pos fix

Fix a bug in the relay read interface causing the number of consumed bytes
to be set incorrectly.
Signed-off-by: default avatarTom Zanussi <zanussi@us.ibm.com>
Signed-off-by: default avatarDavid Wilder <dwilder@us.ibm.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ea7fc333
...@@ -899,7 +899,10 @@ static size_t relay_file_read_start_pos(size_t read_pos, ...@@ -899,7 +899,10 @@ static size_t relay_file_read_start_pos(size_t read_pos,
size_t read_subbuf, padding, padding_start, padding_end; size_t read_subbuf, padding, padding_start, padding_end;
size_t subbuf_size = buf->chan->subbuf_size; size_t subbuf_size = buf->chan->subbuf_size;
size_t n_subbufs = buf->chan->n_subbufs; size_t n_subbufs = buf->chan->n_subbufs;
size_t consumed = buf->subbufs_consumed % n_subbufs;
if (!read_pos)
read_pos = consumed * subbuf_size + buf->bytes_consumed;
read_subbuf = read_pos / subbuf_size; read_subbuf = read_pos / subbuf_size;
padding = buf->padding[read_subbuf]; padding = buf->padding[read_subbuf];
padding_start = (read_subbuf + 1) * subbuf_size - padding; padding_start = (read_subbuf + 1) * subbuf_size - padding;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment