[Devel] [PATCH RHEL8 COMMIT] ploop: Introduce ploop_prq_valid()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jul 2 22:48:00 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.51
------>
commit 9a3b1e00e6a88e55ebeb9088eafcb777651502f6
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Jul 2 22:48:00 2021 +0300

    ploop: Introduce ploop_prq_valid()
    
    ... instead of ploop_pio_valid().
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    ==========================
    ploop: Split pios in kwork
    
    https://jira.sw.ru/browse/PSBM-131208
    
    Kirill Tkhai (10):
          ploop: Remove debug noinline in create_bvec_from_rq()
          ploop: Manage flush pios in generic way
          ploop: Teach dispatch_pios() work with flush pios
          ploop: Make split_pios_to_list() to add initial pio to the list too
          ploop: Introduce embedded_pio_to_prq()
          ploop: Introduce ploop_prq_valid()
          ploop: Move create_bvec_from_rq() up
          ploop: Split pios from kwork context
          ploop: Add sanity check of passed BAT from disk
          ploop: Reread file size after index update
---
 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