block: Do not write past block device boundary during a flush
When calling I/O functions of underlying block device driver we always
need to make sure that its size is small enough to not go past
device's boundary. Not only in get_chunk() and block_cache(), but in
writebuffer_flush() as well. Since the same code is used in three
different places, move it into a subroutine and adjust all of the
calls to ->write()/->read() accordingly.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent cee4c2a commit 17c4b989a5d00fe5fc84c528bbd59583c45d80d0
@Andrey Smirnov Andrey Smirnov authored on 22 Jan 2019
Sascha Hauer committed on 22 Jan 2019
Showing 1 changed file
View
common/block.c