]> git.baikalelectronics.ru Git - kernel.git/commit
lightnvm: pblk: advance bio according to lba index
authorJavier González <jg@lightnvm.io>
Fri, 28 Jul 2017 13:13:16 +0000 (15:13 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 28 Jul 2017 14:06:00 +0000 (08:06 -0600)
commitd2010bbfd97b7af8a1bf4796144644811f66d3b9
tree867ba4c5211487b1aa5907302054efc7bead8ec4
parent2e219ca3855d1f8acee17abafd358072ba79f8e9
lightnvm: pblk: advance bio according to lba index

When a lba either hits the cache or corresponds to an empty entry in the
L2P table, we need to advance the bio according to the position in which
the lba is located. Otherwise, we will copy data in the wrong page, thus
causing data corruption for the application.

In case of a cache hit, we assumed that bio->bi_iter.bi_idx would
contain the correct index, but this is no necessarily true. Instead, use
the local bio advance counter and iterator. This guarantees that lbas
hitting the cache are copied into the right bv_page.

In case of an empty L2P entry, we omitted to advance the bio. In the
cases when the same I/O also contains a cache hit, data corresponding
to this lba will be copied to the wrong bv_page. Fix this by advancing
the bio as we do in the case of a cache hit.

Fixes: 666397e18deb lightnvm: physical block device (pblk) target
Signed-off-by: Javier González <javier@javigon.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/lightnvm/pblk-rb.c
drivers/lightnvm/pblk-read.c
drivers/lightnvm/pblk.h