diff options
author | David Wilder <dwilder@us.ibm.com> | 2007-06-27 17:10:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-28 14:34:54 -0400 |
commit | 8d62fdebdaf9b866c7e236a8f5cfe90e6dba5773 (patch) | |
tree | da32cb460417b1ff83fb11a9d5412142014b72fd | |
parent | ea7fc3336b1d657c65daf55614d4aaadd8c1c244 (diff) |
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: Tom Zanussi <zanussi@us.ibm.com>
Signed-off-by: David Wilder <dwilder@us.ibm.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/relay.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/relay.c b/kernel/relay.c index 4311101b0ca7..e61156ea4e25 100644 --- a/kernel/relay.c +++ b/kernel/relay.c | |||
@@ -899,7 +899,10 @@ static size_t relay_file_read_start_pos(size_t read_pos, | |||
899 | size_t read_subbuf, padding, padding_start, padding_end; | 899 | size_t read_subbuf, padding, padding_start, padding_end; |
900 | size_t subbuf_size = buf->chan->subbuf_size; | 900 | size_t subbuf_size = buf->chan->subbuf_size; |
901 | size_t n_subbufs = buf->chan->n_subbufs; | 901 | size_t n_subbufs = buf->chan->n_subbufs; |
902 | size_t consumed = buf->subbufs_consumed % n_subbufs; | ||
902 | 903 | ||
904 | if (!read_pos) | ||
905 | read_pos = consumed * subbuf_size + buf->bytes_consumed; | ||
903 | read_subbuf = read_pos / subbuf_size; | 906 | read_subbuf = read_pos / subbuf_size; |
904 | padding = buf->padding[read_subbuf]; | 907 | padding = buf->padding[read_subbuf]; |
905 | padding_start = (read_subbuf + 1) * subbuf_size - padding; | 908 | padding_start = (read_subbuf + 1) * subbuf_size - padding; |