[Devel] [PATCH RH8 06/10] ploop: Introduce ploop_prq_valid()
Kirill Tkhai
ktkhai at virtuozzo.com
Wed Jun 30 19:46:40 MSK 2021
... instead of ploop_pio_valid().
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/md/dm-ploop-map.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 20f60acd2be3..94a923fa27b7 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -78,13 +78,15 @@ void init_pio(struct ploop *ploop, unsigned int bi_op, struct pio *pio)
}
/* Get clu related to pio sectors */
-static int ploop_pio_valid(struct ploop *ploop, struct pio *pio)
+static int ploop_prq_valid(struct ploop *ploop, struct ploop_rq *prq)
{
- sector_t sector = pio->bi_iter.bi_sector;
+ struct request *rq = prq->rq;
+
+ sector_t sector = blk_rq_pos(rq);
loff_t end_byte;
u32 end_clu;
- end_byte = to_bytes(sector) + pio->bi_iter.bi_size - 1;
+ end_byte = to_bytes(sector) + blk_rq_bytes(rq) - 1;
end_clu = POS_TO_CLU(ploop, end_byte);
if (unlikely(end_clu >= ploop->nr_bat_entries)) {
@@ -93,7 +95,7 @@ static int ploop_pio_valid(struct ploop *ploop, struct pio *pio)
* via dm_set_target_max_io_len().
*/
WARN_ONCE(1, "sec=%llu, size=%u, end_clu=%u, nr=%u\n",
- sector, pio->bi_iter.bi_size,
+ sector, blk_rq_bytes(rq),
end_clu, ploop->nr_bat_entries);
return -EINVAL;
}
@@ -1726,9 +1728,6 @@ static void submit_pio(struct ploop *ploop, struct pio *pio)
queue_list = &ploop->pios[PLOOP_LIST_DEFERRED];
worker = &ploop->worker;
- if (ploop_pio_valid(ploop, pio) < 0)
- goto kill;
-
ret = split_pio_to_list(ploop, pio, &list);
if (ret) {
pio->bi_status = BLK_STS_RESOURCE;
@@ -1783,6 +1782,9 @@ int ploop_clone_and_map(struct dm_target *ti, struct request *rq,
prq = map_info_to_embedded_prq(info);
init_prq(prq, rq);
+ if (ploop_prq_valid(ploop, prq) < 0)
+ return DM_MAPIO_KILL;
+
pio = map_info_to_embedded_pio(info); /* Embedded pio */
init_pio(ploop, req_op(rq), pio);
More information about the Devel
mailing list